.NET 3.0 WPF错误:CriticalFromVisual()值不能为空参数名称:v [英] .NET 3.0 WPF Error: CriticalFromVisual() Value cannot be null Parameter name: v

查看:55
本文介绍了.NET 3.0 WPF错误:CriticalFromVisual()值不能为空参数名称:v的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个混合使用.NET winforms和WPF的应用程序.这是一个经典的选项卡式应用程序,随着用户在选项卡之间移动,工作流程会不断进行.其中一个标签是托管WFP控件,基本上是一个包含控件的网格. 该计算机启用了触摸功能,但也具有鼠标和键盘.这是一种医疗应用程序,可在医院的10个特殊区域中运行.

We have an application that is mixed .NET winforms and WPF.  It's a classic tabbed app with the workflow progressing as the user moved through the tabs.  One of the tabs is hosting WFP controls, basically a grid containing controls.  The computer is touch enabled but with a mouse and a keyboard as well.  It's a medical application and runs in 10 special areas of a hospital.

其中一个房间大约每天一次会出现此错误:

About once a day in one of the rooms there will be this error:

Stack Trace from hotfix page:
PresentationCore.dll!System.Windows.PresentationSource.CriticalFromVisual(System.Windows.DependencyObject v, bool enable2DTo3DTransition) 
PresentationFramework.dll!System.Windows.Controls.PopupControlService.OnPostProcessInput(object sender, System.Windows.Input.ProcessInputEventArgs e) 

我们无法重现此错误,并且只会在用户中随机发生.此外,用户只能记住有关错误发生时他们正在做什么的小细节.目前尚不清楚用户是否主要使用鼠标 或触摸,我想他们会更喜欢使用鼠标.触摸显示器具有多点触摸功能,但是由于其他问题,我们将其配置为仅单点触摸.

We cannot reproduce this error and it only happens with the users randomly.  Additionally the users are only able to remember small details about what they were doing when the error happened.  It's not clear if the users mostly use the mouse or touch, my guess is they're more comfortable using the mouse.  The touch monitor has multi-touch capabilities but due to other issues we have it configured for single touch only.

我找到了2012年4月以来的以下修补程序,该修补程序具有看起来相同的堆栈跟踪:

I have located the following hotfix from Apr-2012 that has a stack trace that seems identical:

KB 2486856 (验证我的帐户后,我会添加正确的链接)

KB 2486856  (When my account is verified I'll add a proper link)

support.microsoft.com/en-us/kb/2486856

support.microsoft.com/en-us/kb/2486856

我还能够从这些计算机上获取.NET dll,它们来自2013年4月,并且似乎是后来的.NET Framework汇总/Service Pack的一部分.

I have also been able to get the .NET dlls from these machines and they are from Apr-2013 and appear to be part of a later .NET framework rollup / service pack.

我还能够在PresentationCore.CriticalFromVisual()方法内设置一个断点,并检查堆栈跟踪.我希望找到的是堆栈中的某个地方,然后可以看到我的代码,然后为该错误添加try/catch并可能继续执行. 但是,堆栈跟踪完全通过了MS代码,并在我的Main()中结束了,到那时,现在就来不及重试了.

I was also able to set a breakpoint inside the PresentationCore.CriticalFromVisual() method and inspect the stack trace. What I was hoping for was somewhere in the stack I could see my code and then add a try/catch for this error and possibly continue. However the stack trace goes fully through MS code and ends in the in my Main() and by then it's too late for a retry.

我反编译了4.0文件并处理了调用堆栈,即参数"v"所在的位置.检索(PresentationFramework.dll-PopupControlService.

I decompiled the 4.0 files and working up the call stack, the place where parameter "v" is retrieved (PresentationFramework.dll -- PopupControlService.OnPostProcessInput) there's a null check and if null the code returns.  This logic isn't in any of the 3.0 code that I can find.  My development machine has 3.0 DLL's from Jul-2015 and these too do not contain the null check.

所以我有两个选择:

  1. 也许我找到的修补程序不是实际的问题,并且有更高版本的修补程序? (2013年4月之后)
  2. 或者有一种方法可以在调用堆栈中插入代码,并进行try/catch来忽略该错误.
  3. 这不是错误在MS代码中,我做错了什么(什么?)
  4. 其他选项?

我们所能获得的只是一部手机摄像头的屏幕截图,它比根本没有效果要好:)

All we can get is a cell phone camera screen shot, which is infinitely better than nothing at all : )

我的帐户通过验证后,我将添加屏幕截图图像.

When my account is verified, I'll add the screen shot image.

 

推荐答案

也许您可以找到事件起源的控件. PopupControlService OnPostProcessInput方法应该调用工具提示和ContextMenus.然后,您可以(也许)删除EventHandler.

Maybe you can find the Control where the Event originates from. The PopupControlService OnPostProcessInput method supposed to invoke Tooltips and ContextMenus. You could then (maybe) remove the EventHandler.

只是个主意...真的没什么

Just an idea... nothing else really


这篇关于.NET 3.0 WPF错误:CriticalFromVisual()值不能为空参数名称:v的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆