我正在使用Backgroundworker(在vb.net中)。 我在Windows 8 Pro(64位)下工作,項目工作正常......但如果我在Windows 7(64位)的計算機上傳輸可執行文件,會發生一件奇怪的事情! BackgroundWorker的DoWork不起作用,它直接跳到RunWorkerCompleted。 我不明白爲什麼。 我使用Visual Studio 2012 Express Edition進行編譯。 你有想法解決這個問題嗎? 謝謝。在另一臺計算機上跳過Backgroundworker的DoWork
這是一些代碼:
Private Sub bgw_extract_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles bgw_extract.DoWork
MsgBox("test dowork") 'this appear
extract_cycle() 'this isn't executed
MsgBox("end dowork") 'this isn't executed
End Sub
Private Sub extract_cycle()
'nothing is executed here
MsgBox("test2") 'not executed
Try
'my code....
Catch ex As Exception
MessageBox.Show(ex.ToString(), "Extract Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub bgw_extract_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles
bgw_extract.RunWorkerCompleted
MsgBox("RunWorkCompleted") 'this is executed in every case
End Sub
您是否嘗試用最小的例子縮小問題範圍? – JohnB
[未處理的異常未在C#中捕獲]的可能的重複(http://stackoverflow.com/questions/10463408/unhandled-exception-not-caught-in-c-sharp) –
可以顯示一些代碼,它有點困難猜猜你在做什麼? – Patrick