Possible bug in [RelayCommand] async task #355
Unanswered
DarthMazut
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
when I mark my command with
[RelayCommand]
and useasync Task
signature then when synchronouse part of code throws exception this exception is swallow and another criptic exception is thrown instead. Let me give you an excample:In my view I bind Button's command to my VM command, like so:
In my VM I do the following:
this simulates any method that has some async call, but before awaiting it, an exception has been thrown by prior part of code.
In such case, after pressing button I receive:
Unhandled exception at 0x76B757B1 (combase.dll) in TestApp1.exe: 0xC000027B: Wystąpił wewnętrzny wyjątek aplikacji (parameters: 0x16B993B0, 0x00000001).
and eventually this:Exception thrown at 0x00DBE538 in TestApp1.exe: 0xC0000005: Access violation executing location 0x00DBE538.
This happens only when my method signature is
async Task
, when changing it toasync void
the proper exception is thrown.My question is whether this is expected or it's a bug? Should I use
async void
? I thoughasync Task
is recommended?This is obviously problematic because if I throw meaningfull exception from my code I'd like to see those instead of this
Access violation
internal stuff.Beta Was this translation helpful? Give feedback.
All reactions