fix: Remove broken SdkComposer fallback transport - #143
Open
vaind wants to merge 1 commit into
Open
Conversation
vaind
force-pushed
the
fix/remove-broken-fallback-transport
branch
2 times, most recently
from
September 7, 2026 07:28
4bb2111 to
486460f
Compare
SynchronousWorker fell back to New-HttpTransport when options.Transport was null. That helper worked when written against sentry-dotnet 4.1.2, but SdkComposer dropped CreateHttpTransport in 5.1.1 and gained a second constructor parameter in 5.16.1. Against the bundled 6.5.0 it throws MissingMethodException: Constructor on type 'Sentry.Internal.SdkComposer' not found. It went unnoticed across five SDK bumps because the branch is only reached once the SynchronousTransport constructor has already thrown, and Start-Sentry swallows the result and lets the SDK use its own default worker. Drop the fallback rather than repair it. What it built is the SDK's own default transport, which SentrySdk.Init composes correctly by itself when BackgroundWorker is left unset, so reaching further into internals here buys nothing. Runtime behaviour is unchanged. Add tests for the null-transport path and pin the internal SDK members the module still reflects on, by signature rather than by name. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
vaind
force-pushed
the
fix/remove-broken-fallback-transport
branch
from
September 7, 2026 07:41
486460f to
8fad532
Compare
jamescrosswell
approved these changes
Sep 8, 2026
jamescrosswell
left a comment
Collaborator
There was a problem hiding this comment.
LGTM.
Possibly as a follow up, a similar fix could be applied to other code that reflects on non-public members in sentry-dotnet:
sentry-powershell/modules/Sentry/private/StackTraceProcessor.ps1
Lines 29 to 37 in f468429
sentry-powershell/modules/Sentry/private/StackTraceProcessor.ps1
Lines 47 to 55 in f468429
That last one saw some change just today (but nothing that would break PS luckily)!
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.
Problem
SynchronousWorkerfell back toNew-HttpTransportwhenoptions.Transportwas null. The helper reflected onSentry.Internal.SdkComposer, and the SDK has since moved out from under it twice:CreateHttpTransportGetMethodreturns$null, invoking it throwsMissingMethodExceptionRunning the helper verbatim against the bundled 6.5.0 gives:
It went unnoticed across five SDK bumps because the branch is only reached once the
SynchronousTransportconstructor has already thrown.Start-Sentrythen swallowed the exception, logged a warning, and the SDK carried on with its own default worker. No test covered the path.Approach
Dropping the fallback rather than repairing it. What it built is the SDK's own default transport, which
SentrySdk.Initcomposes correctly by itself whenBackgroundWorkeris left unset. Reaching further into internals — at the exact moment those internals have demonstrably moved — buys nothing. Runtime behaviour is unchanged; the failure is just reported clearly now.Relationship to #38 / #138
This is independent of whether we keep the synchronous worker at all, which is the remaining work on #38 and is gated on what #138 shows on the Windows legs.
A broken fallback is not evidence that the synchronous worker is unnecessary. The fallback is only reachable once the
SynchronousTransportconstructor has thrown, and it doesn't throw: Windows CI (windows-2022/windows-2025, Windows PowerShell 5.1 / net462) is green withSentryPowershellRethrowErrors = $true, which makesStart-Sentryrethrow instead of swallow. So the worker itself has been running as designed all along, on every platform — only the already-degraded path changed behaviour in Feb 2025.Deleting the fallback is correct under either outcome of #38: if the worker stays, this is dead code rebuilding the SDK's own default; if we move to a genuinely asynchronous worker, it gets deleted along with the worker. In that second case most of
tests/sdk-internals.tests.ps1would go withSynchronousTransporttoo — it protects the interim, which may be a while.Notes for reviewers
tests/synchronous-worker.tests.ps1covers the null-transport path, which previously threwMissingMethodException.tests/sdk-internals.tests.ps1pins the remaining internal members by return and parameter types, not just by name. The 5.1.1 regression above is exactly the shape it catches: the lookup silently returned$nulland nothing failed until send time. I checked the guards can fail by simulating drift on three of them.SentrySdk.CurrentOptionswas not in the original report; I found it while auditing, and it degrades the same silent way.Full suite against 6.5.0: 106 passed, 3 skipped (pre-existing Windows-only tests).
🤖 Generated with Claude Code