You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AppiumDriver.Location getter no longer throws NullReferenceException / KeyNotFoundException when the server returns a non-dictionary payload or omits altitude / latitude / longitude.
Values are read with TryGetValue and converted via a TryConvertToDouble helper (CultureInfo.InvariantCulture); missing, null or non-numeric values fall back to 0.0.
Adds AppiumDriverLocationTests (mocked command executor, no device needed) covering numeric, integer/string, missing-key, null, non-numeric, non-convertible, non-dictionary and null-response payloads.
Types of changes
Bugfix (non-breaking change which fixes an issue)
New feature (non-breaking change that adds functionality or value)
Refactoring (non-breaking change that improves code without altering functionality)
Breaking change (fix or feature that would cause existing functionality not to work as expected)
New test coverage (non-breaking change that adds tests for existing, previously untested functionality)
Test fix (non-breaking change that improves test stability or correctness)
Chore/Maintenance (updates to build scripts, dependencies, or GitHub Actions)
Tests
Unit tests
Integration tests
No automated tests (explain why below)
How they run:dotnet test test/integration/Appium.Net.Integration.Tests.csproj --filter "FullyQualifiedName~AppiumDriverLocationTests" (8 tests, no device required, no CI changes needed).
Documentation
Have you proposed a file change/PR with Appium to update documentation?
Not applicable (no user-facing behaviour change, e.g. tests, CI or maintenance only)
Details
Replaces Dor-bl#244, which had drifted from main and carried unrelated changes.
Avoid NullReferenceException/KeyNotFoundException when the server returns a
non-dictionary payload or omits coordinate keys; missing or non-numeric
values fall back to 0.0. Adds unit tests covering these cases.
Reject boolean JSON values before coordinate conversion
src/Appium.Net/Appium/AppiumDriver.cs:332
Convert.ToDouble treats JSON booleans as numeric (true becomes 1.0), so a malformed payload such as { "latitude": true } bypasses the documented 0.0 fallback and returns an invalid coordinate. Reject booleans before conversion and add a regression case for this server response.
AppiumDriverLocationTests live in Appium.Net.Integration.Tests.Driver,
which no CI filter matched, so they never ran. Add Tests.Driver to the
unit-test filters and keep AGENTS.md in sync.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
Boolean coordinate values must be rejected instead of being converted to 1.0.
Review effort: Lite Findings: None
Previously missed (1)
In code that hasn't changed since last review
Reject Boolean values before converting coordinates to double
src/Appium.Net/Appium/AppiumDriver.cs:335
Convert.ToDouble(object, ...) treats a Boolean as a numeric value (true becomes 1.0), so a valid JSON boolean coordinate would return 1.0 instead of the documented fallback of 0.0 for non-numeric values. Reject Boolean values before conversion (and add a regression case) so malformed server payloads cannot produce a coordinate of one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Closes # n/a
List of changes
AppiumDriver.Locationgetter no longer throwsNullReferenceException/KeyNotFoundExceptionwhen the server returns a non-dictionary payload or omitsaltitude/latitude/longitude.TryGetValueand converted via aTryConvertToDoublehelper (CultureInfo.InvariantCulture); missing, null or non-numeric values fall back to0.0.AppiumDriverLocationTests(mocked command executor, no device needed) covering numeric, integer/string, missing-key, null, non-numeric, non-convertible, non-dictionary and null-response payloads.Types of changes
Tests
How they run:
dotnet test test/integration/Appium.Net.Integration.Tests.csproj --filter "FullyQualifiedName~AppiumDriverLocationTests"(8 tests, no device required, no CI changes needed).Documentation
Details
Replaces Dor-bl#244, which had drifted from
mainand carried unrelated changes.