Search code examples
c#.netprism.net-standard-2.0dryioc

System.MissingMethodException Message=Method not found: DryIoc.Rules DryIoc.Rules.WithoutFastExpressionCompiler()


I am using Prism.DryIoc.Extensions(v8.0.62) and Prism.DryIoc.Forms(v8.1.97) which internally is using DryIoc.dll v4.7.3 and v4.7.7 respectively for my Xamarin.Forms project.

I also have a nuget update for my project which is internally using DryIoc.dll v5.0.2.

Now, If I update project nuget to the latest, It throws error. As there is a version conflict.

Since it is a project related nuget, I will have to update somehow. But there is a dependency on Prism and Prism has not released any latest version with latest DryIoc.dll.

I tried to add the following in our .csproj file

<PackageReference Include="Prism.DryIoc.Extensions" Version="8.0.62">
        <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
        <dependentAssembly>
          <assemblyIdentity name="DryIoc.dll" culture="neutral" />
          <bindingRedirect oldVersion="4.7.3" newVersion="5.0.2" />
        </dependentAssembly>
    </PackageReference>

This solved compile time error but started throwing run time error as below,

System.MissingMethodException Message=Method not found: DryIoc.Rules DryIoc.Rules.WithoutFastExpressionCompiler()

I also tried creating app.config and use the below code snippet,

<configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="DryIoc" publicKeyToken="dfbf2bd50fcf7768" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.0.1.0" newVersion="5.0.2.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

But this is also failing with the same error as above.

Getting rid of Prism is one of the solutions but It is a huge effort as the entire project is using Prism.

What is the best possible solution to fix this? Please help me in this regard.


Solution

  • Prism's open source, you can modify parts to use DryIoc 5 and use those dlls.

    It's not like you're forced to use nuget packages, they're meant to help. If they hinder, get rid of them.