Skip to content

.Net Standard 2.0 iOS compiling error - Could not AOT the assembly System.Runtime.CompilerServices.Unsafe.dll (MT3001) #1711

@marcoseraphin

Description

@marcoseraphin

Goals

NO error compiling an Xamarin Forms App using the realm NuGet package WITHOUT getting an iOS compiling error - Could not AOT the assembly System.Runtime.CompilerServices.Unsafe.dll (MT3001)

Expected Results

No compiling errors using a .Net Standard 2.0 project on VisualStudio for Mac using the realm NuGet package

Error description is here: dotnet/macios#3791

Is this an realm error or a Xamarin error ? I am not quite sure.

Actual Results

Unfortunately I am getting an compiling error "Could not AOT the assembly System.Runtime.CompilerServices.Unsafe.dll (MT3001)" when I compile the iOS project.

Steps to Reproduce

In this link is a sample dotnet/macios#3791 but I did not tested it. I get the error in my customer project.

Code Sample

Version of Realm and Tooling

  • Realm database NuGet package 2.2.0

Additional info:

The Xamarin Forms Android projects compiles without errors BUT when I start the project it will be compiled and deployed to the simulator without error, but after the app was started I got this error and the app stops:

[Mono] Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'.
[monodroid-assembly] Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.

I think both problems seems to be a linker problem ?

I found a web page with several solutions:

https://developercommunity.visualstudio.com/content/problem/152947/xamarin-android-run-error-could-not-load-assembly.html

This temp. helped, but is this a real solution ?
Did Realm provide a new NuGet package or do you know if Xamarin (Microsoft) will do so ?

Manually edit your csproj file and define, that the NU1605 warning shouldn't be treated as an error.

$(NoWarn);NU1605 Now in your Project File add the Package:

Thanx

Marco

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions