Search code examples
c#xamarinreflection.net-assembly

Xamarin Reflection Assembly.LoadFile not supported


i´m looking for an fixing of this error:

System.NotSupportedException: "Assembly.LoadFile is not supported in AppX."

I´ve got an Xamarin-Project and i ´m trying to create an instance of a type of mine. all in all it looks like this:

        var assembly = Assembly.LoadFile("MicroChatsTest.dll");
        var type = typeof(IUpdate);
        var mytypes = assembly.GetTypes().Where(p => type.IsAssignableFrom(p)).FirstOrDefault();
        if (mytypes == null) throw new Exception("E1234");


        var whatever = Activator.CreateInstance(mytypes);

the error comes in the first line, because AppX/Xmarin doesn´t support the Assembly.LoadFile, is there any possibillity to fix this? thanks a lot.


Solution

  • Unfortunately, you cannot load non-AOT compiled assemblies in Xamarin: https://forums.xamarin.com/discussion/2294/assembly-load-is-it-possible