Skip to content

[browser][CoreCLR][trimmed] RuntimeBinder array indexer tests throw NullReferenceException #134265

Description

@lewing

Description

Two System.Dynamic.Runtime.Tests array-indexer tests throw NullReferenceException inside Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter when the browser-Wasm CoreCLR test app is aggressively trimmed.

Affected methods:

ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.basic.array005.array005.Program.DynamicCSharpRunTest
ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.basic.array006.array006.Program.DynamicCSharpRunTest

Found while bringing up the broad trimmed ReadyToRun library lane from #133193. The same failures reproduce with CoreCLR trimming and ReadyToRun disabled, so they are trimming/RuntimeBinder failures rather than R2R codegen failures.

Reproduction Steps

Build and run System.Dynamic.Runtime.Tests for browser-Wasm CoreCLR with:

EnableAggressiveTrimming=true
TestTrimming=true
RuntimeFlavor=CoreCLR
Configuration=Release

Expected behavior

Both dynamic array-indexer tests pass as they do in the non-trimmed browser configuration.

Actual behavior

System.NullReferenceException
   at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.Rewrite(ExprBinOp, Expression[])
   at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore(...)

Regression?

Unknown. Broad CoreCLR browser trimming coverage is newly enabled.

Known Workarounds

Temporarily exclude only these two methods when IsBuiltWithAggressiveTrimming && IsBrowser. Non-trimmed browser and other configurations remain enabled.

Configuration

Browser-Wasm CoreCLR Release with aggressive trimming, Chrome.

Other information

Re-enable when the RuntimeBinder expression-tree rewrite path works after trimming or the required metadata is explicitly preserved.

Note

This issue was generated with GitHub Copilot assistance and reviewed as part of the #133193 bring-up.

Activity

  1. dotnet-policy-service commented on Sep 19, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  2. dotnet-policy-service commented on Sep 19, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @phil-allen-msft, @333fred
    See info in area-owners.md if you want to be subscribed.

  3. self-assigned this
    on Sep 19, 2026
  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 19, 2026
  5. added this to the 12.0.0 milestone on Sep 19, 2026
  6. lewing commented on Sep 19, 2026

    @lewing
    MemberAuthor

    This is bookkeeping for the libraries test stand up.

  7. added
    disabled-testThe test is disabled in source code against the issue
    on Sep 21, 2026
  8. added a commit that references this issue on Sep 27, 2026
    5a9d879
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions