我一直在C#中申请。它一直工作到最近,我决定将InitialiseChromium()
void放在另一个类中,发现我无法向mdtTab
TabPage添加控件。所以,我解除了我的更改,但现在我的应用程序挂起mdtTab.Controls.Add(browser);
browser2
已添加到另一个TabPage
,但我的应用永远不会那么远。
我的代码如下:
public void InitialiseChromium()
{
CefSettings settings = new CefSettings
{
CachePath = DataPath,
//publicly declared as DataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\WinMDT"
BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe",
PersistSessionCookies = true
};
// everything is good so far...
// init cef with settings
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
string mdtLink;
using (WebClient wb = new WebClient())
{
mdtLink = wb.DownloadString("LINK REDACTED");
//It downloads the url from a pastebin raw url so i can update the url it links to without updating the entire app
}
//everything still working fine...
//create browser
browser = new ChromiumWebBrowser(mdtLink);
//i added a breakpoint below and that was triggered, but not the one on the line below it
mdtTab.Controls.Add(browser); // << Breakpoint triggers, but it hangs here
browser.Dock = DockStyle.Fill; //<< Breakpoint is never triggered...
//create browser
browser2 = new ChromiumWebBrowser("www.google.co.uk");
outsideWorldTab.Controls.Add(browser2);
browser2.Dock = DockStyle.Fill;
browser.BrowserSettings.ApplicationCache = CefState.Enabled;
browser2.BrowserSettings.ApplicationCache = CefState.Enabled;
}
答案 0 :(得分:0)
事实证明我通过x86
平台调试解决了问题,因为我意外地更改为AnyCPU
。
请注意,{{1}}平台上的调试要求您在项目文件中添加一些代码如果使用CefSharp !