That is because, if the file doesn't exist IOException is thrown but not DerivedException. Hence, your catch block will not catch the exception. To test it, you can manually throw an exception of type DerivedException.
public void OpenThisFile()
{
try
{
throw new DerivedException();
}
catch(DerivedException ex)
{
}
}
I hope this helps.
Please mark this post as answer if it solved your problem. Happy Programming!
No comments:
Post a Comment