I have a class library that instantiated another class library. For sake of this conversation we will call each class library Class A and Class B
Class A instantiates Class B
Class B has a custom Exception class and will throw this exception while being constructed. The problem is, Class A never gets the exception event though the new is wrapped around a try catch block. I get a unhanded exception in the constructor of class B when I throw the exception.
For example
Class A (License Handle is Class B and has the custom exception class called LicenseNotLoaded)
try
{
m_License = new LicenseHandle();
}
catch (LicenseNotLoaded Ex)
{
Console.WriteLine(Ex);
}Class B
public LicenseHandle()
{
try
{
InitializeObjects();
}
catch (LicenseNotLoaded Ex)
{
// Once I catch the exception, it says it's unhandled at this point when it throws.
throw;
}
}What's the problem?