【发布时间】:2015-04-21 01:16:03
【问题描述】:
我正在测试将 Xamarin.Forms + F# 用于辅助项目的可行性。当事情奏效时,很棒。但是当代码有问题时,我总是会得到这个异常:
System.TypeInitializationException: An exception was thrown by the type initializer for <StartupCode$BestSellerPOS>.$Forms
不管错误发生的原因。所以,我需要从一开始就一步一步地处理每一行,看看发生了什么。
这次这是完整的异常(这已经发生了好几次了,但我没有记录之前的错误,看看是否是相同的确切回溯...只记得是相同的初始例外):
System.TypeInitializationException: An exception was thrown by the type initializer for <StartupCode$BestSellerPOS>.$Forms ---> System.Exception: Missing or incorrect header for method .cctor
--- End of inner exception stack trace ---
at BestSellerPOS.Forms.get_mainForm () [0x00000] in <filename unknown>:0
at BestSellerPOS.App.get_FormDocs () [0x00000] in /Users/mamcx/Proyectos/BestSeller/BestSellerNET/Core/App.fs:7
at BestSellerPOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x0001c] in /Users/mamcx/Proyectos/BestSeller/BestSellerNET/iOS/AppDelegate.fs:16
at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
at BestSellerPOS.Main.main (System.String[] args) [0x00000] in /Users/mamcx/Proyectos/BestSeller/BestSellerNET/iOS/AppDelegate.fs:23
我有所有东西的最新版本,在优胜美地。
警察局:
我已经设置了一个具有最少编码的空白解决方案,并在启动时强制除以零错误。仍然没有收到该错误,而是一条通用消息。
然后创建另一个黑色解决方案,这一次,没有共享项目,完全按照 xamarin ios 模板提供的方式。这给出了一个很好的例外,并指向确切的位置!
【问题讨论】:
标签: exception f# xamarin xamarin.forms