Exception:无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“System.Management.IWbemServices”。此操作失败的原因是对 IID 为“{9556DC99-828C-11CF-A37E-00AA003240C7}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 应用程序调用一个已为另一线程整理的接口。 (异常来自 HRESULT:0x8001010E (RPC_E_WRONG_THREAD))。

报错信息

InvalidCastException: 无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“System.Management.IWbemServices”。此操作失败的原因是对 IID 为“{9556DC99-828C-11CF-A37E-00AA003240C7}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 应用程序调用一个已为另一线程整理的接口。 (异常来自 HRESULT:0x8001010E (RPC_E_WRONG_THREAD))。
StackTrace:
   在 System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   在 System.Management.IWbemServices.GetObject_(String strObjectPath, Int32 lFlags, IWbemContext pCtx, IWbemClassObjectFreeThreaded& ppObject, IntPtr ppCallResult)
   在 System.Management.ManagementObject.Initialize(Boolean getObject)
   在 System.Management.ManagementBaseObject.get_ClassName()
   在 System.Management.ManagementClass.GetInstances(EnumerationOptions options)
   在 DynamicClass.SetBrightness(Int32 brightness)
   在 DynamicClass.<>c__DisplayClass5.<OnWindowCreated>b__3(Object sender, CancelEventArgs e)
   在 System.Windows.Window.OnClosing(CancelEventArgs e)
   在 System.Windows.Window.WmClose()
   在 System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

 

解决方法

暂无解决方案。

相关信息
1 查看
22天18小时前
Quicker版本
版本 反馈次数
1.44.23 1