Repository navigation
fix(test): guard TestCluster.Primary, which Orleans 10.3.1 makes nullable - #3541
Merged
meshweaver-cloud[bot] merged 1 commit intoSep 7, 2026
Merged
Conversation
…able Microsoft.Orleans.TestingHost annotates TestCluster.Primary as SiloHandle? from 10.3.1 on; it was non-nullable at the 10.1.0 we pin today. Both fixtures dereference the local they take from it, so the weekly dependency sweep fails the whole Release build on two CS8602 before a single test runs (#3519). Verified against both package sets rather than reasoned about: Orleans 10.3.1 + current code -> 2 Error(s), the exact CI pair TwoSiloCacheUpdateFixture.cs(113,28) SharedOrleansFixture.cs(234,24) Orleans 10.3.1 + this change -> 0 Warning(s), 0 Error(s) Orleans 10.2.2 + this change -> 0 Warning(s), 0 Error(s) (main's pins) plus both dependents (MeshWeaver.Testing.Xunit, MeshWeaver.Hosting.Orleans.Test) clean at Release -warnaserror. The two sites get different treatment on purpose, each matching the posture already present a few lines below it: SharedOrleansFixture propagates the null, because its silo-side registration is best-effort and already guarded by `if (siloRouting != null)`; TwoSiloCacheUpdateFixture throws, because the property's contract is to return a hub and it already throws when SiloHost is absent. No What's New entry: test-base only, no user-visible surface — the same treatment as #3531. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped to test fixtures, correctly address the nullable TestCluster.Primary contract change, and don’t introduce behavioral risk outside the intended failure/skip postures.
Pull request overview
Updates Orleans test fixtures to handle TestCluster.Primary becoming nullable in Microsoft.Orleans.TestingHost 10.3.1, eliminating CS8602 null-dereference build failures under -warnaserror while preserving each fixture’s intended behavior.
Changes:
- Guard
TwoSiloCacheUpdateFixture.PrimarySiloMeshHubwith an explicitInvalidOperationExceptionwhenCluster.Primaryis absent. - Make
SharedOrleansFixture’s silo-side routing registration best-effort by propagatingnullvia?.instead of dereferencingCluster.Primary.
File summaries
| File | Description |
|---|---|
test/MeshWeaver.Hosting.Orleans.TestBase/TwoSiloCacheUpdateFixture.cs |
Adds a hard guard (?? throw) for Cluster.Primary to satisfy the property’s “must return a hub” contract and avoid nullable deref. |
test/MeshWeaver.Hosting.Orleans.TestBase/SharedOrleansFixture.cs |
Switches reflection access on Cluster.Primary to null-conditional chaining so the existing best-effort routing registration can be skipped safely. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Contributor
Contributor
Contributor
Contributor
Contributor
Contributor
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.
Unblocks half of #3519 — the weekly dependency sweep, which is red on two independent causes:
Aspire 13.4.6 -> 13.5.3drags inJsonPatch.Net 5.0.2(OSMF maintenance fee) — caught byDependency licencesMicrosoft.Orleans 10.2.2 -> 10.3.1redsBuild solution (once)on 2xCS8602What actually changed upstream
Microsoft.Orleans.TestingHostannotatesTestCluster.PrimaryasSiloHandle?from 10.3.1; it is non-nullable at the 10.1.0 we pin today (note the pin skew — the rest of Orleans is already 10.2.2). Both fixtures dereference the local they take from it.Verified against both package sets, not reasoned about
Both dependents (
MeshWeaver.Testing.Xunit,MeshWeaver.Hosting.Orleans.Test) also build clean atRelease -warnaserror. The bump was applied locally only to produce the first two rows and reverted before committing — this PR moves no package version.The two sites are treated differently on purpose
Each matches the posture already present a few lines below it:
SharedOrleansFixturepropagates the null (primarySilo?.). Its silo-side registration is best-effort and already ends inif (siloRouting != null), so a cluster shape without a reachable primary should skip that registration, not fail the fixture.TwoSiloCacheUpdateFixtureasserts (?? throw). The property's contract is to return a hub, and it already throws whenSiloHostis absent — so an absent primary is a broken fixture and has to say so there.Making both the same would have been wrong in one of the two places.
Notes
Pairs-with: none — test-base internals only; no public type or member leaves
src/.