Andr谩s T贸th‘s professional blog
banditoth.net

Hey there 馃憢, I’m banditoth a .NET MAUI developer from Hungary.
I write about software development with .NET technologies.

You can find me on:
LinkedIn | Github | StackOverflow | X / Twitter | Threads

Tag: xamarin forms uwp

  • Xamarin.UWP: Image from embedded resource throws “Operation is not supported on this platform” error

    This content has 3 years. 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.

    If you are getting the error “Operation is not supported on this platform” when you are trying to set an ImageResource from file for an image on Xamarin.UWP, then the problem comes from this line of code:

    IconSource = ImageSource.FromResource("afolder.animage.jpg");
    

    The solution: Image as Embadded Ressource shows “operation is not supported on this platform” in UWP and Release (microsoft.com)
    In a short brief: You need to use the second parameter for FromResource method call. You must pass an assembly in order to success on UWP platform. iOS and Android is not affected with this error.

    IconSource = ImageSource.FromResource("afolder.animage.jpg", typeof(AClassFromTheAssembly).Assembly);
    
  • Xamarin.UWP DryIoC error: Code generation not supported on this platform

    This content has 3 years. 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.

    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
    at
    Dryloc.FastExpressionCompiler.LightExpression.ExpressionCompiler.CompileNoA
    rgsNew(Constructorlnfo, Type, Type[, Type) + 0x5b
    at
    Dryloc.FastExpressionCompiler.LightExpression.ExpressionCompiler.TryCompileB
    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