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

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

P: n/a
Hi,

I have a Windows Forms application (VB.NET 2.0) which uses a Class Library
in C#.
The application runs fine, but when I run it in debug mode, I get several "A
first chance exception of type 'System.ArgumentOutOfRangeException' occurred
in mscorlib.dll" -exceptions that are shown in the Immediate window of
Visual Studio 2005.

I want to get rid of these exceptions, but I can(t find where they occur.

Is there a way to put an UnhandledException-handler somewhere in the C#
Class Library? I'm not used to C#, and I can't find a way to do it. It
doesn't have the nice ApplicationEvents-class that my Windows Forms
application has.

Any hints, links or help will be really appreciated!

Thansk a lot in advance,

Pieter
Nov 24 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Pieter" schrieb:
Hi,

I have a Windows Forms application (VB.NET 2.0) which uses a Class
Library in C#.
The application runs fine, but when I run it in debug mode, I get
several "A first chance exception of type
'System.ArgumentOutOfRangeException' occurred in mscorlib.dll"
-exceptions that are shown in the Immediate window of Visual Studio
2005.

I want to get rid of these exceptions, but I can(t find where they
occur.

Is there a way to put an UnhandledException-handler somewhere in the
C# Class Library? I'm not used to C#, and I can't find a way to do
it. It doesn't have the nice ApplicationEvents-class that my Windows
Forms application has.

Any hints, links or help will be really appreciated!

Thansk a lot in advance,

Pieter


From you post I read that the application is running without any
unhandled exceptions outside of a debugger.

Have you "Break on exception thrown" enabled (Debug->Exceptions->Common-
runtime-.. Checkbox on for "thrown") ?
If so, you debbuger will break on any exception that is thrown, no
matter if it was handled or not.

HTH,
Andy

--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40@*NO*SPAM*gmx.net
Nov 24 '05 #2

P: n/a
Thanks! That helps me alreaddy a lot!

And any idea how to add somewhere handler for unhandled exceptions during
runtime? (not debug).

Pieter

"Andreas Mueller" <me@privacy.net> wrote in message
news:3u*************@individual.net...

From you post I read that the application is running without any
unhandled exceptions outside of a debugger.

Have you "Break on exception thrown" enabled (Debug->Exceptions->Common-
runtime-.. Checkbox on for "thrown") ?
If so, you debbuger will break on any exception that is thrown, no
matter if it was handled or not.

HTH,
Andy


Nov 24 '05 #3

P: n/a
"Pieter" schrieb:
Thanks! That helps me alreaddy a lot!

And any idea how to add somewhere handler for unhandled exceptions
during runtime? (not debug).

Pieter

"Andreas Mueller" <me@privacy.net> wrote in message
news:3u*************@individual.net...

From you post I read that the application is running without any
unhandled exceptions outside of a debugger.

Have you "Break on exception thrown" enabled
(Debug->Exceptions->Common- runtime-.. Checkbox on for "thrown") ?
If so, you debbuger will break on any exception that is thrown, no
matter if it was handled or not.

HTH,
Andy


There is a minimum of two events you must hook for a winform app:
System.Windows.Forms.Application.ThreadException
&
System.AppDomain.UnhandledException

HTH, Andy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40@*NO*SPAM*gmx.net
Nov 24 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.