Skip to content

Handle DAC DefaultCOMImpl ref-counting fix (SOS_BREAKING_CHANGE_VERSION 6)#1398

Merged
max-charlamb merged 2 commits intomicrosoft:mainfrom
max-charlamb:com-leak-fix
Mar 5, 2026
Merged

Handle DAC DefaultCOMImpl ref-counting fix (SOS_BREAKING_CHANGE_VERSION 6)#1398
max-charlamb merged 2 commits intomicrosoft:mainfrom
max-charlamb:com-leak-fix

Conversation

@max-charlamb
Copy link
Contributor

Adapts ClrMD to handle the DAC ref-counting fix in dotnet/runtime#125231.

Adds SosDac9 wrapper for ISOSDacInterface9::GetBreakingChangeVersion(), and extracts a ReleaseLeakedDacRef() helper that skips the extra Release() when BreakingChangeVersion >= 6.

@max-charlamb
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@max-charlamb max-charlamb marked this pull request as ready for review March 5, 2026 20:00
@max-charlamb max-charlamb requested review from Copilot and leculver March 5, 2026 20:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adapts ClrMD’s DAC COM-wrapper handling to account for the ref-counting fix in newer DACs by querying SOS_BREAKING_CHANGE_VERSION and conditionally skipping the legacy “extra Release” workaround.

Changes:

  • Added SosDac9 wrapper to call ISOSDacInterface9::GetBreakingChangeVersion().
  • Introduced SOSDac.BreakingChangeVersion and centralized the legacy ref-count “leak” workaround in ReleaseLeakedDacRef.
  • Wired new interface creation and disposal into ClrDataProcess and DacServiceProvider.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Microsoft.Diagnostics.Runtime/DacInterface/SosDac9.cs Adds COM wrapper for ISOSDacInterface9 breaking-change version query.
src/Microsoft.Diagnostics.Runtime/DacInterface/SosDac.cs Stores breaking-change version and gates the legacy extra-Release() workaround behind a helper.
src/Microsoft.Diagnostics.Runtime/DacInterface/ClrDataProcess.cs Adds factory to query/create SosDac9 via QueryInterface.
src/Microsoft.Diagnostics.Runtime/DacImplementation/DacServiceProvider.cs Instantiates/disposes SosDac9 and populates SOSDac.BreakingChangeVersion.

leculver
leculver previously approved these changes Mar 5, 2026
Copy link
Contributor

@leculver leculver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

private volatile Dictionary<ulong, string>? _frameNames;

// SOS_BREAKING_CHANGE_VERSION from ISOSDacInterface9::GetBreakingChangeVersion()
internal int BreakingChangeVersion { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This is an internal class, and most of clrmd marks these properties as public on an internal class. (Though I know it's probably not consistent.)

@max-charlamb max-charlamb merged commit 3880e8e into microsoft:main Mar 5, 2026
8 checks passed
@max-charlamb max-charlamb deleted the com-leak-fix branch March 5, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants