如何在Xamarin iOS应用程序的堆栈跟踪中显示我的源代码?

时间:2018-05-02 23:13:16

标签: visual-studio xamarin xamarin.ios mono

我的Xamarin iOS应用程序崩溃,错误“无法识别的选择器发送到实例...”,但堆栈跟踪和调用堆栈都没有任何有用的信息,可能是我的源代码中的问题。我正在使用Visual Studio for Mac,该应用程序正在iOS模拟器上运行。是否需要启用任何选项才能在堆栈跟踪中显示源代码?

Unhandled Exception:
Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[NSObject doesNotRecognizeSelector]: unrecognized selector sent to instance 0x600000016d80
Native stack trace:
    0   CoreFoundation                      0x000000010579e12b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001066d8f41 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010581f024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x0000000105720f78 ___forwarding___ + 1432
    4   CoreFoundation                      0x0000000105720958 _CF_forwarding_prep_0 + 120
    5   Foundation                          0x0000000103997f35 __NSFireDelayedPerform + 409
    6   CoreFoundation                      0x000000010572e174 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    7   CoreFoundation                      0x000000010572de32 __CFRunLoopDoTimer + 1026
    8   CoreFoundation                      0x000000010572d9ea __CFRunLoopDoTimers + 266
    9   CoreFoundation                      0x0000000105725404 __CFRunLoopRun + 2308
    10  CoreFoundation                      0x0000000105724889 CFRunLoopRunSpecific + 409
    11  GraphicsServices                    0x0000000108cfb9c6 GSEventRunModal + 62
    12  UIKit                               0x00000001013375d6 UIApplicationMain + 159
    13  ???                                 0x00000001179fbe98 0x0 + 4691312280
    14  ???                                 0x00000001179fbac3 0x0 + 4691311299

enter image description here

enter image description here

更新

问题似乎与模拟器的.dSYM files not being generated有关。

2 个答案:

答案 0 :(得分:1)

这是我添加到<?php include('classes/DB.php'); $male = DB::query('SELECT COUNT(*) AS MTOTAL FROM users WHERE gender=\'male\';'); $female = DB::query('SELECT COUNT(*) AS FTOTAL FROM users WHERE gender=\'female\';'); ?> <html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages': ['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Task', 'Number of Male and Female visitors'], ['Male', <?php while ($s = $male->fetch()) {echo $s ['count(*)'];}?>], ['Female', <?php while ($s = $female->fetch()) {echo $s ['count(*)'];}?>], ]); var chart = new google.visualization.PieChart(document.getElementById('piechart')) chart.draw(data, options);} </script> </head> <body> <div id="piechart" style="width: 900px; height: 500px;"></div> </body> </html> 类的内容,以便更好地查看异常信息:

Application.cs

答案 1 :(得分:0)

您可以在 xamarin 源代码中进行跟踪。 Details specified in Microsoft documentation.

此外,您还可以通过更改 Xamarin 选项 as specified in Xamarin forums 在调试期间获得更多诊断详细信息。