c# - WPF System.ComponentModel.Win32Exception (0x80004005) : Invalid window handle

标签 c# wpf

我在 WPF 上收到以下错误。 我正在使用 MVVM 数据绑定(bind)到窗口上的 DataContext + CollectionViewSources。 View Model 和 View 中的代码太多无法发布,但我想知道在哪里可以找到它,因为没有行号出现。

该窗口使用带有转换器的 WPF 数据绑定(bind),其中还有一些 Telerik 控件。

这是在调用之后

TabItemSelectionEditor.UpdateLayout() 

TabItemSelectionEditor 是一个 System.Windows.Control.TabItem

System.ComponentModel.Win32Exception (0x80004005): Invalid window handle

at MS.Win32.UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)

at System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()

at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()

at System.Windows.ContextLayoutManager.fireAutomationEvents()

at System.Windows.ContextLayoutManager.UpdateLayout()

at System.Windows.UIElement.UpdateLayout()

at System.Windows.Controls.VirtualizingStackPanel.<>c_DisplayClassb.b_7()

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

内部异常不算什么!

最佳答案

您的代码中没有 DisplayClass 方法吗?

我还可以看到,有一个 VirtualizingStackPanel 涉及,当它在其子项上调用 UIElement.UpdateLayout() 方法时发生错误。

这就是我可以从这个错误中解决的所有问题,没有任何更多信息,我无法提供任何进一步的帮助。

关于c# - WPF System.ComponentModel.Win32Exception (0x80004005) : Invalid window handle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18614011/

相关文章:

c# - 如何创建自定义授权过滤器?

c# - 当目录不存在时,Directory.Exists 返回真

c# - 多线程上的 WPF UI?

c# - WPF自定义控件依赖属性中未知对象的双向绑定(bind)问题

c# - 重复调用CurrentThread.ManagedThreadId或将值存储在线程本地存储中?

c# - 在表插入上显示窗口气球通知

wpf - 在 DataGridTemplateColumn 中添加图像

c# - 在 GMap.net 中缩放和平移

c# - 通过Mysql数据库验证用户身份

c# - 具有 Unity IoC 的 MVC 5/.Net 框架 - 注册 ILogger