-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include source files w/o method bodies in the PDB documents #39136
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d26e2ef
Include source files w/o method bodies in the PDB documents
ivanbasov 68bb295
code review feedback
ivanbasov a4cef18
updated PDB tests
ivanbasov 7b98102
code review feedback
ivanbasov a200fc8
code review feedback
ivanbasov 25ee210
skipping windows tests in mac and linux
ivanbasov c08e2a2
minor refactoring
ivanbasov eaab9f3
revert skipping C# tests in linus and mac
ivanbasov 28c8b82
disabling skipped test
ivanbasov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -727,44 +727,52 @@ private void SerializeDeltaLinesAndColumns(BlobBuilder writer, SequencePoint seq | |
|
||
private DocumentHandle GetOrAddDocument(DebugSourceDocument document, Dictionary<DebugSourceDocument, DocumentHandle> index) | ||
{ | ||
DocumentHandle documentHandle; | ||
if (!index.TryGetValue(document, out documentHandle)) | ||
if (index.TryGetValue(document, out var documentHandle)) | ||
{ | ||
DebugSourceInfo info = document.GetSourceInfo(); | ||
return documentHandle; | ||
} | ||
|
||
documentHandle = _debugMetadataOpt.AddDocument( | ||
name: _debugMetadataOpt.GetOrAddDocumentName(document.Location), | ||
hashAlgorithm: info.Checksum.IsDefault ? default(GuidHandle) : _debugMetadataOpt.GetOrAddGuid(info.ChecksumAlgorithmId), | ||
hash: info.Checksum.IsDefault ? default(BlobHandle) : _debugMetadataOpt.GetOrAddBlob(info.Checksum), | ||
language: _debugMetadataOpt.GetOrAddGuid(document.Language)); | ||
return AddDocument(document, index); | ||
} | ||
|
||
index.Add(document, documentHandle); | ||
private DocumentHandle AddDocument(DebugSourceDocument document, Dictionary<DebugSourceDocument, DocumentHandle> index) | ||
{ | ||
DocumentHandle documentHandle; | ||
DebugSourceInfo info = document.GetSourceInfo(); | ||
|
||
if (info.EmbeddedTextBlob != null) | ||
{ | ||
_debugMetadataOpt.AddCustomDebugInformation( | ||
parent: documentHandle, | ||
kind: _debugMetadataOpt.GetOrAddGuid(PortableCustomDebugInfoKinds.EmbeddedSource), | ||
value: _debugMetadataOpt.GetOrAddBlob(info.EmbeddedTextBlob)); | ||
} | ||
documentHandle = _debugMetadataOpt.AddDocument( | ||
name: _debugMetadataOpt.GetOrAddDocumentName(document.Location), | ||
hashAlgorithm: info.Checksum.IsDefault ? default(GuidHandle) : _debugMetadataOpt.GetOrAddGuid(info.ChecksumAlgorithmId), | ||
hash: info.Checksum.IsDefault ? default(BlobHandle) : _debugMetadataOpt.GetOrAddBlob(info.Checksum), | ||
language: _debugMetadataOpt.GetOrAddGuid(document.Language)); | ||
|
||
index.Add(document, documentHandle); | ||
|
||
if (info.EmbeddedTextBlob != null) | ||
{ | ||
_debugMetadataOpt.AddCustomDebugInformation( | ||
parent: documentHandle, | ||
kind: _debugMetadataOpt.GetOrAddGuid(PortableCustomDebugInfoKinds.EmbeddedSource), | ||
value: _debugMetadataOpt.GetOrAddBlob(info.EmbeddedTextBlob)); | ||
} | ||
|
||
return documentHandle; | ||
} | ||
|
||
/// <summary> | ||
/// Add document entries for any embedded text document that does not yet have an entry. | ||
/// Add document entries for all debug documents that do not yet have an entry. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is done after serializing method debug info to ensure that we embed all requested | ||
/// text even if there are no corresponding sequence points. | ||
/// </remarks> | ||
public void AddRemainingEmbeddedDocuments(IEnumerable<DebugSourceDocument> documents) | ||
public void AddRemainingDebugDocuments(IReadOnlyDictionary<string, DebugSourceDocument> documents) | ||
{ | ||
foreach (var document in documents) | ||
foreach (var kvp in documents | ||
.Where(kvp => !_documentIndex.ContainsKey(kvp.Value)) | ||
.OrderBy(kvp => kvp.Key)) | ||
{ | ||
Debug.Assert(document.GetSourceInfo().EmbeddedTextBlob != null); | ||
GetOrAddDocument(document, _documentIndex); | ||
AddDocument(kvp.Value, _documentIndex); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need two methods? They seem to be doing the same thing. #Resolved |
||
|
||
|
This file contains 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
This file contains 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
Oops, something went wrong.
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.
I didn't understand why we need ordering. There are other methods that invoke
AddDocumentIndex
and don't seem to do so in any particular order (namelyGetDocumentIndex
).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.
This is to resolve #39136 (comment)
I think there is some kind of ordering in documents for ones having sequence points likely governed by sequence points ordering. And we want to have some consistence for the order of documents without sequence points. Let them be ordered by file names. @tmat may want to comment more.
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.
Any time we produce output based on dictionary enumeration we need to order the results in order to achieve determinism.
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.
Makes sense. Thanks