Xamarin.UWP DryIoC error: Code generation not supported on this platform

If you are getting the following error when using DryIoC with Xamarin.Forms on UWP:

System.PlatformNotSupportedException: Dynamic code generation is not
supported on this platform.
at System.Reflection.Emit. TypeBuilder.GetMethod (Type, Methodinfo) + 0x2d
rgsNew(Constructorlnfo, Type, Type[, Type) + 0x5b
oundToFirstClosureParam(Type, Expression, IParameterProvider, Typel, Type.
CompilerFlags) + 0x73
at Dryloc.FactoryDelegateCompiler.CompileToFactoryDelegate(Expression.
Boolean) + 0x14c
at Dryloc.Container.Dryloc.IResolver.Resolve(Type, IfUnresolved) + 0x23c

Then instantiate your container with this code:

Container = new Container(rules =>
    // https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/ResolutionPipeline.md
    return rules.WithUseInterpretation();

The reason why you need to do this is here: DryIoc/ResolutionPipeline.md at master · dadhi/DryIoc · GitHub

This content has 10 months. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.