-1
I’m trying to make a task call from a method of another Class:
Diretorios diretorios = new Diretorios();
await Task.Run(() => diretorios.CopiaDiretorios(tbxVersaoAtual.Text, tbxServerCopia.Text));
Only I get the following Exception:
System.Invalidoperationexception: 'The call thread cannot access this object because it belongs to a different thread.'
It’s really not possible to do what I’m trying to do?
I really need to wait for the execution of this method before proceeding with the execution and I can’t block the Thread UI so I need to run a Task.
PS: The call method is async and the called method is returning a Task as it should be.
Some solution?
Is Windows Forms?
– Jéf Bueno
No, I’m using WPF.
– wesley silva