Hi all hopefully somebody knows vb.net to help me out with this:
What this code does do is starts a new task on the thread pool to go and extract users, once it has done that bit it should update the UI (via a viewmodel) with the status.
It does work however if there are no errors, however being a connection to a server, it could error at any time and I also can raise a custom error on the userdata.extractusers sub if the current user is not found.
The error is correctly thrown in userdata.extract users but it does not propagate up through the tree back to the error block.
The issue is with the child task.continuewith..... if I remove that the error propagates as expected.
So does anybody know how to capture the error regardless of the child task?
cheers
What this code does do is starts a new task on the thread pool to go and extract users, once it has done that bit it should update the UI (via a viewmodel) with the status.
It does work however if there are no errors, however being a connection to a server, it could error at any time and I also can raise a custom error on the userdata.extractusers sub if the current user is not found.
The error is correctly thrown in userdata.extract users but it does not propagate up through the tree back to the error block.
The issue is with the child task.continuewith..... if I remove that the error propagates as expected.
So does anybody know how to capture the error regardless of the child task?
cheers
Code:
Dim userDataTask As Task = Task.Factory.StartNew(New Action(Sub() UserData.ExtractUsers())).ContinueWith(Sub(t) pSplashViewModel.Message = "Loading Resources")
Try
userDataTask.Wait()
Catch ae As AggregateException
Throw ae.Flatten
End Try