In our organization, we break when exceptions are thrown. This allows us to improve our code by eliminating exception-throwing as much as possible. Not a problem for our customers, but we don't want to turn this off for our developers, who use it to find problems in the code.
Because of this, we discovered that the Dock code always throws an exception when deserializing the layout because it's trying to create an Image type. Image is abstract, so it throws an exception, catches it, and continues on its way. The code below (from ComponnentXmlSerializer.cs) could be improved by first checking if the type has a paramterless constructor, and then not catching the MissingMethodException. This would speed up deserialization and let us keep "break on exceptions" turned on.
Because of this, we discovered that the Dock code always throws an exception when deserializing the layout because it's trying to create an Image type. Image is abstract, so it throws an exception, catches it, and continues on its way. The code below (from ComponnentXmlSerializer.cs) could be improved by first checking if the type has a paramterless constructor, and then not catching the MissingMethodException. This would speed up deserialization and let us keep "break on exceptions" turned on.
try
{
newInstance =
this
.InstanceFactory.CreateInstance(type);
}
catch
(TargetInvocationException)
{
return
;
}
catch
(MissingMethodException)
{
return
;
}