realm-dotnet: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

Just attempted to load my project in Visual Studio after developing solely in Xamarin Studio for the entire project duration.

I’m getting this error: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

The error occurs during this call. _realm = Realm.GetInstance("salt.realm");

The project type is Xamarin.Android with a PCL project and uses the latest version of Realm (0.81.0). I’ve tried all the different linking options to no avail.

All my realm objects contain the attribute: [Preserve(AllMembers = true)]

I’m also using Nuget v3 with the project.json file. Not sure if that makes a difference.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (16 by maintainers)

Most upvoted comments

No, it doesn’t have a name yet, but likely 1.2.0.

Are you using the stable Xamarin channel? Also, can you get it, can you share the LoaderExceptions and Types?

Apart from the fixes being applied by the latest 1.0.3, I was being caught by a very nasty gotcha - If if you have a local nuget source pointing at a directory, it appears to do a depth-first search of any folders in there. Thus, an old version of nugets was being silently retrieved.

The moral is, be very careful you only have one copy of things in a subtree.