Tuesday, January 21, 2025
HomejQuerySpotlight .NET Stack Hint In Exception - netStack.js

Spotlight .NET Stack Hint In Exception – netStack.js


netStack.js is a minimal jQuery Vanilla JavaScript syntax highlighting plugin for .NET that lets you spotlight the exception data (stack traces) utilizing your individual CSS types.

How you can use it:

1. Insert your stack hint right into a <pre> or <code> tag.


<pre class="stacktrace">
ConsoleApplication1.MyCustomException: some message .... ---> System.Exception: Oh noes!
   at ConsoleApplication1.SomeObject.OtherMethod() in C:ConsoleApplication1SomeObject.cs:line 24
   at ConsoleApplication1.SomeObject..ctor() in C:ConsoleApplication1SomeObject.cs:line 14
   --- Finish of inside exception stack hint ---
   at ConsoleApplication1.SomeObject..ctor() in C:ConsoleApplication1SomeObject.cs:line 18
   at ConsoleApplication1.Program.DoSomething() in C:ConsoleApplication1Program.cs:line 23
   at ConsoleApplication1.Program.Major(String[] args) in C:ConsoleApplication1Program.cs:line 13
</pre>

2. Obtain and insert the principle script ‘netstack.js’ into the doc.


<script src="/path/to/netStack.js"></script>

3. Initialize the plugin on the <pre> component.


const stack = new netStack('.stacktrace');

4. Apply your individual types to the highlighted strings.


pre, code {
  background-color: #222;
  shade: #ffffff;
  font-family:'Roboto Mono'
}

.st-type {
  shade: #0a8472;
  font-weight: bolder;
}

.st-method {
  shade: #70c9ba;
  font-weight: bolder;
}

.st-frame-params {
  shade: #ffffff;
  font-weight: regular;
}

.st-param-type { shade: #0a8472; }

.st-param-name { shade: #ffffff; }

.st-file { shade: #f8b068; }

.st-line { shade: #ff4f68; }

5. Default values for courses.


const stack = new netStack('.stacktrace', {
  body: 'st-frame',
  sort: 'st-type',
  methodology: 'st-method',
  paramsList: 'st-frame-params',
  paramType: 'st-param-type',
  paramName: 'st-param-name',
  file: 'st-file',
  line: 'st-line'
});

Changelog:

v2.1.0 (2025-01-10)

  • added help for Spanish stack traces

v2.0.0 (2024-08-29)

  • Transformed library to vanilla javascript.
  • Added help for output from AggregateException.
  • Mounted a bug the place an inside exception was not appropriately formatted.
  • UMD compatibility added.

v1.2.0 (2023-11-23)

v1.1.2 (2023-02-07)

2021-11-17

  • Repair bug with “at” in error message

v1.1.0 (2021-10-02)

  • Assist for Russian stack traces.
  • Mounted a bug the place a number of cases of — weren’t appropriately indented.

2021-02-16

  • Updated to model 1.0.14

2020-02-28

  • Up to date to model 1.0.13: Mounted Stacktrace not appropriately formatted

2020-02-22

  • Up to date to model 1.0.12

2019-08-15

  • Up to date to model 1.0.11

2019-06-11

  • Up to date to model 1.0.10

2019-02-11

2019-01-07

  • Rename stacktrace.js
  • JS replace

2018/08/18


This superior jQuery plugin is developed by elmahio. For extra Superior Usages, please verify the demo web page or go to the official web site.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments