Cross-thread operation not valid
-
Wednesday, April 25, 2012 2:08 PM
Hi everybody,
I have been working in a large project using MRDS, aproximalety 40 services and counting :-), and I am having this problem:
Previously, I developed my simulation project using Windows XP professional and MRDS 2008 R2. Now I am trying to make the same project to work using Windows Seven Professional an MRDS R4 and get the following error message when the scenario meshes are loading:
"Cross-thread operation not valid: Control 'SimulatorUI' accessed from a thread other than the thread it was created on."
and the Microsoft Visual Studio 2010 shows me this error pointing to a line of the code where the SimulationEngine.ResourceCache.CreateMeshFromFile function is called. It looks something like this:
VisualEntityMeshm =SimulationEngine.ResourceCache.CreateMeshFromFile(SimulationEngine.GlobalInstance.Device, Name);
Can anybody give a hand of this? It is something that just surged today and never has happened to me before.
Many thanks for your help,
Antonio.
amattag
All Replies
-
Saturday, May 05, 2012 2:35 AMModerator
When you get a notification back from the services, it is on a different thread than the UI thread.
You essentially need to do a _wpfServicePort.Invoke to schedule it on the UI thread.
Take a look at it below
- Proposed As Answer by Greg ShirakyanMicrosoft Employee, Moderator Wednesday, May 09, 2012 12:25 AM
- Marked As Answer by Greg ShirakyanMicrosoft Employee, Moderator Friday, May 11, 2012 12:14 AM

