【问题标题】:WPF System.ComponentModel.Win32Exception (0x80004005): Invalid window handleWPF System.ComponentModel.Win32Exception (0x80004005):无效的窗口句柄
【发布时间】:2013-09-07 23:17:44
【问题描述】:

我在 WPF 上收到以下错误。 我在窗口上使用 MVVM 数据绑定到 DataContext + CollectionViewSources。 视图模型和视图中有太多代码要发布,但我想知道在哪里可以找到它,因为没有出现行号。

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

这是调用后

TabItemSelectionEditor.UpdateLayout() 

TabItemSelectionEditor 是一个 System.Windows.Control.TabItem

System.ComponentModel.Win32Exception (0x80004005):无效窗口 处理

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

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

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

在 System.Windows.ContextLayoutManager.fireAutomationEvents()

在 System.Windows.ContextLayoutManager.UpdateLayout()

在 System.Windows.UIElement.UpdateLayout()

在 System.Windows.Controls.VirtualizingStackPanel.c_DisplayClassb.b_7()

在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托 回调,对象参数,Int32 numArgs)

在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object 源,委托方法,对象参数,Int32 numArgs,委托 catchHandler)

内部异常什么都不是!

【问题讨论】:

  • 还有什么可以继续的——甚至没有什么可以猜测的。这似乎是处理异常的堆栈——而不是导致异常的堆栈。有内部异常吗? 那个内部异常是什么?
  • 我刚刚添加了更多细节。
  • 我看到了一个非常大的问题,我不知道这是从哪里来的:类型:System.ComponentModel.Win32Exception 消息:当该文件已经存在时无法创建文件 StackTrace:在 MS.Win32 .UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount) 在 System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore() ... 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args , Int32 numArgs, 委托 catchHandler)
  • 我看到的异常与@Volker von Einem 完全相同。我不知道为什么。有人知道吗?

标签: c# wpf


【解决方案1】:

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

我还可以看到有一个VirtualizingStackPanel 参与其中,并且在它对其子级调用UIElement.UpdateLayout() 方法时发生了错误。

这就是我能从这个错误中解决的所有问题,如果没有更多信息,我无能为力。

【讨论】:

  • 我的 ViewModel 上有一个 .Show() 方法,它创建并显示了视图。这就是您所说的 DisplayClass 方法吗?
  • 不。这只是一个猜测,但您是说在应用程序的任何地方都没有名为DisplayClass 的类、方法或自定义对象?这是因为错误中的那一行写着 DisplayClass... 这是 not VirtualizingStackPanel 类的方法,所以我假设它来自 your i> 代码。
  • 也许这在 Telerik 代码中?因为我在该选项卡项中使用了一些 Telerik 的东西。
  • 很可能来自 Telerik...也许你应该联系他们?
  • 嘿,我删除了 Telerik 并切换到内置的 .NET WPF TabControl 和同样的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-24
  • 2010-12-06
  • 2014-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多