- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我的 WPF 测试应用程序(非常简单,只有一个窗口)正在使用第 3 方托管的 dll(比如 X.dll)。此托管 dll 使用一些非托管 dll。因此,假设我编写了一个仅引用 X.dll 的小型 wpf 应用程序。在窗口的构造函数中,我访问了 X.dll 中的某些内容(即在 X.dll 中的某个 namespace 中)。在这样做时,我没有发现任何异常,而且事情似乎按预期进行。但是在将控件返回到 .NET 运行时时,我在 Application 类的“DispatcherUnhandledException”处理程序中遇到异常:
“算术运算上溢或下溢。”System.ArithmeticException 未处理Message="运算上溢或下溢。"
来源="PresentationFramework"
堆栈跟踪:
System.Windows.Window.ValidateTopLeft(Double length)<br/>
System.Windows.Window.CoerceTop(DependencyObject d, Object value)
System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean skipBaseValueChecks)<br/>
System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)<br/>
System.Windows.DependencyObject.CoerceValue(DependencyProperty dp) at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)<br/>
System.Windows.Window.CreateSourceWindowImpl() at System.Windows.Window.SafeCreateWindow() at System.Windows.Window.ShowHelper(Object booleanBox)<br/>
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)<br/>
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
几点:
有人能猜出问题吗?
谢谢,米沙尔
最佳答案
按照@Mishhl 的链接,修复是
public class FloatingPointReset
{
[DllImport("msvcr110.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int _fpreset();
public static void Action()
{
// Reset the Floating Point (When called from External Application there was an Overflow exception)
_fpreset();
}
}
这是由包含的 DLL 中的某些内容将 FP 重置为与 WPF/C#/Microsoft DLL 不兼容的状态引起的。 Delphi/CPPB 默认执行此操作。
因此在窗口构造函数或 App() 构造函数中只需执行
FloatingPointReset.Action();
您可能需要更改以下内容以引用任何版本的 msvcr###.dll
[DllImport("msvcr110.dll", CallingConvention = CallingConvention.Cdecl)]
例如
[DllImport("msvcr70.dll", CallingConvention = CallingConvention.Cdecl)]
关于c# - "Overflow or underflow in the arithmetic operation"WPF 特定问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2407040/
我正在使用 bootstraptable 并试图让单元格显示溢出的内容但只显示向下(即 overflow-y)。问题是,bootstraptable css 使用 overflow: hidden o
来自文档:溢出: The overflow shorthand CSS property sets what to do when an element's content is too big to
有多个这样命名的问题,但我没有找到一个适用于我的情况,所以我在这里: 在这段代码中: #container:hover { overflow-x: hidden; } #container {
我正在学习 Haskell,但遇到了我没想到的异常“堆栈溢出”。 代码相当简单: type Reals = Double prod :: Reals -> Reals -> Reals prod a
我通读了this question并且没有看到我的问题是否有解决方案。 我创建了一个 CodePen这表明了这个问题。我希望隐藏红色边框左侧和右侧 (overflow-x) 的所有内容,但保持顶部和底
我有一张 bootstrap 4 卡,我想在其中隐藏字幕的溢出(并显示“...”)。我怎样才能实现这个目标?如果可能的话使用纯引导代码... Test object Added by
我今天更新了我的 flutter ,现在堆栈小部件中的溢出参数不再有效。 Flutter 1.22.0-10.0.pre.252 • channel master • https://github.c
使用 border-radius Opera 实际上不会隐藏元素的溢出部分。我已经尝试应用我设法在类似线程中找到的东西,例如定义边框样式或注意使用绝对和相对参数进行定位。但它仍然无法正常工作。 htm
我在固定大小的 div 中有一个表。如果表格溢出 div,我希望滚动条出现。我还想在向下滚动时克隆表格的标题,以便标题持久存在。我遇到的问题是我希望水平滚动条滚动克隆的标题和原始表格,而垂直滚动条
奇怪,我以为 overflow-x 和 overflow-y 都被广泛支持,但后来我才看到它只支持 CSS3( http://reference.sitepoint.com/css/overflow
unsigned long long terms; unsigned long long test; unsigned long long digit = 1; unsigned long long
我有一个案例,我必须使用 overflow-x:scroll; 水平显示内容。 现在在这个Fiddle第一个 block 有 overflow-y:scroll; 提供滚动,用户可以滚动内容。在第二个
您好,我正在尝试只使用 overflow-x 而不是 overflow-y 结构是这样的 Head1 feild1
我有一个正在运行的计划作业,我想计算过去 30 天的时间。为此,我收到一条警告,表示在表达式中检测到数字溢出。我怎样才能安全地给予 30 天? @Override @Scheduled(cro
我有一个父级,它有多个子级,当父级宽度溢出时,我喜欢显示水平滚动条。 我不想使用“display:inline-block”属性,因为它们之间会产生空白。 这是我的尝试: .parent{ wid
我正在为导航栏编写一些 CSS,我需要为下拉菜单使用 max-height 和 overflow-y: scroll 以便确保它适合页面。但是,每当我将 overflow-y 属性设置为滚动时,它似乎
这是我的问题。我有一个旋转木马,它也像菜单一样。当选项卡的数量高于浏览器可用的宽度空间时,将出现轮播控件。一切正常。但我还在每个选项卡上添加了一个下拉菜单,这就是问题所在。如果我设置 overflow
这个问题在这里已经有了答案: CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue (10 个答案) 关
这个问题在这里已经有了答案: How do you keep parents of floated elements from collapsing? [duplicate] (15 个答案) W
这是一个代码片段: div.one { width: 98%; border: 5px solid black; overflow-x: visible; overflow-y: hi
我是一名优秀的程序员,十分优秀!