Xamarin Android Exception causes “Frame not in mod

2019-02-24 05:39发布

问题:

I am new to Xamarin and currently developing my first app with Android.

I have deliberately created an exception as follows:

throw new Exception("Whoops");

When I hit this line, the Emulator does not give any indication that there has been a problem. If I set a breakpoint on the above line in Visual Studio and then step over it, I get the following error:

Frame not in module The current stack frame was not found in a loaded module.

How can I get Visual Studio to tell me exactly what went wrong? At the moment I can't find any trace of the exception.

回答1:

this comes because debugger can't go to other namespace so if your code calling other methods from other namespace go to it and add a point



回答2:

I work with Xamarin.forms and have the problem with my .droid project...
The error-messages “frame not in module” appears every time, if VS tries to investigate “foreign” code. This, although I have set the option “Enable Just My Code” in the options to the debugger (so... for me it’s a bug).

However, a simple workaround works for me:
In debug mode simply click on the button step over (F10) instead of “step into” (note: this is the button on the right of step over in the upper icon bar of VS).



回答3:

This link told me what I needed to know: https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/android_debug_log/

You just go to View > Other Windows > Android Device Logging from within Visual Studio. I found it best to use text view.

If there is a better way then please let me know though.



回答4:

Only this worked for me on VS 2015:

  1. open "DEBUG -> Windows -> Exception Settings"

  2. tick the parent option "Common Language Runtime Exceptions" so all its children are ticked.

(same works with VS 2013 but on step 1. open "DEBUG -> Exceptions)