3

I have a PRISM v4 Project that uses several modules that are loaded at startup or when the user needs them.

One of those modules has to pull in a lot of data so i made the most cost intesive database calls async. This works pretty well except for the initialization of the module. When the module is loaded the async method works as expected and immediately returns control to the ui thread, but when i initialize the module it seems as if the constructor is waiting for the asnyc method to finish before the shell is populated with the view of the module.

I haven't really found any major sources on wether this is a known problem with prism and the unity framework.

aegar
  • 764
  • 9
  • 17
narain
  • 392
  • 5
  • 18
  • Could you provide some code ? – aegar Feb 17 '16 at 13:15
  • The [Async OOP Constructors](http://blog.stephencleary.com/2013/01/async-oop-2-constructors.html) from Stephen Cleary is a good place to start. More than likely, since there is no code provided, the await inside of the module initialization method is causing your issue. Change your code to bind to [NotifyTaskCompletion](https://github.com/StephenCleary/AsyncEx/wiki/NotifyTaskCompletion) and your UI will update once the task has been completed. – rschoenbach Nov 30 '16 at 16:42

0 Answers0