benaadams / Ben.Demystifier

High performance understanding for stack traces (Make error logs more productive)
Apache License 2.0
2.76k stars 118 forks source link

Demystify F# async/task stack traces #100

Closed Horusiath closed 3 years ago

Horusiath commented 4 years ago

This is only the initial PR with a proposal to make Ben.Demystifier aware of F# async engines. Example form the samples folder produces a raw exception stack trace of:

System.Exception: BOOM!
   at Program.call@10-1.Invoke(Unit _arg1) in D:\projects\dev\contrib\Ben.Demystifier\sample\FSharpStackTrace\Program.fs:line 11
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 417
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109
--- End of stack trace from previous location where exception was thrown ---
   at Ply.TplPrimitives.TplAwaitable`4.GetNext()
   at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Program.main(String[] argv) in D:\projects\dev\contrib\Ben.Demystifier\sample\FSharpStackTrace\Program.fs:line 31

While after this PR:

System.Exception: BOOM!
   at async Async<int> Program+call@10-1.() in D:/projects/dev/contrib/Ben.Demystifier/sample/FSharpStackTrace/Program.fs:line 11
   at int Program.main(string[] argv) in D:/projects/dev/contrib/Ben.Demystifier/sample/FSharpStackTrace/Program.fs:line 31

Some notes and thoughts:

benaadams commented 3 years ago

THank you!

benaadams commented 3 years ago

This has been released in v 0.2.1