473,464 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Overflow or underflow in the arithmetic operation error when adding a control to a form

Hi,

When I first installed Visual Studio 2003, I noticed I was getting the
follow error when showing a form:

A first chance exception of type 'System.ArithmeticException' occurred in
system.drawing.dll
Additional information: Overflow or underflow in the arithmetic operation

It is being thrown on the line that attempts to add the controls to the
form's controls collection (in the windows forms designer generated code
region).

Looking at the call stack, the error is occuring on the following method
call:
System.Drawing.Font.Initialize({Name="Microsoft Sans Serif"}, 8.25, Regular,
Point, 0, false)
System.Drawing.Font.Font({Name="Microsoft Sans Serif"}, 8.25, Regular,
Point, 0, false)
System.Windows.Forms.ControlPaint.FontInPoints({Na me="Microsoft Sans Serif"
Size=11.0})
System.Windows.Forms.Control.get_DefaultFont()
System.Windows.Forms.Control.get_Font()
System.Windows.Forms.Control.AssignParent({AMS.UI. Controls.ctlPlantExplorer}
)
System.Windows.Forms.Control.ControlCollection.Add ({System.Windows.Forms.Tre
eView})

I've searched the web for fixes for this and found out that it has something
to do with the FPU. I also found the following workaround:

----------------------
'*************************************************
' FixFPU: Fixes a bug in .net that causes Windows
' forms to mess up if the FPU not set up
'*************************************************
<System.Runtime.InteropServices.DllImport("msvcrt. dll")> _
Private Function _controlfp(ByVal IN_New As Integer, ByVal IN_Mask As
Integer) As Integer
End Function

Private Const _MCW_EW As Integer = &H8001F
Private Const _EM_INVALID As Integer = &H10

Private Sub FixFPU()
_controlfp(_MCW_EW, _EM_INVALID)
End Sub
----------------------

This is all well and good in my own application that I have the source code
for, but the bug seems to affect all .Net applications (C# ones too). If I
install a .net program and try and run it, the program crashes with the same
error.

This problem did go away for a long time on my machine, but it's back now
with a vengance. I haven't installed any major programs or changed the .net
configuration that might have caused this.

I'm using Visual Studio .net 2003 and .Net Framework 1.1. My CPU is an AMD
Athlon. I never had this problem when using the .net Framwork 1.0.

Any help would be appreciated. It's basically crippled my machine as I can't
run any .net apps.

Best Regards,

Trev.
Jul 21 '05 #1
5 8133
Hi Trev.,

Thanks for posting.

This ArithmeticException issue may also be caused by some third-party
software. Some applications change the floating-point control register and
do not reset it. As far as I know, MacroExpress by Insight Software and JS
Pager can cause this.

I would suggest that let's run the application under a clean boot and see
whether we have this problem:

How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

If we do not have the exception under a clean environment, we can isolate
the problem to some extent. If we still have the exception, it is likely
that the register is changed by some system drives. Let's see whether we
have the problem under safe-mode.

I hope the information I have provided here is useful to you. If you have
any concerns or new findings regarding this issue, please feel free to post
here.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Hi Felix,

Hi,

Upon further investigation, it seems that there was a piece of spywhere
running in the background of my machine. Once I removed it, my .net
applications started to work fine again.

It seems that it was changing the FPU mask and hooking into all applications
running on my machine - that's why it was able to cause this problem.
According to John Hornick from Microsoft, the FPU mask is a per process or
per thread setting.

I guess the moral of the story is to be careful of spywhere and using
libraries that change the FPU mask.

Thanks again for your help,

Trev.
"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:DX**************@cpmsftngxa07.phx.gbl...
Hi Trev.,

Thanks for posting.

This ArithmeticException issue may also be caused by some third-party
software. Some applications change the floating-point control register and
do not reset it. As far as I know, MacroExpress by Insight Software and JS
Pager can cause this.

I would suggest that let's run the application under a clean boot and see
whether we have this problem:

How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

If we do not have the exception under a clean environment, we can isolate
the problem to some extent. If we still have the exception, it is likely
that the register is changed by some system drives. Let's see whether we
have the problem under safe-mode.

I hope the information I have provided here is useful to you. If you have
any concerns or new findings regarding this issue, please feel free to post here.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Hi Felix,

Hi,

Upon further investigation, it seems that there was a piece of spywhere
running in the background of my machine. Once I removed it, my .net
applications started to work fine again.

It seems that it was changing the FPU mask and hooking into all applications
running on my machine - that's why it was able to cause this problem.
According to John Hornick from Microsoft, the FPU mask is a per process or
per thread setting.

I guess the moral of the story is to be careful of spywhere and using
libraries that change the FPU mask.

Thanks again for your help,

Trev.
"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:DX**************@cpmsftngxa07.phx.gbl...
Hi Trev.,

Thanks for posting.

This ArithmeticException issue may also be caused by some third-party
software. Some applications change the floating-point control register and
do not reset it. As far as I know, MacroExpress by Insight Software and JS
Pager can cause this.

I would suggest that let's run the application under a clean boot and see
whether we have this problem:

How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

If we do not have the exception under a clean environment, we can isolate
the problem to some extent. If we still have the exception, it is likely
that the register is changed by some system drives. Let's see whether we
have the problem under safe-mode.

I hope the information I have provided here is useful to you. If you have
any concerns or new findings regarding this issue, please feel free to post here.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4
Hi Trev,

Thanks for your feedback. I am glad to hear that the issue is fixed.

I agree with you. It is likely that the spywhere (or spyware?) installs
some global Windows hook in the system.

If you have any further concerns regarding this issue, please feel free to
post here.

Have a nice day!

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5
Hi Trev,

Thanks for your feedback. I am glad to hear that the issue is fixed.

I agree with you. It is likely that the spywhere (or spyware?) installs
some global Windows hook in the system.

If you have any further concerns regarding this issue, please feel free to
post here.

Have a nice day!

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: William Ryan | last post by:
As an experienced Java Programmer, trust me on this, stick with .NET if you are already using it. It's hard to tell based on what you post. Is all of your code wrapped in an exception handler? ...
2
by: Paul Emmons | last post by:
Can anyone suggest example code, or how to proceed, in adding or subtracting two long long integers (I'm working in gcc with Linux, where a long long is 64 bits) and determining whether an overflow...
5
by: Ian Pilcher | last post by:
I'm trying to figure out if an increment to a variable of an integer type, followed by a decrement, (or vice versa) is guaranteed to restore the variable to its initial value, even if the first...
4
by: glenn | last post by:
I have a COM Server I've written in C#. I have a client app I've written in Delphi that is calling the C# COM Server. However, one of the functions in the COM Server creates a form and during the...
4
by: Tom | last post by:
I have a VB.NET framework 1.1 application that I am installing on my user's workstation. It works fine on EVERY machine except for one - on this one machine it generates a 'Overflow or underflow in...
3
by: Codemonkey | last post by:
Hi, When I first installed Visual Studio 2003, I noticed I was getting the follow error when showing a form: A first chance exception of type 'System.ArithmeticException' occurred in...
3
by: jer006 | last post by:
Hi I am writing a select statement that has an arithmetic function inside a case statement that uses logic to decide whether to divide or multiply and when I run the arithmetic statements outside...
4
by: Raymond | last post by:
Source: http://moryton.blogspot.com/2007/08/detecting-overflowunderflow-when.html Example from source: char unsigned augend (255); char unsigned const addend (255); char unsigned const sum...
1
by: thebigsquid | last post by:
hi, its me again, so this software obviously has serious problems. now i'm getting this error message when i try to access any of it! any ideas much appreciated thanks the big squid An...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.