S
Striebrovlas
Guest
I have c++ dll project where WPF UserControl (as DLL) is used for GUI.
I simply working with UserControl created in C# project inside C++/CLI
controls = gcnew uc_control();
The problem is, when project is compiled, it throw this error:
Unhandled Exception: System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
this error cause code above.
The interesting part is, when project is run under validator (validator is not created by me) then error is occurred. But when project is run under host application, everything is working, without any error.
question is, Where should be problem? Should I use another thread with STA enabled? Is it ok create UserControl or any other C# object from WPF without STA thread?
Btw. I dont use application framework (App.xaml) in dll.
Continue reading...
I simply working with UserControl created in C# project inside C++/CLI
controls = gcnew uc_control();
The problem is, when project is compiled, it throw this error:
Unhandled Exception: System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
this error cause code above.
The interesting part is, when project is run under validator (validator is not created by me) then error is occurred. But when project is run under host application, everything is working, without any error.
question is, Where should be problem? Should I use another thread with STA enabled? Is it ok create UserControl or any other C# object from WPF without STA thread?
Btw. I dont use application framework (App.xaml) in dll.
Continue reading...