Recently in the development of a. NET program, which involves calls to COM components, or third-party DLL calls,
After the call, if you continue to run with some small test program, but when you use a form program with a GUI, or in a WPF program, the following exception exception always occurs: System.arithmeticexceptionmessage: Overflow or underflow occurs in arithmetic operations.
"Setting property" System.Windows.FrameworkElement.Height "throws an exception. ", the line number is" 6 "and the line position is" 14 ".
In System.Windows.Markup.WpfXamlLoader.Load (XamlReader xamlreader, Ixamlobjectwriterfactory writerfactory, Boolean Skipjournaledproperties, Object rootobject, xamlobjectwritersettings settings, Uri BaseUri)
In System.Windows.Markup.WpfXamlLoader.LoadBaml (XamlReader xamlreader, Boolean skipjournaledproperties, Object Rootobject, Xamlaccesslevel accessLevel, Uri BaseUri)
In System.Windows.Markup.XamlReader.LoadBaml (Stream stream, ParserContext ParserContext, Object parent, Boolean Closestream)
In System.Windows.Application.LoadComponent (Object component, Uri resourcelocator)
In Evidence.MVVM.Views.WinIdentityVeri.InitializeComponent () position E:\Win.xaml: line number 1
Workaround:
1. Declaring a DLL out of use
[DllImport ("MSVCR71.dll", CallingConvention = callingconvention.cdecl)]
public static extern int _controlfp (int n, int mask);
internal void Resetfpcr ()
{
const int _em_overflow = 0x0009001f;
const int _MCW_EM = 0X000FFFFF;
_CONTROLFP (_em_overflow, _mcw_em);
}
2. After the COM component is called, call the method above, for example:
Calling COM components here
Then execute the Reset method
RESETFPCR ();
If no msvcr71.dll is downloaded from the web and then placed in the bin directory
. NET System.ArithmeticException exception occurs after using COM components (overflow or underflow in message= arithmetic operations. )