This project is read-only.


Multi UI thread localization problem


I'm working with two windows, one running in a STA thread, the other running in the main thread.

When second window (on main thread) is instantiated recive an exception "The calling thread cannot access this object because a different thread owns it." typical of UI threads accessing to an non thread-safe object.

Attached a solution demo with the problem.

file attachments

Closed Oct 3, 2014 at 10:26 AM by SeriousM


MrCircuit wrote Sep 12, 2012 at 9:25 PM

I'm sorry but this can not work. Even if we fix the GetIsInDesignMode issue (whatever cause it has - my Debugger does not tell me), we end up in the multithreaded usage of dependency properties at various instances used for the localization process (e.g. @ ResxProvider) - and this is forbidden by WPF.

As a proposal, I would suggest putting your visual part of the splash window back into the main UI thread and handle multithreaded background tasks and / or blocking of the main window with other approaches (TaskParallelLibrary, ShowDialog on the SplashWindow etc.)

I therefore consider this issue as not solvable and will close it with the next release.

Best regards,

jgomila wrote Sep 13, 2012 at 7:21 AM

Thank you MrCircuit.

I've tried to mix this library with this other library that support multiple UI threads, without success, because are implemented with very diferent approach.

At the end, due application requeriments I've decided to use static resx resources. Althought I've to say WPFLocalizationExtension is brilliant, and I'm sure next project I will use them.

MrCircuit wrote Sep 13, 2012 at 9:56 AM

Thank you for this hint regarding the other library. I now understand what he did to get along with multiple UI threads. Maybe I can add this feature to our library in a later release. I'll therefore keep this issue open.