Exception:调用线程必须为 STA,因为许多 UI 组件都需要。

报错信息 1
InvalidOperationException: 调用线程必须为 STA,因为许多 UI 组件都需要。
StackTrace:
   在 System.Windows.Input.InputManager..ctor()
   在 System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
   在 System.Windows.Input.KeyboardNavigation..ctor()
   在 System.Windows.FrameworkElement.FrameworkServices..ctor()
   在 System.Windows.FrameworkElement.EnsureFrameworkServices()
   在 System.Windows.FrameworkElement..ctor()
   在 DynamicClass.Script.CreateAccountItem(String issuer, String label, AccountInfo accountInfo, String iconUrl, Int32 index)
   在 DynamicClass.Script.<>c__DisplayClass15.<LoadAccounts>b__13(Object param0)
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   在 System.Threading.ThreadPoolWorkQueue.Dispatch()

版本:1.44.22 2025-08-12 11:14 Microsoft Windows NT 10.0.19045.0