-
Notifications
You must be signed in to change notification settings - Fork 1k
Immutable built in types and code generation #3534
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
Conversation
Change built in types to readonly structs Update localized text implementation to use JSON text serializer Status code with symbolic names Immutable node ids No boxing for all built in types <= 8 bytes in Variant. Split user identity token and token handling via token handler Add migration guide for breaking changes
Comment out exception throwing for idempotent decoding failure.
Libraries/Opc.Ua.Client.ComplexTypes/TypeResolver/NodeCacheResolver.cs
Outdated
Show resolved
Hide resolved
Tools/Opc.Ua.SourceGeneration.Core/Generators/DataTypeGenerator.cs
Outdated
Show resolved
Hide resolved
Tools/Opc.Ua.SourceGeneration.Core/Generators/ResourceGenerator.cs
Outdated
Show resolved
Hide resolved
Tools/Opc.Ua.SourceGeneration.Core/Generators/NodeStateGenerator.cs
Outdated
Show resolved
Hide resolved
Tools/Opc.Ua.SourceGeneration.Core/Templating/TemplateString.cs
Outdated
Show resolved
Hide resolved
Tools/Opc.Ua.SourceGeneration.Core/Templating/TemplateString.cs
Outdated
Show resolved
Hide resolved
Tools/Opc.Ua.SourceGeneration.Core/Templating/TemplateString.cs
Outdated
Show resolved
Hide resolved
| { | ||
| // transform absolute identifiers. | ||
| if (reference.NodeId?.IsAbsolute == true) | ||
| if (reference.NodeId.IsAbsolute) |
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.
Is IsAbsolute true or false for NullNodeId?
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.
IsNull => !IsAbsolute && m_nodeId.IsNull; So above is ok, but below could remove the IsNull check
| { | ||
| // transform absolute identifiers. | ||
| if (reference.NodeId != null && reference.NodeId.IsAbsolute) | ||
| if (!reference.NodeId.IsNull && reference.NodeId.IsAbsolute) |
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.
Here null is checked first and then IsAbsolute
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.
Will remove in my next PR.
|
|
||
| OpenValidateIdentity( | ||
| ref identity, | ||
| out UserIdentityToken identityToken, |
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.
return IUserIdenntityTokenHandler?
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.
We could, but since it just provides access to the token (without state) it should be ok to just return the token for use later. The state is in the token handler and it has Dispose semantics, and we can keep these very close to the code that uses them (via using).
| { | ||
| throw new ServiceResultException( | ||
| (uint)(StatusCode)ii.Value.Value, | ||
| ii.Value.GetStatusCode(StatusCodes.Bad), |
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.
Why is the StatusCodes.Bad needed?
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.
It is the default if the variant is not a status code. Maybe BadTypeMismatch could make more sense here, but then again, the type mismatch is because the variant has no status code, so I personally like generic Bad here.
| /// <summary> | ||
| /// A class that defines constants used by UA applications. | ||
| /// </summary> | ||
| public static partial class DataTypes |
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.
Is this covered in the migration guide?
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.
No, because it should not make any difference to callers because these "reflection" lookups are now generated.
Change built in types to readonly structs
Update localized text implementation to use JSON text serializer
Status code with symbolic names
Immutable node ids - no boxing for int identifiers (in nodeId struct)
No boxing for all built in types <= 8 bytes in Variant.
Split user identity token and token handling via token handler Add migration guide for breaking changes
Proposed changes
Describe the changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
Related Issues
<Performance Issue>: IsNullTypeId #3533
Fix complex type system test case LoadAllServerDataTypeSystemsAsync(i=92) #3477
Breaking changes migration guide #3425
Getting NodeState for i=68 (PropertyType) returns an object of type BaseDataVariableTypeState #2969
Change implementation of built in types and code generation to generate efficient code leveraging it. #3537
Types of changes
What types of changes does your code introduce?
Put an
xin the boxes that apply. You can also fill these out after creating the PR.Checklist
Put an
xin 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...