-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzersuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Milestone
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.0ornet10.0and 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
PhilippNaused, DigiBanks99 and AArnott
Metadata
Metadata
Assignees
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzersuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Type
Projects
Status
No status