C-Sharp-Promise
C-Sharp-Promise copied to clipboard
Any plans to support long stack traces / causality chains?
A long stack trace could be very useful for debugging purposes. For example see: https://github.com/kriskowal/q#long-stack-traces.
Sounds like a good idea. Although not sure how we'd achieve that in C#. Got any ideas?
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?
That's a great idea. zone.js is probably a good inspiration, too.
Any update on this? It would be very useful.
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.
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.
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).