"溢或下溢的运算" WPF具体问题 [英] "Overflow or underflow in the arithmetic operation" WPF specific issue

查看:289
本文介绍了"溢或下溢的运算" WPF具体问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的WPF测试应用程序(很简单,只有一个窗口)是使用第三方托管的DLL(比如X.dll)。此托管的DLL使用了一些非托管的DLL的。
所以,可以说,我写的一个小WPF应用程序刚刚引用X.dll。并在窗口的构造我访问内部X.dll东西(即在X.dll一些命名空间)。在这样做,我不捕捉任何异常,好像事情是怎么回事预期。但在返回控制到.NET运行时,我得到了应用程序类的DispatcherUnhandledException处理异常:

My WPF test app (very simple, just one window) is using a 3rd party managed dll (say X.dll). This managed dll uses some unmanaged dll's . So lets say I write a small wpf app which just references X.dll. And in the window's constructor I access something inside X.dll (ie. in some namespace in X.dll). On doing this i dont catch any exception and it seems like things are going on as expected. But upon returning the control to .NET runtime, I get an exception in Application class's 'DispatcherUnhandledException' handler :

在算术运算溢出或下溢
System.ArithmeticException了未处理
消息 =,在运算溢出或下溢。结果
源代码 =PresentationFramework

堆栈跟踪

"Overflow or underflow in the arithmetic operation." System.ArithmeticException was unhandled Message="Overflow or underflow in the arithmetic operation."
Source="PresentationFramework"
StackTrace:

System.Windows.Window.ValidateTopLeft(双人间长度)结果
System.Windows.Window.CoerceTop(DependencyObject的D,对象的值)
System.Windows.DependencyObject.ProcessCoerceValue(DP的DependencyProperty,PropertyMetadata元,entryIndex&安培; entryIndex,的Int32&安培; targetIndex,EffectiveValueEntry&安培;新条目,EffectiveValueEntry&安培; oldEntry ,对象和放大器;属性oldValue,对象baseValue,CoerceValueCallback coerceValueCallback,布尔coerceWithDeferredReference,布尔skipBaseValueChecks)结果
System.Windows.DependencyObject.UpdateEffectiveValue(entryIndex entryIndex,DP的DependencyProperty,PropertyMetadata元,EffectiveValueEntry oldEntry,EffectiveValueEntry&安培;新条目,布尔coerceWithDeferredReference,OperationType operationType)在System.Windows.Window.SetupInitialState(双人间requestedTop,双requestedLeft,双requestedWidth结果
System.Windows.DependencyObject.CoerceValue(DP的DependencyProperty),双requestedHeight)结果
System.Windows.Window.CreateSourceWindowImpl()在System.Windows.Window.SafeCreateWindow()在System.Windows.Window.ShowHelper(对象booleanBox)结果
System.Windows.Threading.ExceptionWrapper。 InternalRealCall(委托回调,对象ARGS,布尔isSingleParameter)结果
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源,代表回调,对象ARGS,布尔isSingleParameter,代表catchHandler)

几点:


  • 这仅发生在WPF应用程序,而不是在的WinForms应用程序。

  • 这不会陷入在一个try-catch。只有在应用程序的DispatcherUnhandledException

  • 如果我访问X.dll的窗口的加载事件中的代码这不会发生,只有发生在构造函数。

任何人都可以想这个问题?

Can anyone guess the problem ?

谢谢,
米沙勒

Thanks, Mishal

推荐答案

我不知道的根本原因,但还没有解决方案是在这里:结果
http://social.msdn.microsoft .COM /论坛/ EN-US / WPF /线程/ a31f9c7a-0e15-4a09-A544-bec07f0f152c

I am not sure of the root cause yet but the solution is here :
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/a31f9c7a-0e15-4a09-a544-bec07f0f152c

似乎是一个普遍的错误:)

Seems to be a popular bug :)

感谢,
米沙勒

thanks, Mishal

这篇关于"溢或下溢的运算" WPF具体问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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