Skip to content

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

Closed

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.

Activity

  1. added
    area-Tools-ILLink
    on May 18, 2026
  2. added
    untriaged
    on May 18, 2026
  3. dotnet-policy-service commented on May 18, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @dotnet/illink
    See info in area-owners.md if you want to be subscribed.

  4. jtschuster commented on May 19, 2026

    @jtschuster
    Member

    Looks like this is true, we always run in Release:

    #
    # Build Release config vertical for Windows, Linux, and OSX
    #
    - template: /eng/pipelines/common/platform-matrix.yml
    parameters:
    jobTemplate: /eng/pipelines/common/global-build-job.yml
    buildConfig: release
    platforms:
    - windows_x64
    - osx_x64
    - linux_x64
    jobParameters:
    testGroup: innerloop
    timeoutInMinutes: 120
    nameSuffix: Runtime_Release
    condition:
    or(
    eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
    eq(variables['isRollingBuild'], true))
    buildArgs: -s clr+libs+tools.illink+host.native -c $(_BuildConfig)
    postBuildSteps:
    - template: /eng/pipelines/libraries/execute-trimming-tests-steps.yml

  5. removed
    untriaged
    on May 19, 2026
  6. locked and limited conversation to collaborators on Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-Tools-ILLink

Type

No type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions