Skip to content

Enhance .NET Framework assembly resolution on Windows - #1980

Merged
Bertk merged 1 commit into
coverlet-coverage:masterfrom
Bertk:improve-issue-1965
Jul 3, 2026
Merged

Bertk merged 1 commit into
coverlet-coverage:masterfrom
Bertk:improve-issue-1965

Conversation

@Bertk

@Bertk Bertk commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Add TryWithNetFrameworkReferenceAssemblyResolver to CecilAssemblyResolver, enabling resolution of assemblies from .NET Framework reference directories and the GAC on Windows. This method is now prioritized in the fallback chain, with supporting helpers for directory and GAC traversal, improving robustness for .NET Framework scenarios.

Implemented and validated a resolver-focused fix for #1965.

What changed

In NetstandardAwareAssemblyResolver (src/coverlet.core/Instrumentation/CecilAssemblyResolver.cs), I added a .NET Framework-specific fallback on Windows:

• probe .NET Framework Reference Assemblies (Reference Assemblies\Microsoft\Framework.NETFramework\v*)
• probe GAC locations (Microsoft.NET\assembly\GAC_MSIL/GAC_32/GAC_64, plus legacy Windows\assembly\GAC_MSIL)
• updated resolve order to try framework/runtime probing before the deps-based custom resolver

Result

WindowsBase now resolves in the repro, so preflight no longer fails with UnresolvableDependencies and instrumentation continues for the net481 module.

Validation

Confirmed with repro project C:\GitHub\coverlet-issue-1965: the previous unresolved WindowsBase warning is gone and coverage generation proceeds.

Add TryWithNetFrameworkReferenceAssemblyResolver to CecilAssemblyResolver, enabling resolution of assemblies from .NET Framework reference directories and the GAC on Windows. This method is now prioritized in the fallback chain, with supporting helpers for directory and GAC traversal, improving robustness for .NET Framework scenarios.
Copilot AI review requested due to automatic review settings July 3, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Bertk Bertk added enhancement General enhancement request coverlet-core labels Jul 3, 2026
@Bertk
Bertk merged commit f549c8b into coverlet-coverage:master Jul 3, 2026
10 checks passed
@Bertk
Bertk deleted the improve-issue-1965 branch July 3, 2026 14:03
This was referenced Sep 27, 2026
This was referenced Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coverlet-core enhancement General enhancement request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coverlet.MTP does not collect coverage on the .NET Framework portion of a large project

2 participants