Delphi 2010 and Hydra: arithmetic overflow in ShowParented


We are using Hydra 6.3.0 build 1259 to show a .NET form in our Delphi 2010 application. The application runs under Windows 10.
From time to time we do get this error:

Exception class : EOleException
exception message : Overloop of negatieve overloop in de rekenkundige bewerking.
(overflow or underflow in the arithmetic operation)

thread $1f90:
0271da51 +105 FarmadWin2.exe uHYVCLCrossPlatformVisualPluginWrapper 121 +18 THYVCLCrossPlatformVisualPluginWrapper.ShowParented
02728af5 +005 FarmadWin2.exe ZX_HydraModuleManager 137 +0 THydraModuleContainer.ShowParented

It seems the exception occurs when setSize is called in THYVCLCrossPlatformVisualPluginWrapper.ShowParented:

PluginInstance.SetSize(aParent.Width, aParent.Height);

What could be the cause of this error?




Which exactly plugin do you use? Is it WinForms or WPF? Which exactly .NET Framework version is used?

Could you create a testcase or at least provide a .NET-side stacktrace?
You’d need to start the app, attach Visual Studio as debugger to the running app and to select the System.ArithmeticException in the Exceptions pane. Then application will pause once this exception occurs.

The .NET plugin is in WPF.
The .NET framework version is 4.7.2

We don’t have a .NET stacktrace as Visual Studio is not installed on the system where the error occurs. Furthermore, the error is not visible in our logging at .NET side.

We’ll try gather more information and I will post it here

It seems that there is a compatibility issue between Delphi code and WPF: c# - "Overflow or underflow in the arithmetic operation" WPF specific issue - Stack Overflow

Could you try to add the


call to the plugin constructor and check if it makes a difference?

We have added


at the beginning of the constructor of the WPF plugin but unfortunately the problem remains.

In a second attempt, we have now added _fpreset() at the end of all our .NET methods that are called from Delphi and this seems to help. We’ll investigate further to be sure.