Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates a DEBUG-time assertion in GetMethodTableName to include additional diagnostic details when the legacy and new implementations disagree.
Changes:
- Adds a formatted message to a
Debug.Assertcomparingneededsizes and method table names.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…er.Legacy/SOSDacImpl.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines
+3017
to
+3022
| if (!(pNeeded is null || *pNeeded == neededLocal)) | ||
| { | ||
| string localNameString = new(mtNameLocal, 0, localNameLength); | ||
| string nameString = mtName is null ? string.Empty : new(mtName, 0, nameLength); | ||
| Debug.Fail($"local name = {localNameString}, name = {nameString}"); | ||
| } |
There was a problem hiding this comment.
The pNeeded validation uses a manual if + Debug.Fail(...), which is inconsistent with the surrounding pattern in this file (other callsites use Debug.Assert(pNeeded == null || *pNeeded == neededLocal, ...)). Consider switching back to Debug.Assert with a message and include the mismatched *pNeeded/neededLocal values (and optionally count) so the failure is actionable.
Suggested change
| if (!(pNeeded is null || *pNeeded == neededLocal)) | |
| { | |
| string localNameString = new(mtNameLocal, 0, localNameLength); | |
| string nameString = mtName is null ? string.Empty : new(mtName, 0, nameLength); | |
| Debug.Fail($"local name = {localNameString}, name = {nameString}"); | |
| } | |
| string localNameString = new(mtNameLocal, 0, localNameLength); | |
| string nameString = mtName is null ? string.Empty : new(mtName, 0, nameLength); | |
| Debug.Assert( | |
| pNeeded is null || *pNeeded == neededLocal, | |
| $"pNeeded mismatch: actual={(pNeeded is null ? "null" : (*pNeeded).ToString())}, expected={neededLocal}, count={count}, local name = {localNameString}, name = {nameString}"); |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
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.
No description provided.