VOOZH about

URL: https://www.nuget.org/packages/Ben.Demystifier/

⇱ NuGet Gallery | Ben.Demystifier 0.4.1




👁 Image
Ben.Demystifier 0.4.1

dotnet add package Ben.Demystifier --version 0.4.1
 
 
NuGet\Install-Package Ben.Demystifier -Version 0.4.1
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ben.Demystifier" Version="0.4.1" />
 
Directory.Packages.props
<PackageReference Include="Ben.Demystifier" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ben.Demystifier --version 0.4.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ben.Demystifier, 0.4.1"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ben.Demystifier@0.4.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ben.Demystifier&version=0.4.1
 
Install as a Cake Addin
#tool nuget:?package=Ben.Demystifier&version=0.4.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Ben.Demystifier

👁 NuGet version (Ben.Demystifier)
👁 build

Output the modern C# 7.0+ features in stack traces that looks like the C# source code that generated them rather than IL formatted.

High performance understanding for stack traces

.NET stack traces output the compiler transformed methods; rather than the source code methods, which make them slow to mentally parse and match back to the source code.

The current output was good for C# 1.0; but has become progressively worse since C# 2.0 (iterators, generics) as new features are added to the .NET languages and at C# 7.1 the stack traces are esoteric (see: Problems with current stack traces).

Make error logs more productive

Output the modern C# 7.0+ features in stack traces in an understandable fashion that looks like the C# source code that generated them.

Usage

exception.Demystify()

Or instead of Environment.StackTrace

EnhancedStackTrace.Current()

Resolves the stack back to the C# source format of the calls (and is an inspectable list of stack frames)

Calling .ToString() on the Demystified exception will produce a string stacktrace similar to the following (without the comments):

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
 at bool System.Collections.Generic.List<T>+Enumerator.MoveNextRare()
 at IEnumerable<string> Program.Iterator(int startAt)+MoveNext() // Resolved enumerator
 at bool System.Linq.Enumerable+SelectEnumerableIterator<TSource, TResult>.MoveNext() // Resolved enumerator
 at string string.Join(string separator, IEnumerable<string> values) 
 at string Program+GenericClass<TSuperType>.GenericMethod<TSubType>(ref TSubType value) 
 at async Task<string> Program.MethodAsync(int value) // Resolved async 
 at async Task<string> Program.MethodAsync<TValue>(TValue value) // Resolved async 
 at string Program.Method(string value)+()=>{} [0] // lambda source + ordinal
 at string Program.Method(string value)+()=>{} [1] // lambda source + ordinal 
 at string Program.RunLambda(Func<string> lambda) 
 at (string val, bool) Program.Method(string value) // Tuple returning
 at ref string Program.RefMethod(in string value)+LocalFuncRefReturn() // ref return local func
 at int Program.RefMethod(in string value)+LocalFuncParam(string val) // local function
 at string Program.RefMethod(in string value) // in param (readonly ref) 
 at (string val, bool) static Program()+(string s, bool b)=>{} // tuple return static lambda
 at void static Program()+(string s, bool b)=>{} // void static lambda
 at void Program.Start((string val, bool) param) // Resolved tuple param
 at void Program.Start((string val, bool) param)+LocalFunc1(long l) // void local function 
 at bool Program.Start((string val, bool) param)+LocalFunc2(bool b1, bool b2) // bool return local function 
 at string Program.Start() 
 at void Program()+()=>{} // ctor defined lambda 
 at void Program(Action action)+(object state)=>{} // ctor defined lambda 
 at void Program.RunAction(Action<object> lambda, object state) 
 at new Program(Action action) // constructor 
 at new Program() // constructor 
 at void Program.Main(String[] args) 

Calling .ToString() on the same exception would produce the following output

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
 at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion() // ? low value
 at System.Collections.Generic.List`1.Enumerator.MoveNextRare() 
 at Program.<Iterator>d__3.MoveNext() // which enumerator?
 at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext() // which enumerator?
 at System.String.Join(String separator, IEnumerable`1 values) 
 at Program.GenericClass`1.GenericMethod[TSubType](TSubType& value) 
 at Program.<MethodAsync>d__4.MoveNext() // which async overload?
--- End of stack trace from previous location where exception was thrown --- // ? no value
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() // ? no value
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) // ? no value
 at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() // ? no value
 at Program.<MethodAsync>d__5`1.MoveNext() // which async overload?
--- End of stack trace from previous location where exception was thrown --- // ? no value
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() // ? no value
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) // ? no value
 at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() // ? no value
 at Program.<>c__DisplayClass8_0.<Method>b__0() // ¯\_(ツ)_/¯
 at Program.<>c__DisplayClass8_0.<Method>b__1() // ¯\_(ツ)_/¯
 at Program.RunLambda(Func`1 lambda) 
 at Program.Method(String value)
 at Program.<RefMethod>g__LocalFuncRefReturn|10_1(<>c__DisplayClass10_0& ) // local function
 at Program.<RefMethod>g__LocalFuncParam|10_0(String val, <>c__DisplayClass10_0& ) // local function
 at Program.RefMethod(String value)
 at Program.<>c.<.cctor>b__18_1(String s, Boolean b) // ¯\_(ツ)_/¯
 at Program.<>c.<.cctor>b__18_0(String s, Boolean b) // ¯\_(ツ)_/¯
 at Program.Start(ValueTuple`2 param) // Tuple param?
 at Program.<Start>g__LocalFunc1|11_0(Int64 l) // local function
 at Program.<Start>g__LocalFunc2|11_1(Boolean b1, Boolean b2) // local function
 at Program.Start()
 at Program.<>c.<.ctor>b__1_0() // ¯\_(ツ)_/¯
 at Program.<>c__DisplayClass2_0.<.ctor>b__0(Object state) // ¯\_(ツ)_/¯
 at Program.RunAction(Action`1 lambda, Object state)
 at Program..ctor(Action action) // constructor
 at Program..ctor() // constructor
 at Program.Main(String[] args)

Which is far less helpful, and close to jibberish in places

Problems with current stack traces:

  • constructors

    Does not match code, output as .ctor and .cctor

  • parameters

    Do not specify qualifier ref, out or in

  • iterators

    Cannot determine overload <Iterator>d__3.MoveNext() rather than Iterator(int startAt)+MoveNext()

  • Linq

    Cannot determine overload

    Linq.Enumerable.SelectEnumerableIterator``2.MoveNext()

    rather than

    Linq.Enumerable+SelectEnumerableIterator<TSource, TResult>.MoveNext()

  • async

    Cannot determine overload and no modifier such as async

    <MethodAsync>d__5``1.MoveNext()

    rather than

    async Task<string> Program.MethodAsync(int value)

    Noise!

    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.GetResult() 
    
  • lambdas

    Mostly jibberish <>c__DisplayClass2_0.<.ctor>b__0(Object state) with a suggestion of where they are declared but no hint if there are multiple overloads of the method.

  • local functions

    Mostly jibberish <RefMethod>g__LocalFuncParam|10_0(String val, <>c__DisplayClass10_0& ) with a suggestion of where they are declared but no hint if there are multiple overloads of the method.

  • generic parameters

    Not resolved, only an indication of the number RunLambda(Func``1 lambda) rather than RunLambda(Func<string> lambda)

  • value tuples

    Do not match code, output as ValueTuple``2 param rather than (string val, bool) param

  • primitive types

    Do not match code, output as Int64, Boolean, String rather than long, bool, string

  • return types

    Skipped entirely from method signature

Benchmarks

To run benchmarks from the repository root:

dotnet run -p .\test\Ben.Demystifier.Benchmarks\ -c Release -f netcoreapp2.0 All

<sub>Note: we're only kicking off via netcoreapp2.0, benchmarks will run for all configured platforms like net462.</sub>

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 is compatible. 
.NET Framework net45 net45 is compatible.  net451 net451 was computed.  net452 net452 was computed.  net46 net46 was computed.  net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (296)

Showing the top 5 NuGet packages that depend on Ben.Demystifier:

Package Downloads
Pulumi

The Pulumi .NET SDK lets you write cloud programs in C#, F#, and VB.NET.

Serilog.Enrichers.Demystifier

Unmangle async/iterator/generic stack traces in Serilog events

Serilog.Enrichers.Demystify

Unmangle async/iterator/generic stack traces in Serilog events

Furion.Extras.DependencyModel.CodeAnalysis

Furion 程序集扫描和代码分析扩展插件。

JsonApiDotNetCore

A framework for building JSON:API compliant REST APIs using ASP.NET Core and Entity Framework Core. Includes support for the Atomic Operations extension. The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features, such as sorting, filtering, pagination, sparse fieldset selection, and side-loading related resources. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection, making extensibility incredibly easy.

GitHub repositories (37)

Showing the top 20 popular GitHub repositories that depend on Ben.Demystifier:

Repository Stars
Flow-Launcher/Flow.Launcher
:mag: Quick file search & app launcher for Windows with community-made plugins
gitextensions/gitextensions
Git Extensions is a standalone UI tool for managing git repositories. It also integrates with Windows Explorer and Microsoft Visual Studio (2015/2017/2019).
BartoszCichecki/LenovoLegionToolkit
Lightweight Lenovo Vantage and Hotkeys replacement for Lenovo Legion laptops.
cyanfish/naps2
Scan documents to PDF and more, as simply as possible.
elastic/elasticsearch-net
This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
waf/CSharpRepl
A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
ErikEJ/EFCorePowerTools
Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
monksoul/Furion
让 .NET 开发更简单,更通用,更流行。
LenovoLegionToolkit-Team/LenovoLegionToolkit
Lenovo Legion Toolkit (LLT) is a Windows desktop utility created for Lenovo gaming laptops that replaces Lenovo Vantage, Legion Zone, and Legion Space.
fo-dicom/fo-dicom
Fellow Oak DICOM for .NET, .NET Core, Universal Windows, Android, iOS, Mono and Unity
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
microsoft/python-language-server
Microsoft Language Server for Python
lysilver/KopSoftWms
KopSoft仓库管理系统
riganti/dotvvm
Open source MVVM framework for Web Apps
json-api-dotnet/JsonApiDotNetCore
A framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core.
moq/labs
The most popular and friendly mocking framework for .NET
PacktPublishing/Hands-On-Domain-Driven-Design-with-.NET-Core
Hands-On Domain-Driven Design with .NET Core, published by Packt
dsafa/audio-band
Display and control songs from the Windows taskbar
IllusionMods/KKManager
Mod, plugin and card manager for games by Illusion that use BepInEx
nkdAgility/azure-devops-migration-tools
Azure DevOps Migration Tools allow you to migrate Teams, Backlogs, Work Items, Tasks, Test Cases, and Plans & Suits from one Project to another in Azure DevOps / TFS both within the same Organisation, and between Organisations.
Version Downloads Last Updated
0.4.1 61,865,678 4/23/2021
0.4.0 24,276 4/23/2021
0.3.0 1,479,754 1/4/2021
0.1.6 10,129,651 2/17/2020
0.1.5 8,044 2/17/2020
0.1.4 4,327,611 2/10/2019
0.1.3 1,308,881 11/21/2018
0.1.1 1,631,144 2/23/2018
0.1.0 2,459,045 2/8/2018
0.0.43 23,363 2/2/2018
Loading failed