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

Fix crash when stackframe method is null #140

Merged
merged 2 commits into from Jul 19, 2021

Conversation

yousif-bugsnag
Copy link
Contributor

Goal

Fixes a crash in the notifier when a Stackframe reports a null method.

Design

It's possible that StackFrame.GetMethod() may return null in some circumstances, so we should guard against this in our code

Changeset

Added null checks wherever code accesses StackTraceLine.Methodname

Testing

Tested manually by manipulating stacktraces in the debugger to cause a crash.

@@ -78,14 +78,17 @@ public static class InternalMiddleware
{
foreach (var stackTraceLine in exception.StackTrace)
{
foreach (var @namespace in report.Configuration.ProjectNamespaces)
if (!Polyfills.String.IsNullOrWhiteSpace(stackTraceLine.MethodName))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth adding another unit test case to cover the null case, given that we have a unit test framework in place for the class.

Copy link
Contributor

@twometresteve twometresteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yousif-bugsnag yousif-bugsnag changed the title Fix crash when stackframe has a null method name Fix crash when stackframe method is null Jul 19, 2021
@yousif-bugsnag yousif-bugsnag merged commit 371702b into next Jul 19, 2021
@yousif-bugsnag yousif-bugsnag deleted the yousif/fix-null-methodname-crash branch July 19, 2021 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants