Repository navigation
MessagePublishing falls back to the expression interpreter where dynamic code is unavailable - #1173
Merged
Merged
Conversation
…mic code is unavailable Closes #1171. MessagePublishing.build compiled its per-message-type delegate with FastExpressionCompiler.CompileFast unconditionally. CompileFast emits IL through DynamicMethod, which a Native AOT image refuses with PlatformNotSupportedException, so every projection side effect published through ProjectionBatchBase.PublishMessageAsync failed natively and paused its shard. Fisher's copy of this class, which the #1045 lift replaced, used Expression.Compile() and ran natively (fisher#430); fisher#542 is where the regression surfaced. The cache-miss path now branches on RuntimeFeature.IsDynamicCodeSupported, as LambdaBuilder does: CompileFast on a JIT runtime, Compile(preferInterpretation: true) otherwise. The interpreted branch is reachable through two internal entry points so EventTests holds it to the same contract on a JIT runtime, where the feature switch cannot be flipped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Member
Author
|
Evidence beyond the unit tests, from the Fisher side:
|
This was referenced Nov 10, 2026
Merged
jeremydmiller
added a commit
that referenced
this pull request
Nov 10, 2026
This was referenced Nov 16, 2026
Closed
Closed
Closed
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1171.
MessagePublishing.build<TDelegate>compiled its per-message-type delegate withFastExpressionCompiler.CompileFast()unconditionally.CompileFastemits IL throughDynamicMethod, which a Native AOT image refuses withPlatformNotSupportedException, so every projection side effect published throughProjectionBatchBase.PublishMessageAsyncfailed natively and paused its shard. Fisher's copy of this class, which the #1045 lift replaced, usedExpression.Compile()and ran natively (fisher#430); fisher#542 is where the regression surfaced in Fisher's AOT consumer smoke.Change
RuntimeFeature.IsDynamicCodeSupported, the same patternLambdaBuilderuses:CompileFast()on a JIT runtime,Compile(preferInterpretation: true)otherwise. A publish is not on a hot enough path for the interpreter to matter.[RequiresDynamicCode]/ IL2026 / IL2060 annotations stay (the cache miss still closes a generic method over a runtime type); the IL2026 justification no longer namesCompileFast.internalentry points (InterpretedTenantPublisher,InterpretedMetadataPublisher) build the interpreted delegate on demand soEventTestscan hold that branch to the same contract on a JIT runtime, where the feature switch cannot be flipped.Tests
EventTests.MessagePublishingTestsgains three facts over the interpreted branch: the tenant overload closes over the runtime type, the metadata overload keeps the metadata, and the shapes the compiled branch handles (a struct message, a non-public type, a closed generic) work interpreted too. 10/10 green on net10.0 locally.Downstream
Once this ships as 3.0.1, Fisher takes the pin on fisher#549 (the 2.0.0-alpha.1 release prep), its AOT consumer smoke should go green, and fisher#542 closes.
🤖 Generated with Claude Code