OData / ModelBuilder

A project to generate Edm (Entity Data Model) from CLR types
19 stars 19 forks source link

Assembly resolver static instance makes the assembly resolving wrong in multiple projects scenario #20

Open xuzhg opened 3 years ago

xuzhg commented 3 years ago

Short summary (3-5 sentences) describing the issue.

Assemblies affected

Which assemblies and versions are known to be affected e.g. OData ModelBuilder 1.x

Reproduce steps

There's a static instance for the default assembly resolver. https://github.com/OData/ModelBuilder/blob/master/src/Microsoft.OData.ModelBuilder/Helpers/DefaultAssemblyResolver.cs#L21

In multiple projects scenario, for example there's "v1" and "v2" model builder.

"v1" reference Assembly A, B, C. "v2" reference Assembly A, B, C, and D.

If we build the V1 first, Default assembly only loads "A, B, C". When build "v2", since the default assembly statically in memory, it load "A, B, C", then there's no opportunity to load "D".

Expected result

What would happen if there wasn't a bug.

Actual result

What is actually happening.

Additional detail

Work around, create your own AssemblyResolver and input into the convention model builder.