"溢或下溢的运算" WPF具体问题

编程入门 行业动态 更新时间:2024-10-11 19:16:41
本文介绍了"溢或下溢的运算" 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

推荐答案

我不知道的根本原因,但还没有解决方案是在这里:结果 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 : social.msdn.microsoft/forums/en-US/wpf/thread/a31f9c7a-0e15-4a09-a544-bec07f0f152c

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

Seems to be a popular bug :)

感谢,米沙勒

thanks, Mishal

更多推荐

"溢或下溢的运算" WPF具体问题

本文发布于:2023-10-24 20:51:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524970.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:amp   QUOT   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!