Closed gillima closed 3 years ago
Thanks for the PR! I left some comments :)
Ups, just got reminded by the compiler that async void
methods without await
are running synchronously. Therefor I changed to a non-async void method that starts a not awaited task...
This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
Ups, just got reminded by the compiler that
async void
methods withoutawait
are running synchronously. Therefor I changed to a non-async void method that starts a not awaited task...This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
This probably fixes a different behavior change, in that .net framework would not observe any exceptions when using BeginInvoke. EndInvoke, which wasn’t called, would be needed for that. Awaiting the Task would cause exceptions to be observed. This most recent change returns that behavior.
Awaiting the Task would cause exceptions to be observed
The exception would be "visible" inside the PublishAsync
method but not for the calling method. The issue is that you can't await async void
methods. Without making PublishAsync
returning a Task
I don't think there's a way to get the exception outside of PublishAsync
Right. I think that the behavior on your PR allows NETSTANDARD/NETCORE apps to match the behavior of .NET Framework prior to #132. #132 was a mess (with respect to the TinyMessenger change).
Merged! Thanks again for the pr! If I could get some help with https://github.com/grumpydev/TinyIoC/issues/136 that would be a massive help for pushing a release with this.
Messages are published twice but the callback is never invoked when using
PublishAsync
. Fixes #148