All Projects → aelij → Asyncfriendlystacktrace

aelij / Asyncfriendlystacktrace

Licence: mit
Async-friendly format for stack traces and exceptions

Projects that are alternatives of or similar to Asyncfriendlystacktrace

Krakencore
💱 .NET client for Kraken Bitcoin & cryptocurrency exchange API
Stars: ✭ 37 (-81.95%)
Mutual labels:  async, netstandard
Vs Threading
The Microsoft.VisualStudio.Threading is a xplat library that provides many threading and synchronization primitives used in Visual Studio and other applications.
Stars: ✭ 585 (+185.37%)
Mutual labels:  async, netstandard
Diffadapter
A high-performance , easy-to-use Adapter for RecyclerView ,using diffutil
Stars: ✭ 193 (-5.85%)
Mutual labels:  async
Urf.net
Unit of Work & Repositories Framework - .NET 4.x
Stars: ✭ 202 (-1.46%)
Mutual labels:  async
Paper
Hassle-free HTML to PDF conversion abstraction library.
Stars: ✭ 196 (-4.39%)
Mutual labels:  async
Fooproxy
稳健高效的评分制-针对性- IP代理池 + API服务,可以自己插入采集器进行代理IP的爬取,针对你的爬虫的一个或多个目标网站分别生成有效的IP代理数据库,支持MongoDB 4.0 使用 Python3.7(Scored IP proxy pool ,customise proxy data crawler can be added anytime)
Stars: ✭ 195 (-4.88%)
Mutual labels:  async
Gear Lib
Gear-Lib, C library for IOT Embedded Multimedia and Network
Stars: ✭ 2,381 (+1061.46%)
Mutual labels:  async
Actix Extras
A collection of additional crates supporting the actix and actix-web frameworks.
Stars: ✭ 190 (-7.32%)
Mutual labels:  async
Fastapi Gino Arq Uvicorn
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).
Stars: ✭ 204 (-0.49%)
Mutual labels:  async
Gmqtt
Python MQTT v5.0 async client
Stars: ✭ 195 (-4.88%)
Mutual labels:  async
Evmongoose
DEPRECATED. Evmongoose is an asynchronous, event(libev) based multi-protocol embedded networking library with functions including TCP, HTTP, WebSocket, MQTT and much more. It's based on mongoose and libev implementation and it's support Lua API.
Stars: ✭ 199 (-2.93%)
Mutual labels:  async
Ok ip proxy pool
🍿爬虫代理IP池(proxy pool) python🍟一个还ok的IP代理池
Stars: ✭ 196 (-4.39%)
Mutual labels:  async
Netprints
Visual programming for .NET inspired by Unreal Engine's Blueprints
Stars: ✭ 194 (-5.37%)
Mutual labels:  netstandard
Liquidstate
Efficient asynchronous and synchronous state machines for .NET
Stars: ✭ 197 (-3.9%)
Mutual labels:  async
Stripe
Typed .NET clients for stripe.com REST APIs
Stars: ✭ 193 (-5.85%)
Mutual labels:  async
Avaloniaedit
Avalonia-based text editor (port of AvalonEdit)
Stars: ✭ 201 (-1.95%)
Mutual labels:  netstandard
Use Async Effect
🏃 Asynchronous side effects, without the nonsense
Stars: ✭ 193 (-5.85%)
Mutual labels:  async
Oxyplot
A cross-platform plotting library for .NET
Stars: ✭ 2,466 (+1102.93%)
Mutual labels:  netstandard
Slack Client
A better Slack client, with RTM API support.
Stars: ✭ 196 (-4.39%)
Mutual labels:  async
Swoole Bundle
Symfony Swoole Bundle
Stars: ✭ 201 (-1.95%)
Mutual labels:  async

Async-Friendly Stack Trace

Async-friendly format for stack traces and exceptions.

NuGet

Also check out Ben's Demystifier which resolves async, iterators, tuples, location functions and more.

System.Exception: Crash! Boom! Bang!
   at async AsyncFriendlyStackTrace.Test.Example1.C(?) in C:\Source\Repos\AsyncFriendlyStackTrace\src\AsyncFriendlyStackTrace.Test\Example1.cs:line 26
   at async AsyncFriendlyStackTrace.Test.Example1.B(?) in C:\Source\Repos\AsyncFriendlyStackTrace\src\AsyncFriendlyStackTrace.Test\Example1.cs:line 20
   at async AsyncFriendlyStackTrace.Test.Example1.A(?) in C:\Source\Repos\AsyncFriendlyStackTrace\src\AsyncFriendlyStackTrace.Test\Example1.cs:line 15
   at async AsyncFriendlyStackTrace.Test.Example1.Run(?) in C:\Source\Repos\AsyncFriendlyStackTrace\src\AsyncFriendlyStackTrace.Test\Example1.cs:line 10
   at AsyncFriendlyStackTrace.Test.Program.Run[TExample](TextWriter writer) in C:\Source\Repos\AsyncFriendlyStackTrace\src\AsyncFriendlyStackTrace.Test\Program.cs:line 45

Install

Install-Package AsyncFriendlyStackTrace

Usage

To format exceptions, use the extension methods in ExceptionExtensions:

exception.ToAsyncString();

This produces an async-friendly format, as you can see in the examples below. There is also special handling for AggregateExceptions and ReflectionTypeLoadException (which can contain multiple inner exceptions).

The main formatting work is done by the StackTraceExtensions.ToAsyncString extension method. The async-friendly formatting is archieved by:

  • Skipping all awaiter frames (all methods in types implementing INotifyCompletion) and ExceptionDispatchInfo frames.
  • Inferring the original method name from the async state machine class (IAsyncStateMachine) and removing the "MoveNext" - currently only for C#.
  • Adding the "async" prefix after "at" on each line for async invocations.
  • Appending "(?)" to the method signature to indicate that parameter information is missing.
  • Removing the "End of stack trace from previous location..." text.

Example outputs

In all the examples, OLD refrers to ToString() output, while NEW is ToAsyncString().

  • Example 1 (code): A simple 3 async method chain.
  • Example 2 (code): Async invocations with a synchronous Wait() in the middle, causing an AggregateException.
  • Example 3 (code): Bad Serialization - When exception is serialized and deserialized, its stack trace is saved as string. So we can't reformat the stack trace. The "new" stack trace is still a bit shorter due to an improved AggregateException formatting (the first inner exception isn't repeated twice).
  • Example 4 (code): Good Serialization - We use the PrepareForAsyncSerialization before serializing the exception. This saves the async-friendly stack trace as a string in the Data dictionary of the exception. This has two downsides:
    • The serialized data will now contain both stack trace formats.
    • When using the DataContractSerializer, you must include exception.Data.GetType() as a known type. This is because its concrete type (ListDictionaryInternal) is internal.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].