Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 22, 2025

Proposed changes

Fixes validation error when calling OPC UA methods that have only output parameters (no input parameters). The BinaryDecoder.ReadVariantArray() returns null for empty arrays (array length = -1 on wire), causing validation to incorrectly reject these valid method calls.

Changes:

  • Modified MasterNodeManager.ValidateCallRequestItem() to initialize InputArguments to empty collection when null
  • Added test coverage for methods with no input arguments
// Before: Would fail validation
var request = new CallMethodRequest 
{
    ObjectId = objectId,
    MethodId = methodId,
    // InputArguments decoded as null for methods with no inputs
};

// After: Validation initializes to empty collection
callMethodRequest.InputArguments ??= new VariantCollection();

Related Issues

Types of changes

  • 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

  • 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

The fix is minimal and surgical - only modifying validation to handle the null case that occurs during deserialization. All existing tests pass (156/156 Server tests), plus 3 new tests specifically validate the fix.

Original prompt

This section details on the original issue you should resolve

<issue_title>Call Method fail when method has only output parameter</issue_title>
<issue_description>### Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

I need to call a method without input arguments. When I call it, the response is 'BadNothingToDo'. I tried with two different servers and different methods and it doesn't work

Expected Behavior

Return output arguments as UaExpert do.

Steps To Reproduce

No response

Environment

- OS: Windows 10
- Environment:
- Runtime:
- Nuget Version:
- Component:
- Server:
- Client:

Anything else?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 2 commits November 22, 2025 06:30
…only output parameters

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
…ection expressions

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix call method issue with only output parameter Fix: Allow calling methods with only output parameters Nov 22, 2025
Copilot AI requested a review from marcschier November 22, 2025 06:40
@marcschier marcschier marked this pull request as ready for review November 27, 2025 11:50
@romanett
Copy link
Contributor

@marcschier I am not against the fix & the test, but isnt this already fixed by a past decoder update?

@marcschier marcschier merged commit a3b956f into master Dec 1, 2025
173 of 213 checks passed
@romanett romanett deleted the copilot/fix-call-method-output-parameter branch December 1, 2025 08:09
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.

Call Method fail when method has only output parameter

4 participants