This project is read-only.


Multithreading Multiple UI threads


We have an application framework which starts all sub applications in its own ui thread. In this case the WPFLocalizeExtension had problems to resolve translation tokens. This was caused by the well known thread access exception. I took the source code and could find the place which is responsible for the exception.
In the LocExtension.cs in line 407, the VisualTreeHelper tries to walk up the control hierarchy. This could be called from the wrong thread in applications with n ui threads. I changed the code to the following and could solve the problem.

if (doParent.CheckAccess())
                            doParent2 = VisualTreeHelper.GetParent(doParent);
   DependencyObject parent = doParent;

   Action update = () =>
          doParent2 = VisualTreeHelper.GetParent(parent);

   parent.Dispatcher.Invoke(update, DispatcherPriority.Normal);

Maybe this little change can be integrated in the near future.


Daniel P.

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


SeriousM wrote Oct 3, 2014 at 10:07 AM

are you sure that this works fine on standard applications? could you please verify this by changing the test application(s)?

Please create an issue on and create a pull request with your change so we can review it.

Thank you!!