Skip to content
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

Prevent exception from being thrown and then immediately caught when getting debug information #544

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGE-LOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Full Change Log for Raygun4Net.* packages

### v11.1.1
- Prevented a null reference exception from being thrown after a PortableExecutable (PE) fails to be loaded from disk
- See: https://github.com/MindscapeHQ/raygun4net/pull/544

### v11.1.0
- Fix issue with `RaygunClientBase` where `SendInBackground` deferred building the message until late, losing HttpContext
- See: https://github.com/MindscapeHQ/raygun4net/pull/540
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public static PEReader GetFileSystemPEReader(string moduleName)

public static bool TryGetDebugInformation(this PEReader peReader, out PEDebugInformation debugInformation)
{
if (peReader is null)
{
debugInformation = null;
return false;
}

try
{
debugInformation = GetDebugInformation(peReader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ internal static class PortableExecutableReaderExtensions
}
}

public static bool TryGetDebugInformation(this PEReader peReader, out PEDebugInformation? debugInformation)
public static bool TryGetDebugInformation(this PEReader? peReader, out PEDebugInformation? debugInformation)
{
if (peReader is null)
{
debugInformation = null;
return false;
}

try
{
debugInformation = GetDebugInformation(peReader);
Expand Down