Wrong compilation with nullability support
Hi, I have noticed that the target framework changed with the new version. That breaks the nullability annotations.
The issue is that the used preprocessor directive is NET8_0. To prevent similar issues in the future, it should be at least NET8_0_OR_GREATER. https://github.com/zzzprojects/html-agility-pack/blob/8490ad1321e378582aec156668888511d3010b33/src/HtmlAgilityPack.Shared/HtmlNode.Xpath.cs#L41
And since nullable annotations have been available since c# 8, which came with Net Core 3 it might be a good idea to use NET5_0_OR_GREATER. In case someone will lower the target framework again. https://learn.microsoft.com/en-us/dotnet/standard/frameworks#preprocessor-symbols
I can make the PR that will fix the issue, if you like.
- 1.12.0 was a failure for those who use nullability in their projects.
- 1.12.1 was a particular win, as it fixed most of the issues.
- 1.12.2 feels like a step backward again.
This PR should fix it.
https://github.com/zzzprojects/html-agility-pack/pull/598
1.12.1 was a particular win, as it fixed most of the issues
One I bumped into a lot was with the HtmlAttributeCollection:
public HtmlAttribute this[string name]
As the getter returns null if the named attribute does not exist in the collection. Would love to see this updated.