“the calling thread must be STA, because many UI components require this”
STA thread?how comes other Wpf application does not have such an issue?
However, as the following reference has stated, it is because the Visual studio hosting process is enabled. ??how comes that way?
you can turn off this by
Project Properties > Debug > Enable Visual Studio hosting process
As in the second references, it is recommended to turn off this settings.
However, this raise a very interesting things, what if you want to run something which run in a STA aparment?
from this post from codeproject.
You might do this:
Thread thread = new Thread(
() =>
{
// ....
}
);
// this has to be run from the STATthread apartment.
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
References:
The calling thread must be STA, because many UI components require this
Enable or Disable Visual Studio Hosting Process?
The calling thread must be STA, because many UI components require this while navigation in wpf
Similar Posts:
- vshost.exe What is the purpose of the document?
- error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”:
- [Solved] Visual Studio 2015 Warning: Cannot find one or more components. Please reinstall the application.
- Visual Studio Failed to Start Error: throw error ‘cannot run when setup is in progress’
- .NET Core5 MVC/WebAPI – HTTP Error 500.30 – ASP.NET Core app failed to start
- IIS publishing Net core 3.1 error [How to Solve]
- Installation tutorial of visual studio 2017 and visual Assist X
- Visual Studio 2010 SDK
- Server failed during MySQL installation or re installation
- Installing mingw64 and msys2 in win10