问题
如果我的代码(或各种异常)中某处出现空异常,而不是在实际发生null引用的地方抛出异常,Visual Studio会在此处暂停代码:
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// This is where the application breaks on exception
UIApplication.Main(args, null, "AppDelegate");
}
}
当我编写代码时,我可能会更加小心,但是当应用程序没有破坏空引用实际发生的地方时,它很难调试问题。在这里打破告诉我一切。有可能解决这个问题吗?
堆栈跟踪示例
Unhandled Exception:
System.NotImplementedException: The method or operation is not implemented.
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at AirlineChoice.iOS.Application.Main (System.String[] args) [0x00001] in D:\Development\Airline Choice Suite\Source Code\Development\Airline Choice Mobile\AirlineChoice\AirlineChoice.iOS\Main.cs:12
2017-02-22 16:15:11.780 AirlineChoice.iOS[7647:100649] Unhandled managed exception:
The method or operation is not implemented. (System.NotImplementedException)
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at AirlineChoice.iOS.Application.Main (System.String[] args) [0x00001] in D:\Development\Airline Choice Suite\Source Code\Development\Airline Choice Mobile\AirlineChoice\AirlineChoice.iOS\Main.cs:12