-
Notifications
You must be signed in to change notification settings - Fork 960
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
Some .NET 9 maintenance and JSON encoder improvements #2922
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop/main374 #2922 +/- ##
===================================================
- Coverage 54.89% 0 -54.90%
===================================================
Files 349 0 -349
Lines 66377 0 -66377
Branches 13624 0 -13624
===================================================
- Hits 36437 0 -36437
+ Misses 25957 0 -25957
+ Partials 3983 0 -3983 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 12 changed files in this pull request and generated no comments.
Files not reviewed (7)
- Libraries/Opc.Ua.Security.Certificates/Opc.Ua.Security.Certificates.csproj: Language not supported
- targets.props: Language not supported
- Libraries/Opc.Ua.Security.Certificates/X509Certificate/X509CertificateLoader.cs: Evaluated as low risk
- Tests/Opc.Ua.Core.Tests/Types/Encoders/JsonEncoderEscapeStringBenchmarks.cs: Evaluated as low risk
- Tests/Opc.Ua.Gds.Tests/Common.cs: Evaluated as low risk
- Tests/Opc.Ua.Client.Tests/SubscriptionTest.cs: Evaluated as low risk
- Tests/Opc.Ua.Core.Tests/Security/Certificates/ApplicationTestDataGenerator.cs: Evaluated as low risk
Comments suppressed due to low confidence (1)
Tests/Opc.Ua.Core.Tests/Types/Encoders/EncoderTests.cs:497
- The assertion Assert.IsTrue(nullspan == null) is incorrect because ReadOnlySpan cannot be null.
Assert.IsTrue(nullspan == null);
reduce string binarydecoder memory allocations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 22 out of 35 changed files in this pull request and generated no comments.
Files not reviewed (13)
- Fuzzing/Encoders/Fuzz.Tests/Opc.Ua.Encoders.Fuzz.Tests.csproj: Language not supported
- Libraries/Opc.Ua.Client/Opc.Ua.Client.csproj: Language not supported
- Libraries/Opc.Ua.Security.Certificates/Opc.Ua.Security.Certificates.csproj: Language not supported
- Stack/Opc.Ua.Core/Opc.Ua.Core.csproj: Language not supported
- Tests/Opc.Ua.Client.ComplexTypes.Tests/Opc.Ua.Client.ComplexTypes.Tests.csproj: Language not supported
- Tests/Opc.Ua.Client.Tests/Opc.Ua.Client.Tests.csproj: Language not supported
- Tests/Opc.Ua.Configuration.Tests/Opc.Ua.Configuration.Tests.csproj: Language not supported
- Tests/Opc.Ua.Core.Tests/Opc.Ua.Core.Tests.csproj: Language not supported
- Libraries/Opc.Ua.Client/Session/Session.cs: Evaluated as low risk
- Libraries/Opc.Ua.Client/Subscription/Subscription.cs: Evaluated as low risk
- Stack/Opc.Ua.Core/Types/Encoders/IEncoder.cs: Evaluated as low risk
- Libraries/Opc.Ua.Security.Certificates/X509Certificate/X509CertificateLoader.cs: Evaluated as low risk
- Stack/Opc.Ua.Core/Stack/Types/NotificationMessage.cs: Evaluated as low risk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 21 out of 34 changed files in this pull request and generated 1 comment.
Files not reviewed (13)
- Fuzzing/Encoders/Fuzz.Tests/Opc.Ua.Encoders.Fuzz.Tests.csproj: Language not supported
- Libraries/Opc.Ua.Client/Opc.Ua.Client.csproj: Language not supported
- Libraries/Opc.Ua.Security.Certificates/Opc.Ua.Security.Certificates.csproj: Language not supported
- Stack/Opc.Ua.Core/Opc.Ua.Core.csproj: Language not supported
- Tests/Opc.Ua.Client.ComplexTypes.Tests/Opc.Ua.Client.ComplexTypes.Tests.csproj: Language not supported
- Tests/Opc.Ua.Client.Tests/Opc.Ua.Client.Tests.csproj: Language not supported
- Tests/Opc.Ua.Configuration.Tests/Opc.Ua.Configuration.Tests.csproj: Language not supported
- Tests/Opc.Ua.Core.Tests/Opc.Ua.Core.Tests.csproj: Language not supported
- Tests/Opc.Ua.Client.Tests/SubscriptionTest.cs: Evaluated as low risk
- Tests/Opc.Ua.Core.Tests/Security/Certificates/ApplicationTestDataGenerator.cs: Evaluated as low risk
- Libraries/Opc.Ua.Client/Session/Session.cs: Evaluated as low risk
- Libraries/Opc.Ua.Client/Subscription/Subscription.cs: Evaluated as low risk
- Stack/Opc.Ua.Core/Types/Encoders/IEncoder.cs: Evaluated as low risk
Comments suppressed due to low confidence (8)
Stack/Opc.Ua.Core/Types/Encoders/JsonEncoder.cs:705
- The condition should be 'if (!string.IsNullOrEmpty(fieldName))' to correctly handle null fields.
if (string.IsNullOrEmpty(fieldName))
Stack/Opc.Ua.Core/Types/Encoders/BinaryDecoder.cs:2549
- The error message string formatting should use ServiceResultException.Create for consistency.
throw ServiceResultException.Create(StatusCodes.BadDecodingError, "Reading {0} bytes of {1} reached end of stream after {2} bytes.", length, functionName, bytes.Length);
Stack/Opc.Ua.Core/Types/Encoders/BinaryDecoder.cs:2531
- The error message string formatting should use ServiceResultException.Create for consistency.
throw ServiceResultException.Create(StatusCodes.BadDecodingError, "Reading {0} bytes of {1} reached end of stream after {2} bytes.", length, functionName, bytes.Length);
Stack/Opc.Ua.Core/Types/BuiltIn/NodeId.cs:315
- [nitpick] The error message string should be clear and consistent. Consider rephrasing to 'Invalid NodeId: {0}'.
throw ServiceResultException.Create(StatusCodes.BadNodeIdInvalid, "Invalid NodeId ({0}).", originalText);
Stack/Opc.Ua.Core/Types/BuiltIn/NodeId.cs:323
- [nitpick] The error message string should be clear and consistent. Consider rephrasing to 'No mapping to NamespaceIndex for NamespaceUri: {0}'.
throw ServiceResultException.Create(StatusCodes.BadNodeIdInvalid, "No mapping to NamespaceIndex for NamespaceUri ({0}).", namespaceUri);
Stack/Opc.Ua.Core/Types/BuiltIn/NodeId.cs:335
- [nitpick] The error message string should be clear and consistent. Consider rephrasing to 'Invalid ExpandedNodeId: {0}'.
throw ServiceResultException.Create(StatusCodes.BadNodeIdInvalid, "Invalid ExpandedNodeId ({0}).", originalText);
Stack/Opc.Ua.Core/Types/BuiltIn/NodeId.cs:405
- [nitpick] The error message string should be clear and consistent. Consider rephrasing to 'Invalid NodeId Identifier: {0}'.
throw ServiceResultException.Create(StatusCodes.BadNodeIdInvalid, "Invalid NodeId Identifier ({0}).", originalText);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Thanks @romanett |
common.props
Outdated
@@ -15,7 +16,7 @@ | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | |||
<!-- Highest language version supported by .NET Standard 2.0 and .NET Framework --> | |||
<LangVersion>7.3</LangVersion> | |||
<LangVersion>12</LangVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like VS2019 only supports 9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 38 out of 51 changed files in this pull request and generated no comments.
Files not reviewed (13)
- Fuzzing/Encoders/Fuzz.Tests/Opc.Ua.Encoders.Fuzz.Tests.csproj: Language not supported
- Libraries/Opc.Ua.Client.ComplexTypes/Opc.Ua.Client.ComplexTypes.csproj: Language not supported
- Libraries/Opc.Ua.Client/Opc.Ua.Client.csproj: Language not supported
- Libraries/Opc.Ua.Configuration/Opc.Ua.Configuration.csproj: Language not supported
- Libraries/Opc.Ua.Gds.Client.Common/Opc.Ua.Gds.Client.Common.csproj: Language not supported
- Libraries/Opc.Ua.Gds.Server.Common/Opc.Ua.Gds.Server.Common.csproj: Language not supported
- Libraries/Opc.Ua.PubSub/Opc.Ua.PubSub.csproj: Language not supported
- Libraries/Opc.Ua.Security.Certificates/Opc.Ua.Security.Certificates.csproj: Language not supported
- Libraries/Opc.Ua.Server/Opc.Ua.Server.csproj: Language not supported
- Stack/Opc.Ua.Bindings.Https/Opc.Ua.Bindings.Https.csproj: Language not supported
- Stack/Opc.Ua.Core/Opc.Ua.Core.csproj: Language not supported
- Applications/Quickstarts.Servers/Boiler/BoilerNodeManager.cs: Evaluated as low risk
- Libraries/Opc.Ua.Client/Session/Session.cs: Evaluated as low risk
Comments suppressed due to low confidence (1)
Applications/Quickstarts.Servers/Alarms/AlarmHolders/ConditionTypeHolder.cs:168
- [nitpick] The variable name 'alarm' is ambiguous. It should be renamed to something more descriptive like 'conditionState'.
public void ReportEvent(ConditionState alarm = null)
Proposed changes
This pull request includes various updates and improvements across multiple files. The changes focus on updating package references, enhancing debugging capabilities, and improving code efficiency and readability.
Fixes #2940
Fixes #2931
Package Reference Updates:
NUnit
to version4.3.2
andNUnit.Console
to version3.19.0
inFuzzing/Encoders/Fuzz.Tests/Opc.Ua.Encoders.Fuzz.Tests.csproj
.System.Diagnostics.DiagnosticSource
to version6.0.2
inStack/Opc.Ua.Core/Opc.Ua.Core.csproj
.System.Formats.Asn1
andMicrosoft.Bcl.Cryptography
inLibraries/Opc.Ua.Security.Certificates/Opc.Ua.Security.Certificates.csproj
. [1] [2]Debugging Enhancements:
#if DEBUG
directive to validate publish time and reject old values inSession.cs
.Code Efficiency and Readability:
SaveMessageInCache
method by removing redundant parameters and using object initializers inSubscription.cs
. [1] [2]ServiceResultException.Create
for consistency in error messages inNodeId.cs
. [1] [2] [3]New Features:
MoreNotifications
property toNotificationMessage
andNotificationData
classes to indicate if more notifications are expected. [1] [2]Miscellaneous:
Opc.Ua.Client.csproj
.ReadString
method for performance improvement inBinaryDecoder.cs
.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...