Cross-thread operation not valid
-
mercoledì 25 aprile 2012 14:08
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
Tutte le risposte
-
sabato 5 maggio 2012 02:35Moderatore
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
- Proposto come risposta Greg ShirakyanMicrosoft Employee, Moderator mercoledì 9 maggio 2012 00:25
- Contrassegnato come risposta Greg ShirakyanMicrosoft Employee, Moderator venerdì 11 maggio 2012 00:14

