I am migrating my .Net Framework 2.0 Application to .Net Framework 4.0.
In that I am having a program to get Exception Code when an Exception raised. But unfortunately the Exception code varies between .Net Framework 2.0 and .Net Framework 4.0. Below is my Code
try
{
throw new DirectoryNotFoundException();
}
catch (Exception ex)
{
MessageBox.Show(Marshal.GetExceptionCode().ToString());
}
The above program return "-532459699" for .Net Framework 2.0, and it return "-532462766" for .Net Framework 4.0
Is there any way to get the exception code as same as .Net Framework 2.0?