Real-Serious-Games / C-Sharp-Promise

Promises library for C# for management of asynchronous operations.
MIT License
1.19k stars 148 forks source link

Any plans to support long stack traces / causality chains? #13

Open landonpoch opened 8 years ago

landonpoch commented 8 years ago

A long stack trace could be very useful for debugging purposes. For example see: https://github.com/kriskowal/q#long-stack-traces.

ashleydavis commented 8 years ago

Sounds like a good idea. Although not sure how we'd achieve that in C#. Got any ideas?

zsoi commented 8 years ago

I like the idea, too - one could record stack traces manually via the StackTrace class, and then pass traces to the next promise. But sounds like a pretty complicated task, and I'd guess that selectively activating/deactivating the feature may be not so easy to accomplish, because it sounds like a lot of overhead processing. Would it be possible to let "debuggable promises" inherit from the default implementation?

kibiz0r commented 8 years ago

That's a great idea. zone.js is probably a good inspiration, too.

bendangelo commented 6 years ago

Any update on this? It would be very useful.

RoryDungan commented 6 years ago

We currently don't have any plans to implement this feature ourselves but would be happy to merge it if someone can figure out an implementation that doesn't break any existing code.

TinyTeaTree commented 5 years ago

What would a long stack trace look like compare to what we got today?

Currently you get different stack traces on code invoked from the resolver if you resolved after the callbacks were set, or if the callbacks where set after the Promise was resolved.

timcassell commented 1 year ago

FYI I have this working in my ProtoPromise library. The steps are to capture the current stack trace whenever a new Promise is created. Set that trace to the currently running trace before the callback is executed (in a [ThreadStatic] field). When the stack trace is captured, append it to a list of all the previous stack traces (I store it in a CausalityTrace class that handles it cleanly).