Question

I am working with a .NET 3.5 application in C# that calls some legacy C++ code regularly. I've noticed that calling into the C++ sometimes leads to an "Overflow or underflow arithmetic operation" when I mouse over an Infragistics UltraGrid that has a dropdown list. I've discovered that this only happens when the C++ codes does the following:

Word SavedWord = Default8087CW;
Set8087CW(0x133f); // Disable all fpu exceptions

...

Set8087CW(SavedWord);

If I comment out the last line, I no longer get the error in my .NET application. I haven't noticed any other side effects in the rest of the application. As a quick fix, I would like to leave this line commented out. What are the consequences of disabling FPU exceptions and not resetting the control word?

Was it helpful?

Solution

The solution is found here: "StackOverFlowException in WPF when call method from C++ library".

Thanks to Hans Passant for this.

OTHER TIPS

After testing on other machines, it appears that commenting out the Set8087CW(SavedWord); line only fixes the issue on my machine. There appears to be a bug in my version of Infragistics (8.2.20082.2204). Rolling back to 8.2.20082.1000 fixed the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top