Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open exe echo System.InvalidOperationException: The calling thread must be STA, because many UI components require this. #184

Open
Nuan-Yang opened this issue Feb 20, 2024 · 5 comments

Comments

@Nuan-Yang
Copy link

logs show some dlls not found.

[0000000000000128:] EXCEPTION handling: System.IO.FileNotFoundException: Could not load file or assembly 'C:\windows\mono\mono-2.0\lib\mono\gac\PresentationCore\4.0.0.0__31bf3856ad364e35\zh-CN\PresentationCore.resources.dll' or one of its dependencies.
[0000000000000128:] EXCEPTION handling: System.IO.FileNotFoundException: Could not load file or assembly 'C:\windows\mono\mono-2.0\lib\mono\gac\PresentationCore\4.0.0.0__31bf3856ad364e35\zh-CHS\PresentationCore.resources.dll' or one of its dependencies.
[0000000000000128:] EXCEPTION handling: System.IO.FileNotFoundException: Could not load file or assembly 'C:\windows\mono\mono-2.0\lib\mono\gac\PresentationCore\4.0.0.0__31bf3856ad364e35\zh-Hans\PresentationCore.resources.dll' or one of its dependencies.
[0000000000000128:] EXCEPTION handling: System.IO.FileNotFoundException: Could not load file or assembly 'C:\windows\mono\mono-2.0\lib\mono\gac\PresentationCore\4.0.0.0__31bf3856ad364e35\zh\PresentationCore.resources.dll' or one of its dependencies.
[0000000000000128:] EXCEPTION handling: System.InvalidOperationException: The calling thread must be STA, because many UI components require this.

"<unnamed thread>" tid=0000000000000128 this=00007fa4b1f50130 , thread handle : 00007fffff307de0, state : not waiting
  at System.Windows.Input.InputManager..ctor () [0x0002f] in <c7396043e2dd401eab9d343a450a5780>:0
  at System.Windows.Input.InputManager.GetCurrentInputManagerImpl () [0x0001e] in <c7396043e2dd401eab9d343a450a5780>:0
  at System.Windows.Input.InputManager.get_Current () [0x00001] in <c7396043e2dd401eab9d343a450a5780>:0
  at System.Windows.Input.KeyboardNavigation..ctor () [0x0005e] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0
  at System.Windows.FrameworkElement/FrameworkServices..ctor () [0x00008] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0
  at System.Windows.FrameworkElement.EnsureFrameworkServices () [0x0000e] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0
  at System.Windows.FrameworkElement..ctor () [0x0009f] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0
  at System.Windows.Controls.Control..ctor () [0x00000] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0
  at ZwSoft.Windows.RibbonControl..ctor () [0x00034] in <78145e248a404b8bb6add518aaefdda7>:0
  at ZwSoft.Internal.Windows.RibbonControlManager.buildRibbonControl () [0x00007] in <78145e248a404b8bb6add518aaefdda7>:0
  at ZwSoft.ZwCAD.Ribbon.RibbonPaletteSet..ctor () [0x00021] in <e2777097dfa042e78fd6cf6454ea7e5a>:0
  at (wrapper remoting-invoke-with-check) ZwSoft.ZwCAD.Ribbon.RibbonPaletteSet..ctor () [0x00018] in <e2777097dfa042e78fd6cf6454ea7e5a>:0
  at ZwSoft.ZwCAD.Ribbon.RibbonServices.CreateRibbonPaletteSet () [0x0000d] in <e2777097dfa042e78fd6cf6454ea7e5a>:0
  at ZwCui.Manager.createRibbonControl () [0x00000] in <5e545803740d45419c3adc7fa26cbc51>:0
  at <Module>.ZcadCuiManager.createRibbonControl (ZcadCuiManager* modopt(System.Runtime.CompilerServices.IsConst) modopt(System.Runtime.CompilerServices.IsConst)) [0x00009] in <48dd8f1194454682866a80ab3348fc0f>:0
  at (wrapper native-to-managed) <Module>.ZcadCuiManager.createRibbonControl (ZcadCuiManager* modopt(System.Runtime.CompilerServices.IsConst) modopt(System.Runtime.CompilerServices.IsConst)) <0x0006a>
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
  at System.Windows.Input.InputManager..ctor () [0x0002f] in <c7396043e2dd401eab9d343a450a5780>:0 
  at System.Windows.Input.InputManager.GetCurrentInputManagerImpl () [0x0001e] in <c7396043e2dd401eab9d343a450a5780>:0 
  at System.Windows.Input.InputManager.get_Current () [0x00001] in <c7396043e2dd401eab9d343a450a5780>:0 
  at System.Windows.Input.KeyboardNavigation..ctor () [0x0005e] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0 
  at System.Windows.FrameworkElement+FrameworkServices..ctor () [0x00008] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0 
  at System.Windows.FrameworkElement.EnsureFrameworkServices () [0x0000e] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0 
  at System.Windows.FrameworkElement..ctor () [0x0009f] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0 
  at System.Windows.Controls.Control..ctor () [0x00000] in <dccde1ffbe3d4d9fb24bb8e6cba139f5>:0 
  at ZwSoft.Windows.RibbonControl..ctor () [0x00034] in <78145e248a404b8bb6add518aaefdda7>:0 
  at ZwSoft.Internal.Windows.RibbonControlManager.buildRibbonControl () [0x00007] in <78145e248a404b8bb6add518aaefdda7>:0 
  at ZwSoft.ZwCAD.Ribbon.RibbonPaletteSet..ctor () [0x00021] in <e2777097dfa042e78fd6cf6454ea7e5a>:0 
  at (wrapper remoting-invoke-with-check) ZwSoft.ZwCAD.Ribbon.RibbonPaletteSet..ctor()
  at ZwSoft.ZwCAD.Ribbon.RibbonServices.CreateRibbonPaletteSet () [0x0000d] in <e2777097dfa042e78fd6cf6454ea7e5a>:0 
  at ZwCui.Manager.createRibbonControl () [0x00000] in <5e545803740d45419c3adc7fa26cbc51>:0 
  at <Module>.ZcadCuiManager.createRibbonControl (ZcadCuiManager* ) [0x00009] in <48dd8f1194454682866a80ab3348fc0f>:0
@Nuan-Yang
Copy link
Author

I tried to create a folder and copy resource files from Dotne, but still couldn't start,and this program runs normally on the window

@madewokherd
Copy link
Owner

The FileNotFoundExceptions are normal and unrelated. What application is this?

@Nuan-Yang
Copy link
Author

FileNotFoundException是正常的和不相关的。这是什么应用程序?

zwcad

@Nuan-Yang
Copy link
Author

The FileNotFoundExceptions are normal and unrelated. What application is this?
If necessary, I can provide log information,

@madewokherd
Copy link
Owner

Would you be able to test a patch? My guess from the stack trace is that the thread was created by unmanaged code, so Mono doesn't know its apartment state.

aptstate.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants