Ben.Demystifier | High performance understanding for stack traces | Architecture library
kandi X-RAY | Ben.Demystifier Summary
kandi X-RAY | Ben.Demystifier Summary
Output the modern C# 7.0+ features in stack traces that looks like the C# source code that generated them rather than IL formatted.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Ben.Demystifier
Ben.Demystifier Key Features
Ben.Demystifier Examples and Code Snippets
Community Discussions
Trending Discussions on Ben.Demystifier
QUESTION
I'm trying to get a deeper understanding of each frame in a .NET stack trace. Most stack traces are easy to understand. I also know about packages like Ben.Demystifier to make it even more readable. Here's an example of a stack frame I'm trying to understand better:
...ANSWER
Answered 2021-Aug-30 at 15:39The <>c__DisplayClass0_0.<g__Bind|0>d
part is generated by the C# compiler. In the cited case, it is specifically generated for the local function Bind
in the method CreateBinderDelegate
that belongs to the class ControllerBinderDelegateProvider
, and which sits under the namespace Microsoft.AspNetCore.Mvc.Controllers
.
To understand the various part of the name, follow GeneratedNames.MakeLocalFunctionName
in the compiler/Roslyn source code. It calls the main workhorse method MakeMethodScopedSynthesizedName
.
The implementation details may change over time, but for now, here's a rough breakdown of <>c__DisplayClass0_0.<g__Bind|0>d
, which you can see as being composed of several parts:
<>c__DisplayClass0_0
g__Bind|0
<...>d
or<g__Bind|0>d
Note that in the third case, the second one is embedded.
All the synthesized names created by MakeMethodScopedSynthesizedName
have the following pattern based on parameter names:
QUESTION
I have a use case where I need to log a full stack trace with all the details along with line number whenever any exception happens. I see there are two methods I can use here Exception.ToString()
vs Exception.Stacktrace
but I am confused which one I should use?
Also, I see a lot of StackOverflow posts and this article where people are talking about either using Ben.Demystifier
library or some other way.
ANSWER
Answered 2020-Aug-26 at 05:08Of an Exception? Use Exception.StackTrace.
The issue to be aware of, however, is that some stack trace information can be lost if a developer makes the mistake of doing something like this:
QUESTION
I am trying to log exceptions in a better way where we can get human readable stack traces so I found out about this Ben.Demystifier library and it looks promising.
I added this nuget dependency in my application.
...ANSWER
Answered 2020-Aug-26 at 03:27It looks like in order to leverage the Demystify
extension method, you need to do one of two things:
- Ensure that the extension class
ExceptionExtentions
is available by adding a using directive.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Ben.Demystifier
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page