Skip to content

Possible fix for multi-thread usage of DialogHost.GetInstance()#2849

Merged
Keboo merged 5 commits intoMaterialDesignInXAML:masterfrom
nicolaihenriksen:fix2844
Sep 16, 2022
Merged

Possible fix for multi-thread usage of DialogHost.GetInstance()#2849
Keboo merged 5 commits intoMaterialDesignInXAML:masterfrom
nicolaihenriksen:fix2844

Conversation

@nicolaihenriksen
Copy link
Copy Markdown
Contributor

Possible fix for #2844

I added a unit test which initially failed with the same exception as reported in the issue. Slight modifications to the DialogHost.GetInstance() were added in order to retrieve the identifier using the Dispatcher associated with the owning thread. This makes the test run green. This change effectively replaces the Dispatcher.VerifyAccess() call by using the owning thread when needed.

As mentioned in the bug, the Dispatcher.VerifyAccess() guard was to some extent unnecessary because the following dialogInstance.Identifier DP-getter would result in the same exception being thrown.

I am a bit unsure whether there could be other areas where a similar approach would be needed.

@nicolaihenriksen
Copy link
Copy Markdown
Contributor Author

@Keboo I don't understand the latest failures of this PR verification. Is it the double-source generator issue coming into play again?

@Keboo Keboo enabled auto-merge (squash) September 16, 2022 04:27
@Keboo Keboo added this to the 4.6.0 milestone Sep 16, 2022
@Keboo Keboo merged commit 53e0c02 into MaterialDesignInXAML:master Sep 16, 2022
@nicolaihenriksen nicolaihenriksen deleted the fix2844 branch September 16, 2022 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants