Skip to content

Conversation

@marcschier
Copy link
Collaborator

@marcschier marcschier commented Feb 9, 2026

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

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.

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

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.

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

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...

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
@marcschier marcschier changed the title TESTING/DRAFT Generate stack and application code using source generators TESTING/DRAFT Immutable built in types and code generation Feb 9, 2026
@marcschier marcschier self-assigned this Feb 9, 2026
Comment out exception throwing for idempotent decoding failure.
@marcschier marcschier marked this pull request as ready for review February 11, 2026 13:50
@marcschier marcschier changed the title TESTING/DRAFT Immutable built in types and code generation Immutable built in types and code generation Feb 11, 2026
@marcschier marcschier requested a review from koepalex February 11, 2026 13:51
{
// transform absolute identifiers.
if (reference.NodeId?.IsAbsolute == true)
if (reference.NodeId.IsAbsolute)
Copy link
Contributor

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?

Copy link
Collaborator Author

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)
Copy link
Contributor

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

Copy link
Collaborator Author

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return IUserIdenntityTokenHandler?

Copy link
Collaborator Author

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),
Copy link
Contributor

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?

Copy link
Collaborator Author

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
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@marcschier marcschier merged commit f66ceff into master Feb 12, 2026
142 checks passed
@marcschier marcschier deleted the sgen branch February 12, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants