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.

No activity

Activity on this issue will appear here.

Activity

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