-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #1508. Throw exception when registering invalid extension assembly/type. #1517
Conversation
…gistering an assembly or type with the <extensions> Element (with <nlog throwConfigExceptions='true'>).
Mhhh. I don't get why that one test is not passing with appveyor. |
@@ -406,7 +406,7 @@ private void Initialize(XmlReader reader, string fileName, bool ignoreErrors) | |||
|
|||
if (!ignoreErrors) | |||
{ | |||
if (exception.MustBeRethrown()) | |||
if (configurationException.MustBeRethrown()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good change
Thanks for the PR! On holiday now but i checked it in short, see comments. One unit test is broken, but I'm sure the 2 catches should be restored. I restarted travis-ci.org, it was bugged |
Add two new testcases for invalid extension registration.
Alright, I readded the try-catches. You were right. If they were omitted the node wasn't correctly parsed. |
could you check why InvalidXMLConfiguration_DoesNotThrowErrorWhen_ThrowExceptionFlagIsNotSet fails? |
Mh, I don't get why that test fails on Mono. It passes on my machine. Do you have any recommendations how to debug this? |
I have fixed the unit test and merged the code in #1553 Thanks for the PR! |
It's online! |
Yey, my first PR got merged! |
See issue #1508.
The problem seemed to be that there were multiple try-catches around the methods loading the assemblies, so that the exception did not bubble out of
ParseExtensionsElement(NLogXmlElement extensionsElement, string baseDirectory)
.I removed the try-catches in there, so that a NLogConfigurationException is created in the try-catch in the toplevel method
XmlLoggingConfiguration.Initialize(XmlReader reader, string fileName, bool ignoreErrors)
.Let me know if this fixes the issue and if you see any problems with removing the inner try-catches.