OData / OData/ModelBuilder

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

Open
#20 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
22
Forks
24
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Microsoft.OData.ModelBuilder/Helpers/DefaultAssemblyResolver.cs, especially the static default resolver referenced in the issue. Reproduce the v1/v2 model-builder sequence with assemblies A, B, C, and D, then trace how the resolver is reused. Done means the second project can resolve its additional assembly without requiring a custom AssemblyResolver.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.