-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
XmlElement's constructor should have a nullable prefix parameter. It's declared as:
protected internal XmlElement(string prefix, string localName, string? namespaceURI, XmlDocument doc)
: this(doc.AddXmlName(prefix, localName, namespaceURI, null), true, doc)prefix should be nullable. There are derived classes that have nullable prefixes and they should be able to pass a nullable prefix down to this constructor.
Also, the very first usage of prefix is in doc.AddXmlName which is declared as: internal XmlName AddXmlName(string? prefix, ...
Reproduction Steps
No particular reproduction steps.
Expected behavior
The parameter should be nullable so that derived classes with nullable prefixes can work properly with this constructor.
Actual behavior
Derived classes have to workaround nullability, either by supressing nullable errors, or by using a ! to force non-null.
Regression?
I would say not. No behaviour was changed when annotating this constructor.
Known Workarounds
Derived classes needing this constructor can add damin operators on this parameter, but it needs fixing.
Configuration
No response
Other information
No response