StackTraceBeautify 2.0.0

dotnet add package StackTraceBeautify --version 2.0.0
                    
NuGet\Install-Package StackTraceBeautify -Version 2.0.0
                    
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="StackTraceBeautify" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StackTraceBeautify" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="StackTraceBeautify" />
                    
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 StackTraceBeautify --version 2.0.0
                    
#r "nuget: StackTraceBeautify, 2.0.0"
                    
#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 StackTraceBeautify@2.0.0
                    
#: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=StackTraceBeautify&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=StackTraceBeautify&version=2.0.0
                    
Install as a Cake Tool

StackTraceBeautify

.NET Port of netStack.js

NuGet license

build status

A simple Library for highlighting .NET, Java, JavaScript, Python, PHP, Ruby and Go stack traces. It converts a Stack Trace (String) in to an html highlighted (beautified) String

Stacktrace - Runtime support
  • .NET - at Type.Method(String s) in file.cs:line 12
  • Java (and other JVM languages like Kotlin or Scala) - at com.example.Type.method(Type.java:12)
  • JavaScript - V8 (Chrome, Edge, Node.js): at Type.method (file.js:12:5), Firefox and Safari: method@file.js:12:5
  • Python - File "file.py", line 12, in function
  • PHP - #0 file.php(12): Type->method('abc')
  • Ruby - from file.rb:12:in 'Type#method'
  • Go - main.(*Type).Method(0x1) followed by /path/file.go:12 +0x1d

The runtime is detected from the first recognized stack frame, GetRuntime() returns the detected runtime. To skip the detection, set the runtime in the options (Runtime = StackTraceRuntime.Java).

Stacktrace - Language support

The .NET parser does not depend on the language of the stack trace. Frames are recognized by their structure (<at> Type.Method(params) [<in> file:<line> number]), so stack traces in any language are supported, e.g. Danish, English, French, Japanese, German, Spanish, Russian, Chinese, ...

GetLanguage() returns the detected language (for information only) for all .NET Framework translations: English, Arabic, Chinese (Simplified and Traditional), Czech, Danish, Dutch, Finnish, French, German, Greek, Hebrew, Hungarian, Italian, Japanese, Korean, Polish, Portuguese, Russian, Spanish, Swedish and Turkish (Norwegian uses the same keywords as Danish and is detected as Danish).

Demo

Stack Trace Formatter - Online pretty print of .NET stack traces

Initialization
var bs = new StackTraceBeautify()
bs.Beautify(input);
Options
var bs = new StackTraceBeautify(new Options
                           {
                               PrettyPrint = false,
                               FrameCssClass = "st-frame",
                               TypeCssClass = "st-type",
                               MethodCssClass = "st-method",
                               ParamsListCssClass = "st-frame-params",
                               ParamTypeCssClass = "st-param-type",
                               ParamNameCssClass = "st-param-name",
                               FileCssClass = "st-file",
                               LineCssClass = "st-line",
                               ColumnCssClass = "st-column",
                               Runtime = StackTraceRuntime.Auto
                           });
Ready to go css
pre, code {background-color:#333; color: #ffffff;}
.st-type {color: #0a8472; font-weight: bolder;}
.st-method {color: #70c9ba; font-weight: bolder;}
.st-frame-params {color: #ffffff; font-weight: normal;}
.st-param-type {color: #0a8472;}
.st-param-name {color: #ffffff;}
.st-file {color:#f8b068;}
.st-line {color:#ff4f68;}
.st-column {color:#ff4f68;}

Acknowledgments

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net481 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8.1

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 49 9/26/2026
1.0.2 128 8/9/2026
1.0.1 6,387 7/16/2023
1.0.0 590 4/15/2022