OPCFoundation / UA-.NETStandard

OPC Unified Architecture .NET Standard
Other
1.97k stars 950 forks source link

Client ReadNodes, throw BadInvalidType if a value type returned by an attribute is null #2746

Closed mregen closed 1 month ago

mregen commented 2 months ago

Proposed changes

Handle a case where a misconfigured server returns a null value for an attribute when a value type is expected. To avoid the NullReferenceException that stops the whole ReadNodes operation, flag the Node with the service result and or return a default value if required.

Related Issues

More comprehensive fix for

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

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 62.50000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 54.73%. Comparing base (4bbb062) to head (2613b77). Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
Stack/Opc.Ua.Core/Types/BuiltIn/DataValue.cs 16.66% 6 Missing and 4 partials :warning:
Libraries/Opc.Ua.Client/Session/Session.cs 90.00% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2746 +/- ## ========================================== + Coverage 54.71% 54.73% +0.02% ========================================== Files 349 349 Lines 65683 65695 +12 Branches 13438 13443 +5 ========================================== + Hits 35938 35958 +20 + Misses 25853 25844 -9 - Partials 3892 3893 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.