http://bugs.winehq.org/show_bug.cgi?id=31269
Bug #: 31269 Summary: System.OverflowException in .NET application using Decimal data type Product: Wine Version: 1.5.0 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: oleaut32 AssignedTo: wine-bugs@winehq.org ReportedBy: elgonzo@gmx.net Classification: Unclassified
I tried to run a .NET 2.0 application with Wine 1.5. Its GUI uses System.Windows.Forms.NumericUpDown controls.
When setting the NumericUpDown's Value property (data type is Decimal), it may raise the following unhandled exception:
System.OverflowException: Value was either too large or too small for a Decimal. at System.Decimal.Compare(Decimal d1, Decimal d2) at System.Windows.Forms.NumericUpDown.set_Value(Decimal value) at FootprintCreator.GUI.NumericInputMIL.OnActiveUnitChanged(Object sender, UnitEventArgs e) at FootprintCreator.Data.UnitManager.UnitChangedHandler.Invoke(Object sender, UnitEventArgs e) at FootprintCreator.Data.UnitManager.set_ActiveUnit(Unit value)
Apparently, the NumericUpDown control wants to compare the new value with the existing one (to determine if an update is necessary, i guess), which results in throwing the exception.
The application works fine in MS Windows (using the native .NET framework). With Ubuntu 12.04 as host OS, the problem occurred with Wine 1.5 as well as Wine 1.4, and with either dotnet20 or dotnet20sp2 package being installed.
This issue might be related to bug #18709.
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com 2012-07-21 01:46:58 CDT --- Is this application available for download somewhere?
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #2 from ElGonzo elgonzo@gmx.net 2012-07-21 05:54:34 CDT --- Created attachment 41085 --> http://bugs.winehq.org/attachment.cgi?id=41085 Small demo program exhibiting the problem
This is a demo program to demonstrate the problem with the System.Windows.Forms.NumericUpDown control when running in Wine. The demo program requires .NET framework 2.0.
The demo program has also been tested on MS Windows with the native .NET framework, and it does not exhibit a problem there.
The attached ZIP archive contains the documented source code and and executable built with VS2010.
As i found out, certain very specific conditions have to be met to trigger the OverflowException:
- NumericUpDown's maximum value must be initially set to decimal.MaxValue.
- NumericUpDown's value must be programmatically set to floating point number with a fraction, such as 123.456. Integer-like values (such as 123.0) would not trigger the problem.
- After setting the value of NumericUpDown, change its maximum value to, for example, 1000.0. This will cause the OverflowException when the program is executed in Wine.
Note, that if any of these conditions is not fully met, the issue will not be triggered.
While exploring the bug, i stumbled over another issue with the NumericUpDown control in Wine, which might be a different bug or just another symptom of the same bug. Please let me know if you would like me to file this issue as a separate bug.
One condition of of the bug i was exploring to happen is to set the NumericUpDown's Maximum property to decimal.MaxValue. Doing so makes the spin buttons of the control behave erratic, when the NumericUpDown's increment is set to 0.1. Under these conditions, clicking on the upwards spin button will set a wrong value of something like 79228162514264337593543950335, instead of incementing the current value by +0.1.
The same attached demo program exhibits this problem, too.
http://bugs.winehq.org/show_bug.cgi?id=31269
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |leslie_alistair@hotmail.com
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #3 from ElGonzo elgonzo@gmx.net 2012-07-21 06:03:26 CDT --- Created attachment 41086 --> http://bugs.winehq.org/attachment.cgi?id=41086 The 'work in progress' application, in which the bug opener experienced the bug originally.
Hello Nikolay,
i came across the problem while writing a small application in .NET and testing it in Wine (actually, this small project is meant as a personal evaluation of the capabilities of the Mono's WinForms port.)
If you are curious about it, you can find it in the attachment of this post. To trigger the problem there, you just need click on the "mm" button in the tool bar. (Beware! The application is still in very early in early development stage -or whatever you like to call it-, and it is largely a non-functional and ugly mess :)
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #4 from ElGonzo elgonzo@gmx.net 2012-07-21 06:12:14 CDT --- I am sorry, i forgot to mention something regarding my application in my previous post:
When clicking the Save button, the software tries to write a file "D:\aa\Kicad.mod". You might need to delete this file manually after playing around with the software. (Did i already mention that my application is a mess?)
http://bugs.winehq.org/show_bug.cgi?id=31269
Vincent Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |dotnet, download
http://bugs.winehq.org/show_bug.cgi?id=31269
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |focht@gmx.net Ever Confirmed|0 |1
--- Comment #5 from Anastasius Focht focht@gmx.net 2012-07-23 16:34:16 CDT --- Hello,
add a test case to "test_VarDecCmp":
http://source.winehq.org/git/wine.git/blob/af3114a5c4c9d69fa34a7dec80fe4e6c3...
like this:
--- snip --- SETDEC(l,3,0,0,123456); SETDEC64(out,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF); MATH1(VarDecCmp); EXPECT_LT; --- snip ---
(overflow in scaling), fix it and you should be fine ;-)
Regards
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #6 from Alistair Leslie-Hughes leslie_alistair@hotmail.com 2013-06-13 03:26:46 CDT --- When VarDecMul(&decTemp, &scaleFactor, pDecOut) is called from VARIANT_DecScale it overflows the value and returns DISP_E_OVERFLOW. Could VarDecDiv be used instead so we don't overflow the DECIAML type?
http://bugs.winehq.org/show_bug.cgi?id=31269
Christopher Cope inuyasha@usa.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |inuyasha@usa.com
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #7 from Christopher Cope inuyasha@usa.com 2013-06-21 16:18:13 CDT --- Created attachment 44898 --> http://bugs.winehq.org/attachment.cgi?id=44898 Error Log
The issue is also present in Dungeons with wine 1.6-rc3. Log attached.
http://bugs.winehq.org/show_bug.cgi?id=31269
Christopher Cope inuyasha@usa.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #44898|Error Log |Dungeons description| |
http://bugs.winehq.org/show_bug.cgi?id=31269
--- Comment #8 from Christopher Cope inuyasha@usa.com 2013-10-21 19:31:13 CDT --- Created attachment 46379 --> http://bugs.winehq.org/attachment.cgi?id=46379 Proposed patch
This is a proposed patch, which fixes this bug.
http://bugs.winehq.org/show_bug.cgi?id=31269
Julian Rüger jr98@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jr98@gmx.net
http://bugs.winehq.org/show_bug.cgi?id=31269
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch Summary|System.OverflowException in |Multiple .NET apps and |.NET application using |games crash with |Decimal data type |System.OverflowException | |(scale overflow in | |VarDecCmp)(Dungeons, Space | |Engineers)
--- Comment #9 from Anastasius Focht focht@gmx.net --- Hello folks,
embarrassingly still present with patch fixing it.
Also affects 'Space Engineers' (Steam): http://store.steampowered.com/app/244850
Was there any attempt on wine-patches to get this in?
If Christopher doesn't have the interest/time, someone take over. It's not that hard.
Regards
http://bugs.winehq.org/show_bug.cgi?id=31269
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
--- Comment #10 from Sebastian Lackner sebastian@fds-team.de --- Hi Anastasius,
the proposed patch is not correct. It only works around the real problem, which is located in a different function (VarDecAdd).
I've written some patches to fix this - it still doesn't match the Windows implementation in all cases, but it should solve this issue. Would be nice if you could confirm that it also works in real-world applications. ;)
The patches are located here: https://github.com/compholio/wine-compholio-daily/tree/master/patches/16-ole...
Thanks!
Regards, Sebastian
http://bugs.winehq.org/show_bug.cgi?id=31269
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Multiple .NET apps and |Multiple .NET apps and |games crash with |games crash with |System.OverflowException |System.OverflowException |(scale overflow in |(incorrect scaling for |VarDecCmp)(Dungeons, Space |DECIMAL values in |Engineers) |VarDecAdd)(Dungeons, Space | |Engineers)
--- Comment #11 from Anastasius Focht focht@gmx.net --- Hello Sebastian,
thanks for the correction. Your patch works fine and fixes the problem with the affected .NET apps.
Regards
http://bugs.winehq.org/show_bug.cgi?id=31269
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |ec218b42181709c26cbb076761c | |345826f2b6353 Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #12 from Anastasius Focht focht@gmx.net --- Hello folks,
this is fixed by commit http://source.winehq.org/git/wine.git/commitdiff/ec218b42181709c26cbb076761c...
Thanks Sebastian
Regards
https://bugs.winehq.org/show_bug.cgi?id=31269
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.22.