简体   繁体   中英

Xamarin Strange exception in VS2015

I'm Developing an APP wich communicate with BLE devices. everything works fine so fare but when i switch multiple times from an activity i get an undebuggable exception:

01-26 09:06:43.040 I/Timeline( 7341): Timeline: Activity_launch_request id:BLEAPPtime:710885426 Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.VisualStudio.Debugger.AD7DebugExceptionEvent..ctor(Thread thread, String description) in C:\\Users\\builder\\data\\lanes\\2599\\1390b70a\\source\\XamarinVS\\src\\Core\\VisualStudio\\Debugging\\MonoTools.Engine\\AD7Events.cs:line 433 at Xamarin.VisualStudio.Debugger.ExceptionsAdapter.OnUnhandledException(Object sender, TargetEventArgs args) in C:\\Users\\builder\\data\\lanes\\2599\\1390b70a\\source\\XamarinVS\\src\\Core\\VisualStudio\\Debugging\\MonoTools.Engine\\ExceptionsAdapter.cs:line 67 at Mono.Debugging.Client.DebuggerSession.OnTargetEvent(TargetEventArgs args) at Mono.Debugging.Soft.SoftDebuggerSession.HandleBreakEventSet(Event[] es, Boolean dequeuing) at Mono.Debugging.Soft.SoftDebuggerSession.HandleEventSet(EventSet es) at Mono.Debugging.Soft.SoftDebuggerSession.EventHandler() Thread finished: #6 The thread '' (0x6) has exited with code 0 (0x0).

I don't know where it came from if i debug every single step is passing until my activity finished at the last code bracket then i get this weird exception.

Does someone has any clue how to debug this? or about this BUG.

https://bugzilla.xamarin.com/show_bug.cgi?id=38122

I have exactly the same issue here you can see the captures:

FirstError screen

SecondError screen

I strongly think that there is a bug with BLE classes and Xamarin.Android debugger.

It seems to me that if all the code I put in

RangeNotifier_DidRangeBeaconsInRegionComplete/ MonitorNotifier_EnterRegionComplete and MonitorNotifier_ExitRegionComplete

is ok then there are no problems, but if there are null references or another fails I am getting this problem and the whole debug sistem it is stuck.

In my experience working with this technology in visual studio I can say that I can just follow DidRangeBeaconsInRegionComplete with the debug the first time then it goes it self and it does not stop anymore even if I can see clearly that the program continues.

I also notice that when it is not working properly I can put a breakpoint and the whole program is stuck in this point but I can not see the breakpoing in visual studio and sometimes this errors that I post came out.

My advice is:

  1. First of all, check well that there are no null objects or problems in the code you are putting into this methods from the BLE libraries. For example testing the functions outside first.
  2. Delete always bin and obj folders after cleaning the solution as it is said in Breakpoints and Exceptions stopped working properly, xamarin android .
  3. Let's wait for an update and pray we can finish the app we are doing anyway!!

I hope it helps because I am in the same situation and it sucks so much!

After hours and days struggling i found the problem ! the problem was that my application took to long to execute hes task so i wrapped it up on a background task

new Task (() => 
{ 
   //Your code here... 

}).Start();

So keep in mind you need to wireup long executing tasks even if the take not that long ! `

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM