Skip to content

Treat disconnected event source cache targets as expired - #2644

Open
JohnMcPMS wants to merge 4 commits into
microsoft:masterfrom
JohnMcPMS:event-source-inv
Open

JohnMcPMS wants to merge 4 commits into
microsoft:masterfrom
JohnMcPMS:event-source-inv

Conversation

@JohnMcPMS

Copy link
Copy Markdown
Member

Fixes #2643

Changes

Share the target-liveness check between EventSourceCache.GetState and
EventSourceCache.Update. Treat only RPC_E_DISCONNECTED and
HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE) as an expired target. This lets
lookup return no cached state and lets replacement install a fresh target and
clear stale registrations. Preserve live-target behavior and propagate unrelated
errors.

Validation

Added new unit tests to simulate the target behavior.

  • Before the fix: 4 failed, 7 passed against net8.0.
  • After the fix: 11 passed against net8.0; 11 passed against netstandard2.0.
  • .NET Standard build emits the existing SDK NETSDK1212 trimming warning.
  • Full native/projection solution tests were not run.

The deterministic tests inject the disconnected weak-reference failure rather
than reproduce an entire COM server lifecycle. No public API or projection
generation changes are required.

JohnMcPMS and others added 4 commits November 3, 2026 17:56
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f0f1b8f3-bf71-422c-bb29-886982b8daa2
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f0f1b8f3-bf71-422c-bb29-886982b8daa2
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f0f1b8f3-bf71-422c-bb29-886982b8daa2
Keep regression coverage in the existing UnitTest project.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f0f1b8f3-bf71-422c-bb29-886982b8daa2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: EventSourceCache propagates disconnected weak-reference errors after an out-of-process server exits

1 participant