fix(plugins): resolve RPC API calls with omitted or null parameters
GU
25d ago+144+144+012345678901234567890123456789-3-3-0123456789
Fixes #4716
TL;DR
ExecuteFlowLauncherAPIresolved theIPublicAPImethod with an exactGetType()array, so two invocation patterns were impossible from RPC plugins: omitting an optional parameter (no overload with that arity) and passingnull(NullReferenceExceptioninGetType()).- The overload is now resolved by name and arity: supplied arguments must be assignable to their parameter,
nullarguments must sit on a nullable slot, and trailing parameters omitted by the caller must be optional — they are filled with their declared default values on invoke. - Behavior for fully-specified calls is unchanged.
Tests
- New
JsonRPCPluginBaseTest(NUnit + Moq, same stack as the project) with a minimal concrete plugin: omitted optional parameter, explicitnull, fully-specified call, unknown method, and incompatible argument (still silently ignored as before). All 5 pass viadotnet test --filter FullyQualifiedName~JsonRPCPluginBaseTest.
Summary by cubic
Summary of changes
Fixes #4716. ExecuteFlowLauncherAPI in JsonRPCPluginBase previously resolved the IPublicAPI method using an exact GetType() array, which made two invocation patterns impossible from RPC plugins: omitting an optional parameter (no overload matched the arity) and passing null (which threw a NullReferenceException in GetType()). OpenDirectory(path) and OpenDirectory(path, null) were both unusable.
Changed behavior:
- The overload is now resolved by name and arity. Supplied arguments must be assignable to their parameter,
nullarguments must sit on a nullable parameter slot, and trailing parameters omitted by the caller must be optional — they are filled with their declared default values on invoke. - The old exact-type resolution logic is removed. Behavior for fully-specified calls is unchanged.
- No memory usage impact: the reflection-based method scan is transient.
- No new security risks: resolution is limited to the
IPublicAPIinterface. - Added
JsonRPCPluginBaseTest(NUnit + Moq) with a minimal concrete plugin covering omitted optional parameter, explicitnull, fully-specified call, unknown method, and incompatible argument. All 5 tests pass viadotnet test --filter FullyQualifiedName~JsonRPCPluginBaseTest.
Release Note
RPC plugins can now call Flow Launcher API methods that have optional parameters, either by omitting them or passing null.