[cDAC] Clear cached contract state on flush - #134615
Merged
max-charlamb merged 1 commit intoSep 25, 2026
Merged
max-charlamb merged 1 commit into
max-charlamb merged 1 commit into
Conversation
Use resettable cached values for target-derived pointers so contracts re-read state after a target flush. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f8294bb-306d-4f13-84c5-f8ecbe58ce02
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds resettable lazy caches for cDAC contract state and invalidates them during target flushes.
Changes:
- Introduces
CachedValue<T>. - Updates affected contracts to clear target-derived caches.
- Adds flush propagation and sync-table refresh coverage.
| File | Description |
|---|---|
| src/native/managed/cdac/tests/UnitTests/SyncBlockTests.cs | Updated as part of this pull request. |
| src/native/managed/cdac/tests/UnitTests/DebuggerTests.cs | Updated as part of this pull request. |
| src/native/managed/cdac/tests/TestInfrastructure/TestPlaceholderTarget.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/RuntimeTypeSystemHelpers/TypeValidation.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/SyncBlock_1.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Object_1.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/ExecutionManager/ExecutionManagerCore.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/ComWrappers_1.cs | Updated as part of this pull request. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/CachedValue.cs | Updated as part of this pull request. |
rcj1
approved these changes
Sep 24, 2026
steveisok
approved these changes
Sep 24, 2026
Member
Author
|
/ba-g known runtime-diagnostics pipeline issue |
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
CachedValue<T>for lazily initialized contract stateFlushimplementationsContract instances survive
Target.Flush, but several contracts retained pointers derived from mutable target globals in instance fields. Those pointers could remain stale after execution resumed or the target snapshot changed. This change keeps the existing per-contract caching efficiency while ensuring the values are re-read after a flush.Testing
dotnet.cmd test src\native\managed\cdac\tests\UnitTests\Microsoft.Diagnostics.DataContractReader.Tests.csproj --no-restore -c Debug -p:RuntimeConfiguration=Debug -p:LibrariesConfiguration=Release(3,158 passed)Note
This pull request description was generated with GitHub Copilot.