Take the 2-minute tour ×

How can one get detailed Exception thrown by the .net framework. The below log fragment shows something is wrong but what?

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

Unfortunately I can not catch this exception so I can not debug. Is there a way to get a detailed information about such exceptions? May be some tools etc.


share|improve this question
Why can you not catch the exception? –  Ian Jul 26 '10 at 8:09
Sometimes, exceptions and their messages can be complex, confusing, unclear, or just plain useless. This is not one of them. –  Willem van Rumpt Jul 26 '10 at 8:13
@Ian - Because it is not me accessing to the file, it is .net framework. –  whoi Jul 26 '10 at 8:33
add comment

4 Answers

up vote 1 down vote accepted

Are you using Visual Studio (2008)?
Then you could catch any exception, even if it is not handled by your code, using the Exceptions options dialog in the Debug/Exceptions menu.

share|improve this answer
This is good news, I will try it immediately. –  whoi Jul 26 '10 at 8:33
This was pretty good answer, thanks –  whoi Jul 26 '10 at 9:56
add comment

First, FileNotFoundExceptions is blunt clear.

Second, use try...catch blocks when ANY code depends on reading a file on disk.

For more information, read about catching exceptions and what to do (normally tell the user the file was not found).

share|improve this answer
add comment

I think its worth also looking at what the difference is between first and second chance exceptions. http://support.microsoft.com/kb/105675 explains it in detail but in brief a first chance exception is thrown the moment an exception is thrown. That is before any attempt has been made to handle it through try/catch statements. This is likely to mean that the framework caught the exception and did something else appropriate, etc.

This generally means that first chance exceptions are not things to worry about, only worry about other people's code throwing exceptions if they make it as far as your code, otherwise trust in their error handling.

share|improve this answer
add comment

The fact that you have a log implies something is logging the exception. What are you using to log the exception? It sounds as though it may be logging just Exception.Message rather than Exception.ToString().

share|improve this answer
add comment

Your Answer


