[Dynamic Instrumentation] DEBUG-4877 Stabilize snapshot serializer by dudikeleti · Pull Request #7989 · DataDog/dd-trace-dotnet
This was referenced
Dec 20, 2025
dudikeleti
changed the title
stabilize snapshot serializer
[Dynamic Instrumentation] DEBUG-4877 stabilize snapshot serializer
dudikeleti
changed the title
[Dynamic Instrumentation] DEBUG-4877 stabilize snapshot serializer
[Dynamic Instrumentation] DEBUG-4877 Stabilize snapshot serializer
dudikeleti added a commit that referenced this pull request
Jan 21, 2026## Reason for change In some cases, we cannot rely on the method metadata to determine whether method arguments and locals exist, as they may still be skipped. ## Implementation details Track open nodes and open/close them as required. ## Test coverage #7987 ## Other details This PR is part of an effort to make the Snapshot Exploration Test run successfully end-to-end. #7986 #7989
dudikeleti added a commit that referenced this pull request
Jan 21, 2026…l and LogArg to detect null byrefs (#7986) ## Reason for change Some methods can legitimately produce null managed byrefs (e.g., MemoryMarshal.GetReference(emptySpan)), which makes ref T point to address 0. Attempting to capture such locals/args would dereference an invalid reference and could crash in LogLocal/LogArg (NullReferenceException). This change makes DI runs stable and keeps probes installed while avoiding unsafe dereferences ## Implementation details Before reading a ref T capture input, we check Unsafe.IsNullRef(ref value) and return early to avoid dereferencing an invalid reference. Current behavior is to skip capturing that member entirely (no misleading null value for non-nullable types like byte). Follow-up option: if we decide we want the snapshot to explicitly show this case, we can reuse the existing snapshot notCapturedReason mechanism (no new reason added in this PR). ## Test coverage #7987 ## Other details This PR is part of an effort to make the Snapshot Exploration Test run successfully end-to-end. #7988 #7989
dudikeleti added a commit that referenced this pull request
Jan 21, 2026## Summary of changes Add a new test that uncovers two bugs: 1. When a null address is passed into our instrumentation code. 2. When locals or arguments exist but are skipped, resulting in an invalid JSON structure. ## Implementation details When a null address is passed to our debugger invoker classes, it must be handled explicitly by checking `Unsafe.IsNullRef`. ## Other details The test is currently skipped and will be enabled once the following PRs are merged: #7986 #7988 #7989
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