c# - Debugging weirdness with BeginInvoke -


i have following method:

protected void onbarcodescan(barcodescannereventargs e) {     if (barcodescan != null)     {         //barcodescan.begininvoke(e, null, null);         barcodescan(e);     } } 

when try step above method works fine. able step in , on parts of method.

however, if switch comment (so barcodescan(e) commented out , remove comment on barcodescan.begininvoke(e, null, null) cannot step part of onbarcodescan method (ie break point on if (barcodescan != null) not hit.

i tried putting debug statements in there too. long begin invoke call in there not let me step method.

i checked output , when try step in says this:

a first chance exception of type 'system.notsupportedexception' occurred in scannertest.exe step into: stepping on method without symbols 'symbol.marshaller.symbolmessagewindow.wndproc' step into: stepping on method without symbols 'microsoft.windowsce.forms.messagewindow._wndproc'

why whole method un step able when there begininvoke in it?

any great!

asynchronous delegate calls (i.e., begininvoke) not supported compact framework.

as reason why debugger not break method, believe because of following:

  • begininvoke/endinvoke methods generated c# compiler (it required this), marked "native". means clr provide implementation.
  • the compact framework clr does not provide implementation.
  • when jit compiler executes method first time, looks of methods may call (loading other assemblies, etc).
  • since clr doesn't support delegate.begininvoke, method calls cannot jit-compiled, , therefore cannot executed.
  • the notsupportedexception thrown when onbarcodescan first called (and jit-compiler attempts compile , fails). why cannot stepped debugger.

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -