dotnet / dotnet/roslyn

Used assembly analysis does not take into account anonymous types

Open
#78,759 0 comments 0 reactions 0 assignees View on GitHub
Area-Compilers untriaged
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

When moving our tests to target `net8.0` a number of them are failing the used assembly leg with the following style of error message:

```
// error CS0656: Missing compiler required member 'System.Collections.Generic.EqualityComparer`1.Equals'
Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Collections.Generic.EqualityComparer`1", "Equals").WithLocation(1, 1),
// error CS0656: Missing compiler required member 'System.Collections.Generic.EqualityComparer`1.GetHashCode'
Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Collections.Generic.EqualityComparer`1", "GetHashCode").WithLocation(1, 1),
// error CS0656: Missing compiler required member 'System.Collections.Generic.EqualityComparer`1.get_Default'
Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Collections.Generic.EqualityComparer`1", "get_Default").WithLocation(1, 1)
```

This _appears_ to be because the used assembly logic isn't considering the methods on anonymous types in the analysis.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the net8.0 used-assembly failures described in the issue and trace how used assembly analysis handles anonymous types. Compare the members collected for anonymous types with the missing EqualityComparer members in the diagnostics; done means the affected tests no longer report those missing compiler-required members.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.