Error starting iOS when linking to ReactiveUI 7.4

I have a Xamarin Forms project with a .Net Standard 1.4 core library that contains all the code. I have a link to ReactiveUI 7.4 both in the kernel and in iOS projects. But when I compile and run the iOS emulator, I get the following error when starting the application:

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> 

and

 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: 

Does anyone ever get this error?

UPDATE:

Here is a link to the error being played in iOS:

https://github.com/assassin316/ReactiveUIError

+5
source share
1 answer

So, I think there are a few things, and the project was not set up correctly

1) You need to install reactiveui nuget in all platform projects

At the moment, you only have the reactive kernel installed in the iOS project, you also need to install ReactiveUI

https://github.com/assassin316/ReactiveUIError/blob/master/ReactiveUIErrorTest/ReactiveUIErrorTest.iOS/packages.config

2) System.Reactive Libraries do not refer to the iOS project at all https://github.com/assassin316/ReactiveUIError/blob/master/ReactiveUIErrorTest/ReactiveUIErrorTest.iOS/ReactiveUIErrorTest.iOS.csproj

Therefore, they exist only in the packages.config file. Remove the Rx- * entries from the packages.config file and use the package manager console to manually install them.

 Install-Package Rx-Main -Version 2.2.5 Install-Package Rx-PlatformServices -Version 2.2.5 Install-Package Rx-Core -Version 2.2.5 

or just add this to the csproj file for your iOS project

 <Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Rx-Core.2.2.5\lib\portable-windows8+net45+wp8\System.Reactive.Core.dll</HintPath> </Reference> <Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Rx-Interfaces.2.2.5\lib\portable-windows8+net45+wp8\System.Reactive.Interfaces.dll</HintPath> </Reference> <Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Rx-Linq.2.2.5\lib\portable-windows8+net45+wp8\System.Reactive.Linq.dll</HintPath> </Reference> <Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Rx-PlatformServices.2.2.5\lib\portable-windows8+net45+wp8\System.Reactive.PlatformServices.dll</HintPath> </Reference> 

or convert your iOS project to using PackageReferences instead

3) Reactiveui-xamforms must also be installed in platform projects

At this point I was able to run your project

Your best hint of a problem was above the exception you sent

2017-09-02 12: 57: 43.983 Sekuence.iOS [86898: 37039424] Could not find the System.Reactive.Core referenced by the ReactiveUI assembly, Version = 7.4.0.0, Culture = neutral, PublicKeyToken = null.

2017-09-02 12: 57: 43.985 Sekuence.iOS [86898: 37039424] Could not find the System.Reactive.Interfaces referenced by the ReactiveUI assembly, Version = 7.4.0.0, Culture = neutral, PublicKeyToken = null.

2017-09-02 12: 57: 43.986 Sekuence.iOS [86898: 37039424] Could not find the System.Reactive.Linq referenced by the ReactiveUI assembly, Version = 7.4.0.0, Culture = neutral, PublicKeyToken = null.

2017-09-02 12: 57: 43.986 Sekuence.iOS [86898: 37039424] Could not find the System.Reactive.PlatformServices referenced by the ReactiveUI assembly, Version = 7.4.0.0, Culture = neutral, PublicKeyToken = null.

2017-09-02 12: 57: 44.029 Sekuence.iOS [86898: 37039424] Could not find the System.Reactive.Core referenced by the assembly ReactiveUIErrorTest.Core, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null.

2017-09-02 12: 57: 44.030 Sekuence.iOS [86898: 37039424] Could not find ReactiveUI.XamForms referenced by the assembly ReactiveUIErrorTest.Core, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null.

So basically he says that he cannot find any of these dlls. I looked into the bin folder of the iOS project and, of course, none of them were there. So I just reinstalled all these packages, and then everything worked

+4
source

Source: https://habr.com/ru/post/1271206/


All Articles