Unable to set dark mode - iOS 15.5

I am trying to set my device into darkmode before running a test. To do this I am using the mobile: setAppearance command. I am calling it through the C# client like this:

Driver.ExecuteScript("mobile: setAppearance", new Dictionary<string, object> { { "style", "dark" } });

However I am getting a 404 - unknown command as shown in the logs listed below. I can however get a valid response with the following command:

Driver.ExecuteScript("mobile: getAppearance");

So it could be something to do with the way I am passing parameters in the method? Or perhaps we can’t change the appearance in this version of iOS? Does anyone have experience with this?

See the logs below for error

[debug] [XCUITestDriver@4052 (8dfbf84f)] Calling AppiumDriver.execute() with args: ["mobile: getAppearance",[],"8dfbf84f-70dd-409d-9b8c-46ba91ac7d82"]
[debug] [XCUITestDriver@4052 (8dfbf84f)] Executing command 'execute'
[XCUITestDriver@4052 (8dfbf84f)] Proxying to WDA with an unknown route: GET /wda/device/info
[debug] [XCUITestDriver@4052 (8dfbf84f)] Proxying [GET /wda/device/info] to [GET http://127.0.0.1:8100/session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/device/info] with no body
[debug] [XCUITestDriver@4052 (8dfbf84f)] Got response with status 200: {"value":{"timeZone":"Australia/Sydney","currentLocale":"en_AU","model":"iPad","uuid":"5C4FD562-787D-4EDC-9532-5BD36968366E","thermalState":0,"userInterfaceIdiom":1,"userInterfaceStyle":"light","name":"Ian’s iPad","isSimulator":false},"sessionId":"86AD0811-33D1-4640-AC55-1A2BEED38F03"}
[debug] [XCUITestDriver@4052 (8dfbf84f)] Responding to client with driver.execute() result: {"style":"light"}
[HTTP] <-- POST /session/8dfbf84f-70dd-409d-9b8c-46ba91ac7d82/execute/sync 200 41 ms - 27
[HTTP] 
[debug] [HTTP] Request idempotency key: c5e9b417-ba19-4f8d-98bd-61b01614ee06
[HTTP] --> POST /session/8dfbf84f-70dd-409d-9b8c-46ba91ac7d82/execute/sync
[HTTP] {"script":"mobile: setAppearance","args":[{"style":"dark"}]}
[debug] [XCUITestDriver@4052 (8dfbf84f)] Calling AppiumDriver.execute() with args: ["mobile: setAppearance",[{"style":"dark"}],"8dfbf84f-70dd-409d-9b8c-46ba91ac7d82"]
[debug] [XCUITestDriver@4052 (8dfbf84f)] Executing command 'execute'
[XCUITestDriver@4052 (8dfbf84f)] Proxying to WDA with an unknown route: POST /wda/device/appearance
[debug] [XCUITestDriver@4052 (8dfbf84f)] Proxying [POST /wda/device/appearance] to [POST http://127.0.0.1:8100/session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/device/appearance] with body: {"name":"dark"}
[XCUITestDriver@4052 (8dfbf84f)] Got response with status 404: {"value":{"error":"unknown command","message":"Unhandled endpoint: /session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/device/appearance -- http://127.0.0.1:8100/ with parameters {\n    wildcards =     (\n        \"session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/device/appearance\"\n    );\n}","traceback":""},"sessionId":"86AD0811-33D1-4640-AC55-1A2BEED38F03"}
[debug] [W3C] Matched W3C error code 'unknown command' to UnknownCommandError
[debug] [XCUITestDriver@4052 (8dfbf84f)] UnknownCommandError: Unhandled endpoint: /session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/device/appearance -- http://127.0.0.1:8100/ with parameters {
[debug] [XCUITestDriver@4052 (8dfbf84f)]     wildcards =     (
[debug] [XCUITestDriver@4052 (8dfbf84f)]         "session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/device/appearance"
[debug] [XCUITestDriver@4052 (8dfbf84f)]     );
[debug] [XCUITestDriver@4052 (8dfbf84f)] }
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at errorFromW3CJsonCode (/Users/ian/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:780:25)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at ProxyRequestError.getActualError (/Users/ian/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:663:14)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at JWProxy.command (/Users/ian/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:276:19)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at runMicrotasks (<anonymous>)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at XCUITestDriver.proxyCommand (/Users/ian/.appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:95:12)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at XCUITestDriver.mobileSetAppearance (/Users/ian/.appium/node_modules/appium-xcuitest-driver/lib/commands/appearance.js:42:18)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at XCUITestDriver.executeMobile (/Users/ian/.appium/node_modules/appium-xcuitest-driver/lib/commands/execute.js:161:10)
[debug] [XCUITestDriver@4052 (8dfbf84f)]     at XCUITestDriver.execute (/Users/ian/.appium/node_modules/appium-xcuitest-driver/lib/commands/execute.js:31:12)
[XCUITestDriver@4052 (8dfbf84f)] Proxying to WDA with an unknown route: POST /wda/siri/activate
[debug] [XCUITestDriver@4052 (8dfbf84f)] Proxying [POST /wda/siri/activate] to [POST http://127.0.0.1:8100/session/86AD0811-33D1-4640-AC55-1A2BEED38F03/wda/siri/activate] with body: {"text":"Turn on dark mode"}

Make sure you have the most recent version of WebDriverAgent binary running on the device under test. It might be some older one is cached there, which did not have such API.