Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

exception e is null c#

//Bug with VS: Exception e == null
//Happens when multiple catch variables are the same
//an example of the solution:
try
{
    // do something
}
catch (WebException webEx) // using a variable named 'webEx' for this catch
{
    Logger.Log("Error while tried to do something. Error: " + webEx.Message); // <-
}
catch (Exception ex) // using a DIFFERENT variable for this one
{
    Logger.Log("Error while tried to do something. Error: " + ex.Message);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #exception #null
ADD COMMENT
Topic
Name
2+7 =