ProtoPromise: Methods to troubleshoot UnobservedPromiseException
Hi Tim and friends,
I’m getting a UnobservedPromiseException show up a minute or two after I’ve stopped Unity when GC catches up. This means I have zero info on where or why my code is not resolving a deferred promise.
Is there any way to have PROMISE_DEBUG record the top of stack trace when a deferred promise is created? Another idea would be to allow a debug label (string) to be attached to a promise. In non-debug mode, the string is just dropped and not part of a promise struct, but in debug mode it would travel around with the promise allowing the developer to see its origin.
Drew
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 24 (16 by maintainers)
Aha, looks like it was fixed in #306! To confirm, I added a try/catch:
And that actually logs
InvalidOperationException: SynchronizationOption.Foreground was provided, but Promise.Config.ForegroundContext was null. You should set Promise.Config.ForegroundContext at the start of your application (which may be as simple as 'Promise.Config.ForegroundContext = SynchronizationContext.Current;').@drew-512 If you try latest master, it should be fixed. Thank you very much for the bug report, and please let me know if you hit any other issues!