简体   繁体   English

Xamarin奇怪的例外VS2015

[英]Xamarin Strange exception in VS2015

I'm Developing an APP wich communicate with BLE devices. 我正在开发一个与BLE设备通信的APP。 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. 01-26 09:06:43.040 I / Timeline(7341):时间轴:Activity_launch_request id:BLEAPPtime:710885426对象引用未设置为对象的实例。 System.NullReferenceException: Object reference not set to an instance of an object. System.NullReferenceException:未将对象引用设置为对象的实例。 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). 在C:\\ Users \\ builder \\ data \\ lanes \\ 2599 \\ 1390b70a \\ source \\ XamarinVS \\ src \\ Core \\ VisualStudio \\ Debugging \\ MonoTools.Engine \\中的Xamarin.VisualStudio.Debugger.AD7DebugExceptionEvent..ctor(线程线程,字符串描述) AD7Events.cs:第433行,位于C:\\ Users \\ builder \\ data \\ lanes \\ 2599 \\ 1390b70a \\ source \\ XamarinVS \\ src \\ Core \\ VisualStudio \\ Debugging中的Xamarin.VisualStudio.Debugger.ExceptionsAdapter.OnUnhandledException(Object sender,TargetEventArgs args) \\ MonoTools.Engine \\ ExceptionsAdapter.cs:Mono.Debugging.Soft.Soft.SoftDebuggerSession.HandleBreakEventSet(Event [] es,Boolean dequeuing)Mono.Debugging.Soft的Mono.Debugging.Client.DebuggerSession.OnTargetEvent(TargetEventArgs args)第67行Mono.Debugging.Soft.SoftDebuggerSession.EventHandler()中的.SoftDebuggerSession.HandleEventSet(EventSet es)线程完成:#6线程''(0x6)已退出,代码为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. 或者关于这个BUG。

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

I have exactly the same issue here you can see the captures: 我在这里有完全相同的问题你可以看到捕获:

FirstError screen FirstError屏幕

SecondError screen SecondError屏幕

I strongly think that there is a bug with BLE classes and Xamarin.Android debugger. 我强烈认为BLE类和Xamarin.Android调试器存在错误。

It seems to me that if all the code I put in 在我看来,如果我放入的所有代码

RangeNotifier_DidRangeBeaconsInRegionComplete/ MonitorNotifier_EnterRegionComplete and MonitorNotifier_ExitRegionComplete RangeNotifier_DidRangeBeaconsInRegionComplete / MonitorNotifier_EnterRegionComplete和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. 根据我在visual studio中使用这项技术的经验,我可以说我可以在第一次使用调试时跟随DidRangeBeaconsInRegionComplete,然后自动进行,即使我能清楚地看到程序仍在继续,它也不会停止。

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. 首先,检查您从BLE库中放入此方法的代码中是否存在空对象或问题。 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 . 清理解决方案后,总是删除bin和obj文件夹,因为 断点和异常停止正常工作,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 ! 所以请记住,即使花费的时间不长,也需要连接长时间执行的任务! ` `

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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