Bug description
In Visual Studio extensibility host process, we have a model where process has a single instance of MessagePack assembly but each extension is hosted under a different AssemblyLoadContext. In cases where 2 extensions have the same assembly with message pack compatible types, and process has 2 instances of the assembly load under different contexts the dynamic resolver will fail to work due to type equivalence issues.
Per our chat with @AArnott, this is happening because there is a single instance of DynamicUnionResolver assembly in the context of MessagePack assembly and a limitation is that an assembly in .net can't have a reference to 2 instances of the same assembly name. So we need to consider having a different DynamicUnionResolver assembly per load context (and similarly for other dynamic resolver assemblies too).
Repro steps
-
Create an assembly with a message pack object that has union attribute.
-
Load message pack in a .net core app in the default load context.
-
Load the test assembly twice under different load contexts and try to serialize an instance of the object.
-
Runtime: (e.g. .NET Framework, .NET Core, Unity, mono, etc.) .Net Core
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Bug description
In Visual Studio extensibility host process, we have a model where process has a single instance of MessagePack assembly but each extension is hosted under a different AssemblyLoadContext. In cases where 2 extensions have the same assembly with message pack compatible types, and process has 2 instances of the assembly load under different contexts the dynamic resolver will fail to work due to type equivalence issues.
Per our chat with @AArnott, this is happening because there is a single instance of DynamicUnionResolver assembly in the context of MessagePack assembly and a limitation is that an assembly in .net can't have a reference to 2 instances of the same assembly name. So we need to consider having a different DynamicUnionResolver assembly per load context (and similarly for other dynamic resolver assemblies too).
Repro steps
Create an assembly with a message pack object that has union attribute.
Load message pack in a .net core app in the default load context.
Load the test assembly twice under different load contexts and try to serialize an instance of the object.
Runtime: (e.g. .NET Framework, .NET Core, Unity, mono, etc.) .Net Core
Additional context
Add any other context about the problem here.