Skip to content

ILLink testing doesn't run with asserts enabled? #128321

@MichalStrehovsky

Description

@MichalStrehovsky

Seeing this when I remove the EnableTrimAnalyzer and EnableAotAnalyzer from src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj and build the repo with ./build.sh clr+libs+libs.tests -rc Checked -lc Release

C:\Users\michals\.nuget\packages\microsoft.net.compilers.toolset\5.7.0-1.26257.113\tasks\netcore\Microsoft.CSharp.Core.targets(97,5): error : Process terminated. [D:\git\runtime1\src\libraries\System.Runtime\tests\System.Runtime.Tests\System.Runtime.Tests.csproj::TargetFramework=net11.0-windows]
C:\Users\michals\.nuget\packages\microsoft.net.compilers.toolset\5.7.0-1.26257.113\tasks\netcore\Microsoft.CSharp.Core.targets(97,5): error : Assertion failed. [D:\git\runtime1\src\libraries\System.Runtime\tests\System.Runtime.Tests\System.Runtime.Tests.csproj::TargetFramework=net11.0-windows]
C:\Users\michals\.nuget\packages\microsoft.net.compilers.toolset\5.7.0-1.26257.113\tasks\netcore\Microsoft.CSharp.Core.targets(97,5): error :    at ILLink.RoslynAnalyzer.DataFlow.MethodBodyValue..ctor(ISymbol owningSymbol, ControlFlowGraph cfg) in D:\git\runtime1\src\tools\illink\src\ILLink.RoslynAnalyzer\DataFlow\MethodBodyValue.cs:line 23 [D:\git\runtime1\src\libraries\System.Runtime\tests\System.Runtime.Tests\System.Runtime.Tests.csproj::TargetFramework=net11.0-windows]
C:\Users\michals\.nuget\packages\microsoft.net.compilers.toolset\5.7.0-1.26257.113\tasks\netcore\Microsoft.CSharp.Core.targets(97,5): error :    at ILLink.RoslynAnalyzer.DataFlow.LocalDataFlowAnalysis`6.InterproceduralAnalyze() in D:\git\runtime1\src\tools\illink\src\ILLink.RoslynAnalyzer\DataFlow\LocalDataFlowAnalysis.cs:line 91 [D:\git\runtime1\src\libraries\System.Runtime\tests\System.Runtime.Tests\System.Runtime.Tests.csproj::TargetFramework=net11.0-windows]
C:\Users\michals\.nuget\packages\microsoft.net.compilers.toolset\5.7.0-1.26257.113\tasks\netcore\Microsoft.CSharp.Core.targets(97,5): error :    at ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer.<>c__DisplayClass13_0.<Initialize>b__1(OperationBlockAnalysisContext context) in D:\git\runtime1\src\tools\illink\src\ILLink.RoslynAnalyzer\DynamicallyAccessedMembersAnalyzer.cs:line 122 [D:\git\runtime1\src\libraries\System.Runtime\tests\System.Runtime.Tests\System.Runtime.Tests.csproj::TargetFramework=net11.0-windows]

I let copilot churn on it and it says it's from primary constructors, e.g.:

class DataFlowInPrimaryConstructor(Type type)
{
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
Type annotatedField = type;
 
public static void Test()
{
new DataFlowInPrimaryConstructor(null);
}
}

However we do have test coverage for this and we don't hit the assert.

I think this is because we never run any of our illink testing with asserts enabled in the CI.

Metadata

Metadata

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions