Improve crash telemetry: enums, FaultEvent, remove noise, dedup host detection#13289
Merged
YuliiaKovalova merged 9 commits intomainfrom Feb 24, 2026
Merged
Improve crash telemetry: enums, FaultEvent, remove noise, dedup host detection#13289YuliiaKovalova merged 9 commits intomainfrom
YuliiaKovalova merged 9 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines MSBuild crash telemetry to make crash events more actionable and less noisy, while adding VS Prism visibility (via FaultEvent on .NET Framework) and consolidating host detection logic.
Changes:
- Introduces typed crash classifications (
CrashExitType,CrashOriginKind) and expands crash payload (origin + innermost exception type), while removingCrashTimestamp. - Adds best-effort Prism FaultEvent posting on .NET Framework and removes high-volume “expected error” crash telemetry cases.
- Deduplicates host detection into
BuildEnvironmentState.GetHostName()and hardens early debug-path initialization.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/ExceptionHandling.cs | Switches unhandled-exception crash recording to typed CrashExitType. |
| src/Shared/Debugging/DebugUtils.cs | Wraps debug-path initialization in try/catch to avoid type initialization failures. |
| src/MSBuild/XMake.cs | Stops recording crash telemetry for expected CLI/toolset failures; converts exit types to CrashExitType; uses shared host detection. |
| src/Framework/Telemetry/CrashTelemetryRecorder.cs | Updates APIs to use enums; adds .NET Framework FaultEvent posting. |
| src/Framework/Telemetry/CrashTelemetry.cs | Adds enums and new crash fields (origin, origin “assembly” namespace, innermost exception type); updates property emission. |
| src/Framework/BuildEnvironmentState.cs | Adds centralized host detection (GetHostName). |
| src/Framework.UnitTests/CrashTelemetry_Tests.cs | Updates tests for enums and new fields; removes timestamp assertions; adds new test coverage for origin/innermost exception. |
| src/Build/BackEnd/BuildManager/BuildManager.cs | Uses BuildEnvironmentState.GetHostName() and typed CrashExitType for end-build crash telemetry. |
…telemetry instead
…ash telemetry, exit gracefully
rainersigwald
approved these changes
Feb 24, 2026
JanProvaznik
approved these changes
Feb 24, 2026
- Include full stack trace in error messages (DebugUtils, XMake) instead of just ex.Message - Rename CrashOriginAssembly to CrashOriginNamespace for clarity - Rewrite ExtractOriginNamespace to use index-based parsing (avoids Split/Substring allocations) - Fix ClassifyOrigin prefix check: match 'Microsoft.Build' as exact or dot-boundary prefix - Conditionally apply NoInlining to PostFaultEvent only on .NET Framework (inlines to empty on Core) - Add FaultEvent documentation link to PostFaultEvent - Add comment explaining .NET Core memory stats via GC.GetGCMemoryInfo Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
JanProvaznik
pushed a commit
to JanProvaznik/msbuild
that referenced
this pull request
Feb 25, 2026
…detection (dotnet#13289) ## Summary Improves the crash telemetry infrastructure to produce higher-quality, more actionable data and enable Prism dashboard visibility ( continuation of dotnet#13270 based on the first results) ## Changes ### Convert ExitType and CrashOrigin from strings to enums ### Remove noise from crash telemetry - Removed `SwitchError` and `InitializationError` from crash telemetry recording — these accounted for ~99.8% of crash events but represent expected user errors (bad CLI args, missing toolsets), not actual crashes ### Remove redundant `CrashTimestamp` - The database ingestion timestamp already captures this; the client-side timestamp added no value ### Deduplicate `GetHostName()` - Consolidated 3 copies of host-detection logic (VS / VSCode / `MSBUILD_HOST_NAME`) into a single `BuildEnvironmentState.GetHostName()` method ### Harden `DebugUtils` static constructor - Wrapped in try/catch to prevent `TypeInitializationException` crashes when environment variable access fails --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Feb 25, 2026
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.
Summary
Improves the crash telemetry infrastructure to produce higher-quality, more actionable data and enable Prism dashboard visibility ( continuation of #13270 based on the first results)
Changes
Convert ExitType and CrashOrigin from strings to enums
Remove noise from crash telemetry
SwitchErrorandInitializationErrorfrom crash telemetry recording — these accounted for ~99.8% of crash events but represent expected user errors (bad CLI args, missing toolsets), not actual crashesRemove redundant
CrashTimestampDeduplicate
GetHostName()MSBUILD_HOST_NAME) into a singleBuildEnvironmentState.GetHostName()methodHarden
DebugUtilsstatic constructorTypeInitializationExceptioncrashes when environment variable access fails