-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersAn area label is needed to ensure this gets routed to the appropriate area ownersuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Description
Analyzer throws an exception when building a project using new extensions syntax.
- The exception occurs when targeting
net9.0
- Change it to
net8.0
ornet10.0
and the error vanish
I think #115949 fixed a part of the error, but the error still occurs when targeting net9.0
.
Reproduction Steps
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>preview</LangVersion>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</Project>
public static class ArrayExtensions
{
extension<T>(T[] array)
{
public int Count => array.Length;
}
}
warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.NonErrorNamedTypeSymbol' to type 'Microsoft.CodeAnalysis.IMethodSymbol'.'.
Expected behavior
No exception
Actual behavior
An exception is thrown
Regression?
No response
Known Workarounds
No response
Configuration
- .NET 10 RC2 (10.0.100-rc.2.25502.107)
Other information
No response
Metadata
Metadata
Assignees
Labels
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersAn area label is needed to ensure this gets routed to the appropriate area ownersuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner