dotnet / dotnet/roslyn

`IAssemblySymbol.MightContainExtensionMethods` produces unstable result for a source assembly

Open
#82,206 1 comment 0 reactions 0 assignees View on GitHub
Area-Compilers Concept-Design Debt
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

`IAssemblySymbol.MightContainExtensionMethods` produces unstable result for a source assembly.
Initially, it will return `true`. But once the final determination is made, it returns the actual result (whether the assembly did in fact contain extensions).
We should consider forcing the processing to complete when this public API is called.

```
[Fact]
public void MightContainExtensionMethods_01()
{
var comp = CreateCompilation("");
Assert.True(comp.SourceAssembly.GetPublicSymbol().MightContainExtensionMethods);
comp.VerifyEmitDiagnostics();
Assert.False(comp.SourceAssembly.GetPublicSymbol().MightContainExtensionMethods);
}
```

Contributor guide

Open the contributing guide

Research direction

Start at the public IAssemblySymbol.MightContainExtensionMethods API and trace how a source assembly reaches its final extension-method determination. Run or adapt the shown MightContainExtensionMethods_01 test, and consider the work complete when the API's result is deterministic and the test verifies the intended behavior before and after compilation processing.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.