Closed mtx500 closed 2 months ago
Thanks for the additions. Can you add some simple Unit Tests proving the edge cases are handled correctly on all platforms / build targets?
Attention: Patch coverage is 75.00000%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 54.62%. Comparing base (
414a0d5
) to head (8dcbbde
).
Files | Patch % | Lines |
---|---|---|
Stack/Opc.Ua.Core/Types/Encoders/XmlDecoder.cs | 66.66% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I will create unit testing. As I am doing this the first time, it takes a little bit ...
Should be finished and OK now. The still failing tests seem to me not being effected by my changes.
@opcfoundation-org as this change may affect nodeset generation please code review this change to Xml encoder and decoder.
Proposed changes
In OPC UA the serialization of floating point values to XML just follows the XML Schema specification (see https://www.w3.org/TR/xmlschema-2/#float). It is sufficient to use the correct .NET XML classes (XmlReader, XmlWriter, XmlConvert). There is no need to treat the special values Infinity, negative Infinity and Not-a-number in special way.
XmlWriter uses XmlConvert internally (see https://referencesource.microsoft.com/#System.Xml/System/Xml/Core/XmlWriter.cs and https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlWriter.cs), and XmlConvert (see https://referencesource.microsoft.com/#System.Xml/System/Xml/XmlConvert.cs and https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.Xml/src/System/Xml/XmlConvert.cs) first takes care of "INF" and "-INF" and then uses the Single / Double routines with the appropriate flags and culture set so that "NaN" is also taken care of.
BTW, the removed code parts were inconsistent:
Types of changes
What types of changes does your code introduce? Put an
x
in the boxes that apply. You can also fill these out after creating the PR.Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments