Repository navigation
feat(error-tracking): add opt-in .NET unhandled exception capture - #356
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Generated-By: PostHog Desktop Task-Id: f32040d6-a160-4f5f-96d9-59daaf4a7ee8
Contributor
posthog-dotnet Compliance ReportDate: 2026-10-25T13:18:02.452922+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
This branch has not been deployed
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.
💡 Motivation and Context
Why: .NET applications currently miss unhandled process and background task failures unless callers report each exception manually. This adds opt-in runtime capture while preserving the existing default behavior. Closes #205.
Public API: Adds
PostHogOptions.CaptureUnhandledExceptions(defaultfalse). Enabled clients subscribe to runtime exception events, deduplicate the same exception across request and runtime hooks, and attempt a bounded flush for terminating failures. Escaping ASP.NET Core request exceptions now carry unhandled middleware metadata.The exception event metadata spec defines the new boundary values used here. The existing exception builder still emits legacy empty
mechanism.sourcevalues and omits exception tree IDs; that structure is unchanged by this PR.💚 How did you test it?
Added focused tests for both runtime handlers, default-off behavior, middleware metadata, and duplicate suppression.
git diff --checkpassed. The local environment has nodotnetexecutable, so build and test execution await CI.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (changeset added directly)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Codex used PostHog MCP to review the Inbox report, the published SDK metadata spec, and repository code. The core option is opt-in to avoid changing existing capture behavior. The PR is awaiting human review.
Created with PostHog Desktop from an inbox report
Origin
479f5ca