調試古怪我有以下方法:與BeginInvoke的
protected void OnBarcodeScan(BarcodeScannerEventArgs e)
{
if (BarcodeScan != null)
{
//BarcodeScan.BeginInvoke(e, null, null);
BarcodeScan(e);
}
}
當我踏進它工作正常,上述方法。我能夠一遍又一遍地遍歷該方法的所有部分。
但是,如果切換註釋(所以BarcodeScan(e)
被註釋掉,並取消對BarcodeScan.BeginInvoke(e, null, null)
評論我就不能踏入OnBarcodeScan方法的任何部分(即在if (BarcodeScan != null)
一個破發點並沒有被擊中。
我試着把一些調試語句放在那裏,但是隻要那個開始調用調用就在那裏,它不會讓我進入方法
我檢查了輸出,當我嘗試插入它說:
ScannerTest.exe中發生類型'System.NotSupportedException'的第一次機會異常 單步執行:單步執行不帶符號的方法'Symbol.Marshaller.SymbolMessageWindow.WndProc' 單步執行:單步執行不帶符號的方法'Microsoft.WindowsCE.Forms .MessageWindow._WndProc'
爲什麼整個方法在其中存在BeginInvoke時無法執行?
任何幫助將是偉大的!
您使用的是什麼版本的Visual Studio? – JaredPar 2010-12-01 23:49:46
你有沒有試過插入`Debugger.Break()`語句?有時候,如果斷點沒有被擊中,這會有所幫助... – Lucero 2010-12-02 00:03:26