tagged [exception]
Why does the inner exception reach the ThreadException handler and not the actual thrown exception?
Why does the inner exception reach the ThreadException handler and not the actual thrown exception? I'm seeing some wierd behaviour when throwing exceptions and catching them in the `Application.Threa...
- Modified
- 7 Dec at 11:57
Where can I find a list of SocketErrorCode and NativeErrorCode thrown by SocketException?
Where can I find a list of SocketErrorCode and NativeErrorCode thrown by SocketException? A SocketException has a SocketErrorCode and NativeErrorCode. I would like to find a list where these codes (or...
How to Trace all local variables when an exception occurs
How to Trace all local variables when an exception occurs any generic way to trace/log values of all local variables when an exception occurs in a method? (in C# 3)
Why wasn't the Java "throws" clause (in method declaration) included in C#?
Why wasn't the Java "throws" clause (in method declaration) included in C#? Why wasn't the Java "throws" clause (in method declaration) included in C#?
- Modified
- 22 Dec at 10:19
Handling unhandled exceptions problem
Handling unhandled exceptions problem I wanted to set some handler for all the unexpected exceptions that I might not have caught inside my code. In `Program.Main()` I used the following code: But it ...
Thread was being aborted when exporting to excel?
Thread was being aborted when exporting to excel? I have a DataTable which is bound to a GridView. I also have a button that when clicked exports the DataTable to an Excel file. However, the following...
Is this a bad practice to catch a non-specific exception such as System.Exception? Why?
Is this a bad practice to catch a non-specific exception such as System.Exception? Why? I am currently doing a code review and the following code made me jump. I see multiple issues with this code. Do...
Puzzling Enumerable.Cast InvalidCastException
Puzzling Enumerable.Cast InvalidCastException The following throws an `InvalidCastException`. Why? I'm using Visual Studio 2008 SP1.
In C#, how can I serialize System.Exception? (.Net CF 2.0)
In C#, how can I serialize System.Exception? (.Net CF 2.0) I want to write an Exception to an MS Message Queue. When I attempt it I get an exception. So I tried simplifying it by using the XmlSerializ...
- Modified
- 19 Jan at 21:6
What is the best way to communicate that your constructor has failed in C#?
What is the best way to communicate that your constructor has failed in C#? In C# I want to communicate to the calling method that the parameters passed to an object have caused its instantiation to f...
- Modified
- 23 Jan at 01:39
Should Exception Messages be Globalized
Should Exception Messages be Globalized I'm working on a project and I'm just starting to do all the work necessary to globalize the application. One thing that comes up quite often is whether to glob...
- Modified
- 23 Jan at 20:46
Where Should Exception Messages be Stored
Where Should Exception Messages be Stored Since I can't use Microsoft as an example for best practice since their exception messages are stored in resource files out of necessity, I am forced to ask w...
Do I need to create my own InvalidArgumentException.. I couldn't find any builtin type in c#
Do I need to create my own InvalidArgumentException.. I couldn't find any builtin type in c# Do I need to create my own InvalidArgumentException.. I couldn't find any built-in types in c#... Is there ...
ASP.NET Access to the temp directory is denied
ASP.NET Access to the temp directory is denied I'm experiencing this problem today on many different servers. The servers were not touched recently. The only thing that comes in my mind is a windows u...
What's the essential difference between the two HandleException() methods of Exception Handling Application Block (Ent Lib 4.1)
What's the essential difference between the two HandleException() methods of Exception Handling Application Block (Ent Lib 4.1) In the most recent version (4.1, released October 2008) of The Microsoft...
- Modified
- 13 Feb at 21:3
Why use finally in C#?
Why use finally in C#? Whatever is inside finally blocks is executed (almost) always, so what's the difference between enclosing code into it or leaving it unclosed?
NHibernate - not-null property reference a null or transient value
NHibernate - not-null property reference a null or transient value I'm getting this exception (Full exception at the bottom): ``` NHibernate.PropertyValueException was unhandled by user code Message="...
- Modified
- 20 Feb at 02:9
Can you set VS2008 to break on an error inside a try-catch statement
Can you set VS2008 to break on an error inside a try-catch statement One of the things I loved about VB6 is that you had the ability to tell the development environment to break on all errors regardle...
- Modified
- 26 Feb at 21:43
How to handle general exceptions in Asp.Net MVC?
How to handle general exceptions in Asp.Net MVC? I want to transfer all unhandled exceptions to an error page in Asp.Net MVC. What is the way to handle the unhandled exceptions in Asp.net MVC? Is ther...
- Modified
- 6 Mar at 11:36
What exception to throw from a property setter?
What exception to throw from a property setter? I have a string property that has a maximum length requirement because the data is linked to a database. What exception should I throw if the caller tri...
- Modified
- 11 Mar at 10:19
"Exception has been thrown by the target of an invocation" error (mscorlib)
"Exception has been thrown by the target of an invocation" error (mscorlib) I have a website developed in ASP.Net 2.0 that is throwing the error in the production environment. It was not throwing this...
C# Image.Clone Out of Memory Exception
C# Image.Clone Out of Memory Exception Why am I getting an out of memory exception? So this dies in C# on the first time through: Where splitBitmaps is a List BUT this works in VB for at least 4 iter...
The difference between re-throwing parameter-less catch and not doing anything?
The difference between re-throwing parameter-less catch and not doing anything? Suppose I have the following two classes in two different assemblies: ``` //in assembly A public class TypeA { // Const...
C# "Using" Syntax
C# "Using" Syntax Does the using catch the exception or throw it? i.e. If the streamreader throws an exception is it caught by using or thrown so the calling function can handle it?
- Modified
- 11 Apr at 21:52
Will code in a Finally statement fire if I return a value in a Try block?
Will code in a Finally statement fire if I return a value in a Try block? I'm reviewing some code for a friend and say that he was using a return statement inside of a try-finally block. Does the code...