Home > Software engineering >  How to find the reason for XAMARIN App crash
How to find the reason for XAMARIN App crash

Time:01-06

I wrote an App with XAMARIN. Currently I test the App with Android emulator.

Sometimes it happens, if I start debuggin of the App, I get a crash with Message:

System.NullReferenceException: 'Object reference not set to an instance of an object.'

Exception

This crashes happens before the UI in emulator shows any view. I just have a white screen if the crash happens.

Unfortunately, there is no information for this message. Is there a chance to get any information which line of code raised this error? Can I get any Stack trace ore something else? Im new in debugging with visual studio.

CodePudding user response:

In VS, try this:

  • Go to menu Debug > Windows > Exception Settings or type Ctrl-Alt-E.
  • Tick the box on the line that says "Common Language Runtime Exceptions".
  • Start a Debug session (F5).
  • VS will now break on any exception that occurs, even the ones that have a try...catch.
  • You may need to ignore a few exceptions (press F5 to proceed) to get to the actual location of your problem.
  • Analyze the problem and write a fix.
  • To reset VS back to its normal behavior, right click on the line "Common Language Runtime Exceptions" and select "Restore Defaults".
  •  Tags:  
  • Related