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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it always guaranteed to be the last entry? Wouldn't it make more sense to check that the extension is not
.ni.pdb?I did some testing by scanning all the .dlls on my machine and reading the DebugDirectory and it seems that at least the Microsoft compiler puts the non-native image entry last.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I actually considered adding a line like
Debug.Assert(!portable.Path.EndsWith("ni.pdb"));for more robust verification, or to alert us to unexpected scenarios in the future.However, after checking
dotPeek's code, I noticed that they always iterate from the end. Trusting their implementation, I decided to simply omit that assertion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, could you add a comment to document the assumption? Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, feel free to modify this further, or we can wait until an unexpected scenario arises before making adjustments.
Arguably, the most reliable method would be to reverse engineer the relevant code in the VS debugger to confirm the exact matching logic. However, I suspect that
dotPeekhas already done this, which is why I decided to adopt an approach similar to theirs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know how to describe this assumption, so I simply added a call to
Debug.Assertin the latest commit to execute this assumption.