Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Using Dispatcher when accessing the ItemsSource of the start page #759

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmgerald
Copy link

When using SDA the initialization of recent projects on start page, because after await another thread tried to access ItemSource

…ecause after await another thread tried to access ItemSource
@mmgerald
Copy link
Author

mmgerald commented May 6, 2016

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the #develop open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@mmgerald
Copy link
Author

mmgerald commented Jun 1, 2016

Are there any news? Something missing? is it possible to merge the pull request?

@mrward
Copy link
Member

mrward commented Jun 1, 2016

If BuildRecentProjectList is called on the UI thread then setting the ItemsSource should be called on the UI thread so you should not need to use the dispatcher. The Task.Run part will be run on another background thread. This task is awaited and so the code adding items to the list's ItemSource should execute on the UI thread.

@mmgerald
Copy link
Author

mmgerald commented Jun 2, 2016

I agree that the code adding items to the list's ItemSource should execute on the UI thread. But the behavior is different when using SDA (Sharp Develop for Applications). After await, a MTA thread is returned form Thread Pool, that executes the code. In this case Sharp Develop is hosted in another process, therefore the Task Framework behave different.

It is reproducible when using samples\SdaUser, when including the StartPage Add-In.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants