我没有理由对我的应用程序崩溃提出了一个问题,我只退出了退出代码 -2146233082(0x80131506)没有更多(今天看到)。所以我问StackOverflow,有人告诉我,错误是BackGroundWorker中的代码
Start.Back.PerformClick()无法正常工作。并且没有一个BGW代码实际上在工作线程上运行。
。 所以我改变它,但我会知道它是否可以因为它仍然崩溃没有任何异常和任何东西(我在Windows事件日志中看到我捕获未处理的异常)我只回忆了代码-2146233082(0x80131506),仅此而已表单关闭或结束事件被触发,它停止。 。
我用作浏览器“GeckoFX”
private void Start_Back_Click(object sender, EventArgs e)
{
List<Links> tempList = getListFromWeb();
if (!backgroundWorker1.IsBusy)
{
backgroundWorker1.RunWorkerAsync(tempGoogle);
}
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
List<Links> temp = (List<Links>)e.Argument;
foreach (Links link in temp)
{
if (backgroundWorker1.CancellationPending)
{
e.Cancel = true; return;
}
_busy.WaitOne();
AddTabSafeThread(link.url);
}
Thread.Sleep(1000);
SearchSafeThread(ListToSearch);
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{ //Check Stuff Error and Cancelled
if (e.Error != null)
{... }
else if (e.Cancelled)
{ ....}
else //Else remove all tab
{
bool canRemove = this.TabCount >= 1;
if (canRemove)
{
WebBrowserTabPage tab = this.SelectedWebBrowserTagPage;
this.TabPages.Remove(tab);
tab.Dispose();
}
**Start.Back.PerformClick();** //Click on button again to start another time the backgroundworker
}
private void AddTabSafeThread(Browser tempBrowser)
{
if (this.tabs.InvokeRequired) //TabControl is tabs
{
this.tabs.Invoke(new m_SafeTab(AddTabSafeThread), new object[] { tempBrowser });
}
else
//in TabControl Class i create the WebBrowser And i call Navigate
{ this.tabs.addTab(tempBrowser.url);
//Do Stuff
}