-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Location constructor silently cuts off latitude and longitude values #19389
Comments
This is the relevant code: maui/src/Essentials/src/Types/Location.shared.cs Lines 54 to 59 in 9b99433
In Xamarin it looked like this (no limiting/cutting of values there): |
Additional inconsistency: The other maui/src/Essentials/src/Types/Location.shared.cs Lines 67 to 72 in 9b99433
maui/src/Essentials/src/Types/Location.shared.cs Lines 80 to 86 in 9b99433
maui/src/Essentials/src/Types/Location.shared.cs Lines 93 to 99 in 9b99433
|
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
…ssue dotnet#19389) * throw an exception if latitude is out of range * longitude is a cyclic variable, so we project it into a defined range * make all constructors behave the same way (and document the behaviour)
Description
When constructing a
Microsoft.Maui.Devices.Sensors.Location
from a latitude/longitude pair, the constructor silently seems to cut off the values, if they are outside of the expected range:This did not occur with Xamarin.Essentials, and IMHO it is not a good way to deal with this situation. Better options would be:
ArgumentOutOfRangeException
or ...In any case, the behavior and the allowed values should be documented.
Steps to Reproduce
Execute the following test case:
Expected outcome:
0, -160
(or throw an ArgumentOutOfRangeException)Actual outcome:
0, 180
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
macOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: