-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
HtmlNode.GetAttributeValue(string name, bool def) not working in version 1.11.32 #437
Comments
Hello @holatom , Thank you for reporting, I improved the code by using the converter code I'm using in another of my project: https://github.com/zzzprojects/Z.ExtensionMethods/blob/master/src/Z.Core/System.Object/Convert/Object.To.cs Everything seems to look fine with this scenario. Could you try it and let me know that we fixed the issue correctly? Best Regards, Jon |
Yes, issue is fixed. |
Awesome @holatom ! We are glad to hear that the issue is fixed! Don't hesitate to contact us with any questions, issues, or feedback. Best regards, Jon |
Calling HtmlNode.GetAttributeValue(string name, bool def) method always returns default value in version 1.11.32 of Html Agility Pack.
The problem is with this code in GetAttributeValue(string name, T def) whitch is called with bool as the T type parameter.
htmlAttribute.Value is for example "true" of type string.
converter is BooleanConverter and calling converter.ConvertTo throws exception:
System.NotSupportedException: 'BooleanConverter' is unable to convert 'System.String' to 'System.Boolean'.
exception is catched by catch block and default value is returned.
The text was updated successfully, but these errors were encountered: