首页 > 解决方案 > Unity Container exception – You cannot have more than one dynamic module in each dynamic assembly in this version of the runtime

问题描述

I've got a project that I need to Migrate from .NET Framework to .NET Core. After migrating it I've noticed an exception –</p>

Unity.Exceptions.ResolutionFailedException HResult=0x80131500
Message=Resolution of the dependency failed, type = 'LanDocs.ExchangeSystem.Server.Interfaces.IExchangeDataHandler', name = '(none)'. Exception occurred while: while resolving. Exception is: InvalidOperationException - You cannot have more than one dynamic module in each dynamic assembly in this version of the runtime.

What might be the issue and how to fix it?

标签: c#.net-coremigrationunity-container

解决方案


I've figured it out myself and decided to share the solution here since I haven't found anything helpful while struggling with it. The issue was with Policy Injection – once I've removed the entire section everything worked well. But the problem was the version of version of nuget package. I've had Unity.Interception with version 5.5.3 and Unity with version 5.8.6. Once I've changed both versions to 5.11.1 everything worked well on .NET Core.


推荐阅读