【发布时间】:2017-09-04 00:47:18
【问题描述】:
我有一个带有 .Net Standard 1.4 核心库的 Xamarin Forms 项目,其中包含所有代码。我在核心项目和 iOS 项目中都引用了 ReactiveUI 7.4。但是当我在 iOS 模拟器上编译和运行时,应用启动时出现以下错误:
2017-08-24 13:39:39.040 TestProject.iOS[25074:307385] Could not register the assembly 'ReactiveUI': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/corlib/System.Reflection/Assembly.cs:410
at Registrar.DynamicRegistrar.CollectTypes (System.Reflection.Assembly assembly) [0x00000] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/ObjCRuntime/DynamicRegistrar.cs:237
at Registrar.Registrar.RegisterAssembly (System.Reflection.Assembly assembly) [0x00056] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/ObjCRuntime/Registrar.cs:1978
Loaded assembly: /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/Agents/iOS/Xamarin.Interactive.iOS.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/Agents/iOS/Xamarin.Interactive.dll [External]
Unhandled Exception:
System.BadImageFormatException: <Timeout exceeded getting exception details>
和
Unhandled Exception:
System.BadImageFormatException: Could not resolve field token 0x040000fd
File name: 'ReactiveUI'
at TestProject.iOS.AppDelegate..ctor () [0x00008] in C:\TestProject\TestProject.iOS\AppDelegate.cs:24
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/4991/80b8487d/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/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at TestProject.iOS.Application.Main (System.String[] args) [0x00001] in C:\TestProject\TestProject.iOS\Main.cs:17
2017-08-24 13:39:46.074 TestProject.iOS[25074:307385] Unhandled managed exception:
有人收到过这个错误吗??
更新:
这是在 iOS 上重现的错误的链接:
【问题讨论】:
-
能否请您上传一份复制品到 GitHub。塔。
-
好的,让我试着把一个放在一起。
-
您好@GeoffreyHuntley,这是一个产生错误的小项目。我希望这有帮助! github.com/assassin316/ReactiveUIError
-
乍一看,似乎没有安装所有东西。在 ReactiveUI 的 v8 myget 包中也应该有 netstandard 支持。对于 Xamarin.Forms,请使用
2.3.5.235-pre2+ -
System.BadImageFormatException 通常意味着一个 dll 被编译为错误的架构。或者您使用的 dll 与您尝试运行它的架构不兼容。
标签: xamarin xamarin.ios xamarin.forms reactiveui