Repository navigation
Improve diagnostics for Interactive Server component activation failures caused by missing DI services - #69693
Conversation
…res caused by missing DI services
|
Thanks for your PR, @BrundhaVelusamy. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
🟢 Approval recommended
The focused logging changes preserve existing behavior and have appropriate regression coverage.
0 open findings
What changed in this PR
Improves Blazor Interactive Server diagnostics for circuit startup and root-component activation failures.
Changes:
- Promotes relevant circuit failure logs from
DebugtoError. - Adds logging and missing-service activation regression coverage.
- Allows test circuit hosts to receive a logger.
| File | Description |
|---|---|
CircuitHost.cs |
Raises failure log levels. |
CircuitHostTest.cs |
Verifies error logging and exception propagation. |
TestCircuitHost.cs |
Supports injecting test loggers. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head 3a579bae63c05935d03a5f8b336fc4c8e69a2389 found one new P2 diagnostics issue: circuit-handler failures can now produce duplicate Error records.
Both routed guides completed: docs/CrossCuttingGuidance.md and docs/BlazorComponentsGuidance.md. No true-positive duplicate was present in prepared feedback, and no candidates remain unresolved. The earlier review at pullrequestreview-5456140719 reported no findings.
Provenance: immutable version-2 bundle; merge base 1e4a69d0aba443940f4d28dae1f8dec8a7f6310f; base tip and reviewer guidance commit 12e90ca7cb7334d40f2dbf9752ee4d42f33628a7. Product source, exact overloads, and full error paths were read from the frozen bundle. No materially changed area lacked a routed guide.
Test boundary: source analysis only; PR code, tests, CI, browser workflows, and samples were not executed. Security assessment was excluded by bundle policy. Feedback posted after bundle preparation and runtime behavior beyond the frozen source were not observable.
Generated by ASP.NET Core Pull Request Review for #69693 · copilot · gpt56 · 390.3 AIC · ⌖ 19.7 AIC · ⊞ 18.8K
Comment /review to run again
|
Keep invalid client-state transitions below Error Could we separate client-state validation failures from activation failures before promoting the shared On an established legacy Blazor Server circuit started with nonempty component descriptors, an The existing area logging guidance explicitly requires lower severity for invalid client-state transitions and says not to promote a catch-all shared with client-input failures. Please keep those rejections at lower severity while retaining Error for genuine activation/configuration failures. This is a source-traced invalid-client-input case, not a live-connection reproduction or a claim that the stock client normally emits this sequence. Prepared by GitHub Copilot in collaboration with a human reviewer. |
Hi @PureWeen, Addressed. I kept the shared UpdateRootComponentsFailed event at Debug and introduced a dedicated RootComponentInitializationFailed event at Error around initial root-component rendering/activation only. Invalid client-state transitions, including invoking UpdateRootComponents on a legacy circuit initialized with nonempty descriptors, therefore remain below Error. I also added regression coverage asserting that this transition produces zero error-level records. |
|
/review |
There was a problem hiding this comment.
🟡 Changes recommended
Operation-limit rejections are incorrectly logged as Error-level initialization failures rather than Debug-level rejected input, and the new test does not exercise the affected catch block.
1 open issue
Review effort: Balanced
There was a problem hiding this comment.
Source-only review of frozen head 82958d2902aaa3a79630fdc13ea8c668fdca72a1 found one verified P3 diagnostics issue and surfaced one P2 concern as unresolved because the required logger-failure contract is unavailable.
Both routed guides completed: docs/CrossCuttingGuidance.md and docs/BlazorComponentsGuidance.md. The verified issue is that the first root-update catch also covers inbound middleware, so a middleware failure before next is falsely logged as root-component initialization failure. The unresolved concern is that a throwing logger can replace the original activation exception, but the frozen evidence does not establish a binding policy requiring suppression or preservation in that scenario.
Existing feedback did not duplicate either item. Earlier feedback about catch-all Error promotion and duplicate circuit-handler Error records is addressed in this frozen head: the shared wrapper events remain Debug, lifecycle failures occur outside the new catch, and source-level regression tests cover those paths. No materially changed area lacked a routed guide.
Provenance: immutable version-2 bundle; merge base b38e2847d9cda5fbba26177354ed11ede3f7dbfe; base tip and reviewer-guidance commit 49147673007a4b1d676694e2c5f85b83ad76c36f. Product source, public hook contracts, exact pipeline ordering, and old/new failure paths were read from the frozen bundle. The review is source-only: PR code, tests, CI, browser workflows, and samples were not executed. Security assessment was excluded by bundle policy. Feedback posted after preparation, external ILogger contracts, pointer targets, and runtime behavior beyond frozen tracked source were not observable.
Generated by ASP.NET Core Pull Request Review for #69693 · copilot · gpt56 · 231.6 AIC · ⌖ 8.59 AIC · ⊞ 20.1K
Comment /review to run again
|
/review |
There was a problem hiding this comment.
🟡 Changes recommended
Persisted-circuit resume can accept a marker without a key, causing rejected input to be logged as an Error-level initialization failure instead of a Debug-only diagnostic.
1 open issue
1 resolved since last review
Review effort: Balanced
|
All three local arms reviewed Informational: The logger-failure concern still lacks a binding failure-policy contract. Its GitHub thread is resolved. This uncertainty does not block approval. At Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block Other discarded checks: Duplicate Error logs, swallowed activation exceptions, restoration-order changes, operation-limit and pre-next middleware misclassification, WebAssembly/public API breaks, event-ID collisions, nullable warnings, and vacuous tests. Untested coverage gaps: No restore-path test covers the missing marker key. The arms also note no direct coverage of the Validation boundary: All three local arms reviewed frozen source only. They did not run target code, builds, tests, or browsers. Human-directed and GitHub Copilot-generated. |
@PureWeen, The persisted-resume marker-key concern has been addressed. Marker-key validation now occurs before the component activation error boundary. A resumed operation with a missing marker key therefore preserves the existing InvalidOperationException and circuit error flow, but is no longer reported as RootComponentInitializationFailed at Error. |
|
/review |
|
Copilot's local review panel found no issues to raise at this commit. All three local arms completed their reviews of Informational [DISCARDED]: One arm flagged the new Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block Other discarded/unresolved checks: The later-batch activation and logger-policy concerns, along with routine negative checks, duplicate the previous panel note and are not reposted as findings. Untested coverage gaps: The previously noted lack of a direct Validation boundary: All three local arms reviewed frozen source only. They did not run target code, builds, tests, or browsers. Human-directed and GitHub Copilot-generated. |
|
✅ No documentation PR was created. Confidence that documentation is needed: 10% Confident no docs needed: logging-only diagnostics improvement with tests; no public or documented behavior change. Documentation surfaces considered
|

Description
When a non-prerendered Interactive Server component injects a service that is not registered, component activation fails during the initial interactive render and the circuit is terminated.
Although the underlying exception is correctly thrown and handled by the circuit error pipeline, the root cause is not easily discoverable from default server logs. Developers typically see the standard Blazor fatal-error UI in the browser, but the actionable exception explaining the missing service registration is difficult to identify without additional diagnostics.
This change improves diagnostics for initial root component activation failures by ensuring that the original activation exception is surfaced through a dedicated error log entry, making configuration and dependency injection issues easier to identify.
Changes
Scenario
When WeatherForecastService is not registered:
Behavioral Impact
This change does not modify:
The change only improves the visibility of root component activation failures in server logs.
Validation
Fixes: #52598
Output
Before:

After: