By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.