benaadams / Ben.Demystifier

High performance understanding for stack traces (Make error logs more productive)
Apache License 2.0
2.76k stars 118 forks source link

GetMethod sometimes returns null, causes an exception to be thrown #106

Closed mitchcapper closed 4 years ago

mitchcapper commented 4 years ago

GetMethod can return null (at least with release builds under UWP in certain cases). There is an Assert that catches this but in release builds this still can cause a crash. https://github.com/benaadams/Ben.Demystifier/blob/1ca8f79a36ec1905803e2d86c325cc52354026f5/src/Ben.Demystifier/EnhancedStackTrace.Frames.cs#L56 is the issue, as ShowInStackTrace requires it not to be null. The rest of the code is setup to handle null methods properly (it seems).

I believe the library should avoid throwing exceptions ever, as it is normally used for exception handling.

Will submit a PR.