Skip to content

Commit

Permalink
Fix nulls in debug info dictionary
Browse files Browse the repository at this point in the history
There is a possibility that a frame does not have any debugging information attached to it.

This happens when DebugSymbols is set to "None", and the output is in Release mode. The result is DebugInfo but it does not have a signature or other properties.

This addresses that particular scenario, by null checking the debug info as well as the signature before attempting to create the lookup dictionary.
  • Loading branch information
xenolightning committed Jun 20, 2024
1 parent 51acb69 commit b572fe0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private static IEnumerable<PEDebugInformation> GetDebugInfoForStackFrames(IEnume
return Enumerable.Empty<PEDebugInformation>();
}

var imageMap = DebugInformationCache.Values.Where(x => x != null).ToDictionary(k => k.Signature);
var imageMap = DebugInformationCache.Values.Where(x => x?.Signature != null).ToDictionary(k => k.Signature);
var imageSet = new HashSet<PEDebugInformation>();

foreach (var stackFrame in frames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private static IEnumerable<PEDebugInformation> GetDebugInfoForStackFrames(IEnume
return Enumerable.Empty<PEDebugInformation>();
}

var imageMap = DebugInformationCache.Values.Where(x => x != null).ToDictionary(k => k.Signature);
var imageMap = DebugInformationCache.Values.Where(x => x?.Signature != null).ToDictionary(k => k.Signature);
var imageSet = new HashSet<PEDebugInformation>();

foreach (var stackFrame in frames)
Expand Down

0 comments on commit b572fe0

Please sign in to comment.