Skip to content

[Essentials] Use mean sea level altitude on Android API 34+#35097

Merged
kubaflo merged 7 commits into
dotnet:inflight/candidatefrom
KitKeen:feature/geolocation-msl-altitude
May 13, 2026
Merged

[Essentials] Use mean sea level altitude on Android API 34+#35097
kubaflo merged 7 commits into
dotnet:inflight/candidatefrom
KitKeen:feature/geolocation-msl-altitude

Conversation

@KitKeen

@KitKeen KitKeen commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #27554.

Android API level 34 introduced
Location.getMslAltitudeMeters(),
which reports altitude measured against the geoid (mean sea level).
The existing implementation always reads the WGS84 ellipsoidal
altitude, which is reported inconsistently with iOS and Windows where
altitude is typically expressed against the geoid. As the issue notes,
this forces consumers to apply manual geoid corrections to get
consistent results across platforms.

This change updates LocationExtensions.android.cs to:

  1. Prefer MslAltitudeMeters when the device runs Android 34+ and
    HasMslAltitude is true, reporting
    AltitudeReferenceSystem.Geoid.
  2. Fall back to the existing Altitude / Ellipsoid path on older
    devices or when MSL altitude is not available.
  3. Report AltitudeReferenceSystem.Unspecified when no altitude is
    available at all (previously this case was reported as
    Ellipsoid even though Altitude was null).

The MSL preference is opaque to callers — Location.Altitude keeps
the same shape and semantics; consumers that care about the reference
system can inspect AltitudeReferenceSystem as before.

Issues Fixed

Fixes #27554

Tested

  • Code change is guarded by OperatingSystem.IsAndroidVersionAtLeast(34)
    so older devices are unaffected.
  • Device validation for Android 34+ devices to confirm MslAltitudeMeters
    is surfaced will rely on existing Geolocation_Tests.cs device tests
    exercised on CI.

Android API level 34 introduced Location.getMslAltitudeMeters(), which
provides altitude measured against the geoid (mean sea level). The
existing implementation always reads the WGS84 ellipsoidal altitude,
which is reported inconsistently with iOS/Windows where altitude is
typically expressed against the geoid.

Prefer the MSL altitude when the device exposes it (API 34+ and
HasMslAltitude is true) and report AltitudeReferenceSystem.Geoid in
that case. Fall back to the existing WGS84 path on older devices.

Also reports AltitudeReferenceSystem.Unspecified when no altitude is
available, instead of hard-coding Ellipsoid for a null altitude.

Fixes dotnet#27554
@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35097

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35097"

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Apr 22, 2026
@kubaflo

kubaflo commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

🟠 .NET MAUI Code Review — Discussion Needed

👋 @KitKeen — new code review results are available. Please review the latest session below.

🟠 Review Session — Discussion Needed63444de · [Essentials] Use mean sea level altitude on Android API 34+ · 2026-04-23 10:10 UTC

Code Review — PR #35097

Independent Assessment

What this changes: Refactors ToLocation(AndroidLocation) to delegate altitude selection to a new GetAltitude helper. On Android API 34+ with HasMslAltitude == true, returns MslAltitudeMeters paired with AltitudeReferenceSystem.Geoid; otherwise falls back to the existing Altitude/Ellipsoid; otherwise returns (null, Unspecified).

Inferred motivation: Bring Android altitude semantics in line with iOS (always Geoid) and Windows (passes WinRT's own reference through), so cross-platform consumers no longer need a manual geoid correction on Android. Also corrects an incoherent prior state where Altitude == null was paired with AltitudeReferenceSystem.Ellipsoid.

Reconciliation with PR Narrative

The PR description matches the implementation. One inaccuracy: it claims existing Geolocation_Tests.cs device tests will exercise the new branch, but those tests only assert Latitude/Longitude/Accuracy — they never look at Altitude or AltitudeReferenceSystem, so the new path is effectively untested.

Findings

⚠️ Warning — VerticalAccuracy is sourced from the ellipsoidal accuracy even when Altitude is MSL (flagged by both reviewing models — Claude Sonnet 4.6 and GPT-5.4)

src/Essentials/src/Types/LocationExtensions.android.cs:30-32 still reads VerticalAccuracyMeters (API 26+), which Android documents as the uncertainty of getAltitude() (ellipsoidal). On API 34+ the framework also exposes HasMslAltitudeAccuracy / MslAltitudeAccuracyMeters as the matching uncertainty for getMslAltitudeMeters().

After this PR, an API-34+ caller can receive Altitude (MSL/geoid) paired with VerticalAccuracy from a different reference system. In practice the two values are usually close on consumer GPS chipsets, so the user-visible impact is small, but it is a semantic inconsistency that is trivial to fix in the same helper. Suggested shape:

VerticalAccuracy =
    OperatingSystem.IsAndroidVersionAtLeast(34) && location.HasMslAltitudeAccuracy
        ? location.MslAltitudeAccuracyMeters
        : OperatingSystem.IsAndroidVersionAtLeast(26) && location.HasVerticalAccuracy
            ? location.VerticalAccuracyMeters
            : null,

Ideally the MSL-vs-ellipsoid choice for altitude and accuracy should be made together in GetAltitude so the two values can never diverge.

💡 Suggestion — Add coverage for the new altitude paths

The three branches in GetAltitude (MSL → Geoid, ellipsoid → Ellipsoid, none → Unspecified) are not exercised by any test. Existing device tests under src/Essentials/test/DeviceTests/Tests/Geolocation_Tests.cs don't assert on Altitude or AltitudeReferenceSystem. Even a lightweight device test that constructs a synthetic Android.Locations.Location and asserts the resulting AltitudeReferenceSystem would be enough to lock in the new behavior and prevent regressions on the Ellipsoid → Unspecified change.

💡 Suggestion — Behavior change on the no-altitude path

Pre-existing behavior returned (null, Ellipsoid) when HasAltitude was false; the new code returns (null, Unspecified). This is a strict improvement (the prior pairing was incoherent and the Windows path already uses Unspecified for the same case). Just calling it out so it lands in release notes — any consumer that conditioned on AltitudeReferenceSystem == Ellipsoid as a sentinel for "Android" will now see Unspecified when there is no fix.

Devil's Advocate

  • API 34 guard correctness: The OperatingSystem.IsAndroidVersionAtLeast(34) && location.HasMslAltitude pattern matches the existing HasVerticalAccuracy (API 26) and Mock (API 31) usages in the same file, and CA1416 will be satisfied via short-circuit. No platform analyzer suppression is needed. ✅
  • Blast radius of Ellipsoid → Unspecified: No internal MAUI consumer in this repo depends on the old sentinel; the only AltitudeReferenceSystem use outside the conversion is GeolocationViewModel.ToString(). External consumers' behavior is unverifiable, but the previous state was indefensible.
  • Cross-platform parity: This actually improves Android↔iOS alignment, which is the issue's stated goal.

Verdict: NEEDS_DISCUSSION (lean LGTM)

Confidence: medium-high
Summary: Direction is correct and the API gating is sound. Two reviewing models independently flagged the VerticalAccuracy/MSL mismatch — Sonnet rated it a non-blocking warning, GPT rated it a blocker. I'd suggest either addressing it in this PR (small change, same helper) or filing a follow-up issue and merging. The missing test coverage is consistent with the rest of the geolocation code, but adding even one assertion on AltitudeReferenceSystem would substantially de-risk this change.


Multi-model review: independently performed by Claude Sonnet 4.6 and GPT-5.4. Both models reached the same primary finding (VerticalAccuracy/MSL mismatch) with different severity calibrations.


@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Apr 23, 2026
@dotnet dotnet deleted a comment from MauiBot Apr 23, 2026
KitKeen added 2 commits April 24, 2026 01:01
Address review feedback on dotnet#35097. Previously VerticalAccuracy was
always read from Location.VerticalAccuracyMeters (ellipsoidal
accuracy), regardless of whether Altitude came from the MSL/geoid or
WGS84/ellipsoid path. On Android API 34+ with MSL altitude, this
produced an altitude and a vertical accuracy in different reference
systems.

Select altitude and its accuracy together in GetAltitude so they can
never diverge:

- MSL path (API 34+ && HasMslAltitude): altitude from
  MslAltitudeMeters, accuracy from MslAltitudeAccuracyMeters when
  HasMslAltitudeAccuracy is true, else null.
- Ellipsoid path (HasAltitude): altitude from Altitude, accuracy from
  VerticalAccuracyMeters when API 26+ and HasVerticalAccuracy.
- No altitude: (null, Unspecified, null).

Add device tests covering all three GetAltitude branches and the
MSL-without-MSL-accuracy case.
The existing TestLocation_EllipsoidalAltitude_UsesEllipsoidReferenceSystem
test happened to exercise the fallback because MslAltitudeMeters was never
set, but that was implicit. This adds a dedicated test that pins the
invariant: on API 34+ where HasMslAltitude is false (e.g. the device did
not report a reference-corrected altitude), ToLocation falls back to the
ellipsoidal altitude and tags it Ellipsoid — not Geoid, not Unspecified.

This is the second half of the IsAndroidVersionAtLeast(34) && HasMslAltitude
guard added in the previous commit; without an explicit test, a refactor
that dropped the HasMslAltitude check would still pass the suite.
@MauiBot MauiBot added the s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates label Apr 24, 2026
@dotnet dotnet deleted a comment from MauiBot Apr 24, 2026

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please review ai's suggestions?

Each test now runs at least one assertion on any API level before the
API 34+ specific branch, so pre-34 runs exercise the fallback path
(Ellipsoid or Unspecified) instead of returning early without asserting.
This keeps the gate test meaningful on devices below API 34 and catches
regressions in either code path.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review — alternative fix proposed

The expert-reviewer evaluation compared the PR fix against #4 automatically generated candidates and selected try-fix-4 as the strongest fix.

Why: try-fix-4 wins because it combines the PR's correct GetAltitude helper with two critical additions the PR omits: (1) a one-line fix in the Location(Location point) copy constructor that was missing AltitudeReferenceSystem = point.AltitudeReferenceSystem — without this, Geocoding.GetPlacemarksAsync silently resets the reference system on Android 34+; (2) a regression test (LocationCopyConstructor_CopiesAltitudeReferenceSystem) that protects against that bug recurring. It also removes the byte-for-byte duplicate test.

Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.

Candidate diff (`try-fix-4`)
diff --git a/src/Essentials/src/Types/Location.shared.cs b/src/Essentials/src/Types/Location.shared.cs
index 892cf582d4..cf5bb4caec 100644
--- a/src/Essentials/src/Types/Location.shared.cs
+++ b/src/Essentials/src/Types/Location.shared.cs
@@ -109,6 +109,7 @@ namespace Microsoft.Maui.Devices.Sensors
 			Speed = point.Speed;
 			Course = point.Course;
 			IsFromMockProvider = point.IsFromMockProvider;
+			AltitudeReferenceSystem = point.AltitudeReferenceSystem;
 		}
 
 		/// <summary>
diff --git a/src/Essentials/src/Types/LocationExtensions.android.cs b/src/Essentials/src/Types/LocationExtensions.android.cs
index 7c3d664b94..ceb72cc9a9 100644
--- a/src/Essentials/src/Types/LocationExtensions.android.cs
+++ b/src/Essentials/src/Types/LocationExtensions.android.cs
@@ -19,18 +19,18 @@ namespace Microsoft.Maui.Devices.Sensors
 		internal static IEnumerable<Location> ToLocations(this IEnumerable<AndroidAddress> addresses) =>
 			addresses?.Select(a => a.ToLocation());
 
-		internal static Location ToLocation(this AndroidLocation location) =>
-			new Location
+		internal static Location ToLocation(this AndroidLocation location)
+		{
+			var (altitude, altitudeReference, verticalAccuracy) = GetAltitude(location);
+
+			return new Location
 			{
 				Latitude = location.Latitude,
 				Longitude = location.Longitude,
-				Altitude = location.HasAltitude ? location.Altitude : default(double?),
+				Altitude = altitude,
 				Timestamp = location.GetTimestamp().ToUniversalTime(),
 				Accuracy = location.HasAccuracy ? location.Accuracy : default(float?),
-				VerticalAccuracy =
-					OperatingSystem.IsAndroidVersionAtLeast(26) && location.HasVerticalAccuracy
-						? location.VerticalAccuracyMeters
-						: null,
+				VerticalAccuracy = verticalAccuracy,
 				ReducedAccuracy = false,
 				Course = location.HasBearing ? location.Bearing : default(double?),
 				Speed = location.HasSpeed ? location.Speed : default(double?),
@@ -40,8 +40,35 @@ namespace Microsoft.Maui.Devices.Sensors
 #pragma warning disable CS0618 // Type or member is obsolete
 						: location.IsFromMockProvider,
 #pragma warning restore CS0618 // Type or member is obsolete
-				AltitudeReferenceSystem = AltitudeReferenceSystem.Ellipsoid
+				AltitudeReferenceSystem = altitudeReference
 			};
+		}
+
+		// Prefer mean sea level altitude (Android API 34+) when available so altitude
+		// values are consistent across platforms without manual geoid correction.
+		// Altitude and its accuracy are selected together so they always come from
+		// the same reference system (MSL/geoid vs WGS84/ellipsoid).
+		static (double? Altitude, AltitudeReferenceSystem Reference, double? VerticalAccuracy) GetAltitude(AndroidLocation location)
+		{
+			if (OperatingSystem.IsAndroidVersionAtLeast(34) && location.HasMslAltitude)
+			{
+				double? mslAccuracy = location.HasMslAltitudeAccuracy
+					? location.MslAltitudeAccuracyMeters
+					: null;
+				return (location.MslAltitudeMeters, AltitudeReferenceSystem.Geoid, mslAccuracy);
+			}
+
+			if (location.HasAltitude)
+			{
+				double? ellipsoidAccuracy =
+					OperatingSystem.IsAndroidVersionAtLeast(26) && location.HasVerticalAccuracy
+						? location.VerticalAccuracyMeters
+						: null;
+				return (location.Altitude, AltitudeReferenceSystem.Ellipsoid, ellipsoidAccuracy);
+			}
+
+			return (null, AltitudeReferenceSystem.Unspecified, null);
+		}
 
 		static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 
diff --git a/src/Essentials/test/DeviceTests/Tests/Android/Geolocation_Tests.cs b/src/Essentials/test/DeviceTests/Tests/Android/Geolocation_Tests.cs
index 9742e83aad..f07e37b7e8 100644
--- a/src/Essentials/test/DeviceTests/Tests/Android/Geolocation_Tests.cs
+++ b/src/Essentials/test/DeviceTests/Tests/Android/Geolocation_Tests.cs
@@ -42,33 +42,6 @@ namespace Microsoft.Maui.Essentials.DeviceTests.Shared
 				Assert.Null(location.VerticalAccuracy);
 	}
 
-	[Fact]
-	public void ToLocation_HasAltitudeButNoMslAltitude_UsesEllipsoid()
-	{
-		// On every API level, a location that reports an ellipsoidal altitude but no
-		// MSL altitude must resolve to Ellipsoid. On pre-34 devices that is the only
-		// code path; on API 34+ devices this exercises the HasMslAltitude == false
-		// fallback branch. Either way this assertion runs, so the test cannot silently
-		// pass if the fallback regresses.
-		var androidLocation = new AndroidLocation("test")
-		{
-			Altitude = 123.45,
-		};
-
-		if (OperatingSystem.IsAndroidVersionAtLeast(26))
-			androidLocation.VerticalAccuracyMeters = 5.0f;
-
-		var location = androidLocation.ToLocation();
-
-		Assert.Equal(123.45, location.Altitude);
-		Assert.Equal(AltitudeReferenceSystem.Ellipsoid, location.AltitudeReferenceSystem);
-
-		if (OperatingSystem.IsAndroidVersionAtLeast(26))
-			Assert.Equal(5.0, location.VerticalAccuracy);
-		else
-			Assert.Null(location.VerticalAccuracy);
-	}
-
 	[Fact]
 	public void ToLocation_MslAltitude_UsesGeoidReferenceSystem()
 	{
@@ -130,5 +103,30 @@ namespace Microsoft.Maui.Essentials.DeviceTests.Shared
 			Assert.Equal(AltitudeReferenceSystem.Geoid, location.AltitudeReferenceSystem);
 			Assert.Null(location.VerticalAccuracy);
 		}
+
+	[Fact]
+	public void LocationCopyConstructor_CopiesAltitudeReferenceSystem()
+	{
+		var originalLocation = new Location
+		{
+			Latitude = 37.7749,
+			Longitude = -122.4194,
+			Altitude = 100.0,
+			AltitudeReferenceSystem = AltitudeReferenceSystem.Geoid,
+			VerticalAccuracy = 2.5
+		};
+
+		var copiedLocation = new Location(originalLocation);
+
+		Assert.Equal(originalLocation.Latitude, copiedLocation.Latitude);
+		Assert.Equal(originalLocation.Longitude, copiedLocation.Longitude);
+		Assert.Equal(originalLocation.Altitude, copiedLocation.Altitude);
+		Assert.Equal(AltitudeReferenceSystem.Geoid, copiedLocation.AltitudeReferenceSystem);
+		Assert.Equal(originalLocation.VerticalAccuracy, copiedLocation.VerticalAccuracy);
+	}
 	}
 }

@MauiBot MauiBot added s/agent-fix-win AI found a better alternative fix than the PR and removed s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates labels Apr 30, 2026

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please try the ai's suggestions?

@dotnet dotnet deleted a comment from MauiBot May 1, 2026
@kubaflo kubaflo dismissed MauiBot’s stale review May 1, 2026 09:39

Resetting for re-review

MauiBot
MauiBot previously requested changes May 1, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review — alternative fix proposed

The expert-reviewer evaluation compared the PR fix against #1 automatically generated candidates and selected try-fix-1 as the strongest fix.

Why: try-fix-1 (inline set-defaults-then-override) is functionally equivalent to the PR's GetAltitude() helper but inlined into ToLocation() with plain local variables. It is the simplest approach, passes all 5 device tests, and avoids any helper-method linker sensitivity that may have contributed to the gate failure on the PR's version.

Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.

Candidate diff (`try-fix-1`)
diff --git a/src/Essentials/src/Types/LocationExtensions.android.cs b/src/Essentials/src/Types/LocationExtensions.android.cs
index 7c3d664b94..370bf854c6 100644
--- a/src/Essentials/src/Types/LocationExtensions.android.cs
+++ b/src/Essentials/src/Types/LocationExtensions.android.cs
@@ -19,18 +19,40 @@ namespace Microsoft.Maui.Devices.Sensors
 		internal static IEnumerable<Location> ToLocations(this IEnumerable<AndroidAddress> addresses) =>
 			addresses?.Select(a => a.ToLocation());
 
-		internal static Location ToLocation(this AndroidLocation location) =>
-			new Location
+		internal static Location ToLocation(this AndroidLocation location)
+		{
+			// Default to no altitude with Unspecified reference; override below
+			// when the platform reports a usable value.
+			double? altitude = null;
+			AltitudeReferenceSystem altitudeRef = AltitudeReferenceSystem.Unspecified;
+			double? verticalAccuracy = null;
+
+			// Prefer mean-sea-level altitude (API 34+) for cross-platform consistency.
+			if (OperatingSystem.IsAndroidVersionAtLeast(34) && location.HasMslAltitude)
+			{
+				altitude = location.MslAltitudeMeters;
+				altitudeRef = AltitudeReferenceSystem.Geoid;
+				verticalAccuracy = location.HasMslAltitudeAccuracy
+					? location.MslAltitudeAccuracyMeters
+					: null;
+			}
+			else if (location.HasAltitude)
+			{
+				altitude = location.Altitude;
+				altitudeRef = AltitudeReferenceSystem.Ellipsoid;
+				verticalAccuracy = OperatingSystem.IsAndroidVersionAtLeast(26) && location.HasVerticalAccuracy
+					? location.VerticalAccuracyMeters
+					: null;
+			}
+
+			return new Location
 			{
 				Latitude = location.Latitude,
 				Longitude = location.Longitude,
-				Altitude = location.HasAltitude ? location.Altitude : default(double?),
+				Altitude = altitude,
 				Timestamp = location.GetTimestamp().ToUniversalTime(),
 				Accuracy = location.HasAccuracy ? location.Accuracy : default(float?),
-				VerticalAccuracy =
-					OperatingSystem.IsAndroidVersionAtLeast(26) && location.HasVerticalAccuracy
-						? location.VerticalAccuracyMeters
-						: null,
+				VerticalAccuracy = verticalAccuracy,
 				ReducedAccuracy = false,
 				Course = location.HasBearing ? location.Bearing : default(double?),
 				Speed = location.HasSpeed ? location.Speed : default(double?),
@@ -40,8 +62,9 @@ namespace Microsoft.Maui.Devices.Sensors
 #pragma warning disable CS0618 // Type or member is obsolete
 						: location.IsFromMockProvider,
 #pragma warning restore CS0618 // Type or member is obsolete
-				AltitudeReferenceSystem = AltitudeReferenceSystem.Ellipsoid
+				AltitudeReferenceSystem = altitudeRef
 			};
+		}
 
 		static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

@dotnet dotnet deleted a comment from MauiBot May 8, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 3 findings

See inline comments for details.

[Category("Android Geolocation")]
public class Android_Geolocation_Tests
{
[Fact]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error — [Category("Android Geolocation")] contains a space, which breaks Android device-test execution.

When Run-DeviceTests.ps1 (or XHarness directly) forwards the filter as --arg TestFilter=Category=Android Geolocation, the unquoted space causes Android's am instrument to tokenize the value: only Android reaches the TestFilter argument, and Geolocation becomes a stray positional that the runner interprets as the instrumentation name, producing:

Error: No instrumentation found for: Geolocation

This is precisely the failure the gate captured (exitCode 82, RETURN_CODE_NOT_SET). Although the existing Windows test files use space-bearing categories (e.g. "Windows ActiveWindowTracker"), Android+XHarness does not survive that quoting and all Android category names in this project are space-free (Geolocation, Vibration, Accelerometer, …).

Fix: Drop the space, e.g. [Category("AndroidGeolocation")]. The gate's TestFilter=Category=AndroidGeolocation would then survive tokenization and the new tests would actually be executed.

using Xunit;
using AndroidLocation = Android.Locations.Location;

namespace Microsoft.Maui.Essentials.DeviceTests.Shared

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning — namespace inconsistency with the rest of Essentials.DeviceTests.

The existing tests in this project (e.g. Geolocation_Tests.cs, AppInfo_Tests.cs) use namespace Microsoft.Maui.Essentials.DeviceTests. This new file uses Microsoft.Maui.Essentials.DeviceTests.Shared, which doesn't match anything else in the project and creates needless cognitive friction. Recommend Microsoft.Maui.Essentials.DeviceTests (or .Android if you want a per-platform sub-namespace) for consistency.

Longitude = point.Longitude;
Timestamp = DateTime.UtcNow;
Altitude = point.Altitude;
AltitudeReferenceSystem = point.AltitudeReferenceSystem;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Suggestion — release-note this behavior change.

Adding AltitudeReferenceSystem to the copy constructor is correct (the previous omission was a latent bug — copies were silently coerced to the default Unspecified). Worth calling out in release notes alongside the Android Ellipsoid → Unspecified change so consumers know to re-check any code that compared AltitudeReferenceSystem after copying a Location.

@MauiBot MauiBot added s/agent-review-incomplete and removed s/agent-changes-requested AI agent recommends changes - found a better alternative or issues labels May 8, 2026
@dotnet dotnet deleted a comment from MauiBot May 11, 2026
- Remove space from Category attribute ('Android Geolocation' →
  'Geolocation') to prevent XHarness/am instrument tokenization
  failure on Android device tests.
- Fix namespace to 'Microsoft.Maui.Essentials.DeviceTests' matching
  the convention used by all other test files in this project.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo force-pushed the feature/geolocation-msl-altitude branch from 0becb25 to e3852b6 Compare May 12, 2026 13:03
@kubaflo

kubaflo commented May 12, 2026

Copy link
Copy Markdown
Contributor

/azp run maui-pr

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

- Remove duplicate ToLocation_HasAltitudeButNoMslAltitude_UsesEllipsoid
  (identical to ToLocation_EllipsoidalAltitude_UsesEllipsoidReferenceSystem)
- Keep LocationCopyConstructor_PreservesAltitudeReferenceSystem in the
  Android test file

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo force-pushed the feature/geolocation-msl-altitude branch from e3852b6 to d711d26 Compare May 12, 2026 13:24
@dotnet dotnet deleted a comment from MauiBot May 12, 2026
@dotnet dotnet deleted a comment from MauiBot May 12, 2026
@MauiBot

MauiBot commented May 12, 2026

Copy link
Copy Markdown
Collaborator

🤖 AI Summary

👋 @KitKeen — new AI review results are available. Please review the latest session below.

📊 Review Sessiond711d26 · Fix test: remove duplicate, keep copy constructor test in Android file · 2026-05-12 21:50 UTC
🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: ANDROID · Base: main · Merge base: f8cb875e

Test Without Fix (expect FAIL) With Fix (expect PASS)
📱 Android_Geolocation_Tests (ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem, ToLocation_EllipsoidalAltitude_UsesEllipsoidReferenceSystem, ToLocation_MslAltitude_UsesGeoidReferenceSystem, ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy, LocationCopyConstructor_PreservesAltitudeReferenceSystem) Category=Geolocation ✅ FAIL — 480s ✅ PASS — 337s
🔴 Without fix — 📱 Android_Geolocation_Tests (ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem, ToLocation_EllipsoidalAltitude_UsesEllipsoidReferenceSystem, ToLocation_MslAltitude_UsesGeoidReferenceSystem, ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy, LocationCopyConstructor_PreservesAltitudeReferenceSystem): FAIL ✅ · 480s

(truncated to last 15,000 chars)

TNET  : 	[PASS] Set_Get_String
      05-12 16:56:28.108  8849  9126 I DOTNET  : 	[PASS] Set_Get_Long
      05-12 16:56:28.109  8849  9126 I DOTNET  : 	[PASS] Set_Get_Long
      05-12 16:56:28.117  8849  9126 I DOTNET  : 	[PASS] DateTimePreservesKind_NonStatic
      05-12 16:56:28.119  8849  9126 I DOTNET  : 	[PASS] DateTimePreservesKind_NonStatic
      05-12 16:56:28.132  8849  9126 I DOTNET  : 	[PASS] Set_Get_Float
      05-12 16:56:28.133  8849  9126 I DOTNET  : 	[PASS] Set_Get_Float
      05-12 16:56:28.133  8849  9126 I DOTNET  : 	[PASS] Remove_Get_String
      05-12 16:56:28.134  8849  9126 I DOTNET  : 	[PASS] Remove_Get_String
      05-12 16:56:28.139  8849  9126 I DOTNET  : 	[PASS] Set_Get_Double
      05-12 16:56:28.140  8849  9126 I DOTNET  : 	[PASS] Set_Get_Double
      05-12 16:56:28.148  8849  9126 I DOTNET  : 	[PASS] Set_Get_Double
      05-12 16:56:28.149  8849  9126 I DOTNET  : 	[PASS] Set_Get_Double
      05-12 16:56:28.149  8849  9126 I DOTNET  : 	[PASS] Set_Set_Null_Get_String_NonStatic
      05-12 16:56:28.149  8849  9126 I DOTNET  : 	[PASS] Set_Set_Null_Get_String_NonStatic
      05-12 16:56:28.152  8849  9126 I DOTNET  : 	[PASS] Clear
      05-12 16:56:28.153  8849  9126 I DOTNET  : 	[PASS] Clear
      05-12 16:56:28.155  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Float_NonStatic
      05-12 16:56:28.156  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Float_NonStatic
      05-12 16:56:28.156  8849  9126 I DOTNET  : 	[PASS] Not_ContainsKey_NonStatic
      05-12 16:56:28.157  8849  9126 I DOTNET  : 	[PASS] Not_ContainsKey_NonStatic
      05-12 16:56:28.157  8849  9126 I DOTNET  : 	[PASS] Set_Get_DateTime_NonStatic
      05-12 16:56:28.157  8849  9126 I DOTNET  : 	[PASS] Set_Get_DateTime_NonStatic
      05-12 16:56:28.158  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Long
      05-12 16:56:28.159  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Long
      05-12 16:56:28.161  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Bool
      05-12 16:56:28.161  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Bool
      05-12 16:56:28.162  8849  9126 I DOTNET  : 	[PASS] DateTimePreservesKind
      05-12 16:56:28.162  8849  9126 I DOTNET  : 	[PASS] DateTimePreservesKind
      05-12 16:56:28.164  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Double
      05-12 16:56:28.165  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Double
      05-12 16:56:28.166  8849  9126 I DOTNET  : 	[PASS] Clear_NonStatic
      05-12 16:56:28.166  8849  9126 I DOTNET  : 	[PASS] Clear_NonStatic
      05-12 16:56:28.167  8849  9126 I DOTNET  : 	[PASS] Set_Get_Long_NonStatic
      05-12 16:56:28.167  8849  9126 I DOTNET  : 	[PASS] Set_Get_Long_NonStatic
      05-12 16:56:28.171  8849  9126 I DOTNET  : 	[PASS] Set_Set_Null_Get_String
      05-12 16:56:28.173  8849  9126 I DOTNET  : 	[PASS] Set_Set_Null_Get_String
      05-12 16:56:28.174  8849  9126 I DOTNET  : 	[PASS] Set_Get_DateTime
      05-12 16:56:28.174  8849  9126 I DOTNET  : 	[PASS] Set_Get_DateTime
      05-12 16:56:28.174  8849  9126 I DOTNET  : 	[PASS] Set_Get_Float_NonStatic
      05-12 16:56:28.176  8849  9126 I DOTNET  : 	[PASS] Set_Get_Float_NonStatic
      05-12 16:56:28.176  8849  9126 I DOTNET  : 	[PASS] Remove
      05-12 16:56:28.177  8849  9126 I DOTNET  : 	[PASS] Remove
      05-12 16:56:28.178  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Long_NonStatic
      05-12 16:56:28.178  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Long_NonStatic
      05-12 16:56:28.179  8849  9126 I DOTNET  : 	[PASS] Remove_NonStatic
      05-12 16:56:28.179  8849  9126 I DOTNET  : 	[PASS] Remove_NonStatic
      05-12 16:56:28.180  8849  9126 I DOTNET  : 	[PASS] Does_ContainsKey_NonStatic
      05-12 16:56:28.180  8849  9126 I DOTNET  : 	[PASS] Does_ContainsKey_NonStatic
      05-12 16:56:28.181  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Bool_NonStatic
      05-12 16:56:28.181  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Bool_NonStatic
      05-12 16:56:28.182  8849  9126 I DOTNET  : 	[PASS] Set_Get_Int_NonStatic
      05-12 16:56:28.182  8849  9126 I DOTNET  : 	[PASS] Set_Get_Int_NonStatic
      05-12 16:56:28.217  8849  9126 I DOTNET  : 	[PASS] DateTimeOffsetPreservesOffset_NonStatic
      05-12 16:56:28.217  8849  9126 I DOTNET  : 	[PASS] DateTimeOffsetPreservesOffset_NonStatic
      05-12 16:56:28.218  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Int_NonStatic
      05-12 16:56:28.219  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Int_NonStatic
      05-12 16:56:28.219  8849  9126 I DOTNET  : 	[PASS] Set_Get_String_NonStatic
      05-12 16:56:28.219  8849  9126 I DOTNET  : 	[PASS] Set_Get_String_NonStatic
      05-12 16:56:28.223  8849  9126 I DOTNET  : 	[PASS] Does_ContainsKey
      05-12 16:56:28.223  8849  9126 I DOTNET  : 	[PASS] Does_ContainsKey
      05-12 16:56:28.223  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Int
      05-12 16:56:28.224  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Int
      05-12 16:56:28.226  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Float
      05-12 16:56:28.226  8849  9126 I DOTNET  : 	[PASS] Remove_Get_Float
      05-12 16:56:28.227  8849  9126 I DOTNET  : 	[PASS] Remove_Get_String_NonStatic
      05-12 16:56:28.228  8849  9126 I DOTNET  : 	[PASS] Remove_Get_String_NonStatic
      05-12 16:56:28.229  8849  9126 I DOTNET  : 	[PASS] Set_Get_Double_NonStatic
      05-12 16:56:28.229  8849  9126 I DOTNET  : 	[PASS] Set_Get_Double_NonStatic
      05-12 16:56:28.229  8849  9126 I DOTNET  : 	[PASS] Set_Get_Bool_NonStatic
      05-12 16:56:28.230  8849  9126 I DOTNET  : 	[PASS] Set_Get_Bool_NonStatic
      05-12 16:56:28.230  8849  9126 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Preferences_Tests 0.0948901 ms
      05-12 16:56:28.400  8849  9140 I DOTNET  : 	[PASS] Remove_All_Keys
      05-12 16:56:28.511  8849  9145 I DOTNET  : 	[PASS] Remove_All_Keys
      05-12 16:56:32.522  8849  9189 I DOTNET  : 	[PASS] Set_Get_Remove_Async_MultipleTimes
      05-12 16:56:32.573  8849  9194 I DOTNET  : 	[PASS] Asymmetric_to_Symmetric_API_Upgrade
      05-12 16:56:32.587  8849  9194 I DOTNET  : 	[PASS] Non_Existent_Key_Returns_Null
      05-12 16:56:32.625  8849  9199 I DOTNET  : 	[PASS] Saves_Same_Key_Twice
      05-12 16:56:32.661  8849  9204 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 16:56:32.692  8849  9209 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 16:56:32.723  8849  9214 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 16:56:32.767  8849  9219 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 16:56:32.813  8849  9224 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 16:56:32.846  8849  9229 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 16:56:34.429  8849  9237 I DOTNET  : 	[PASS] Set_Get_Async_MultipleTimes
      05-12 16:56:34.533  8849  9242 I DOTNET  : 	[PASS] Fix_Corrupt_Data
      05-12 16:56:36.175  8849  9242 I DOTNET  : 	[PASS] Set_Get_Wait_MultipleTimes
      05-12 16:56:36.235  8849  9248 I DOTNET  : 	[PASS] Remove_Key
      05-12 16:56:36.273  8849  9253 I DOTNET  : 	[PASS] Remove_Key
      05-12 16:56:36.273  8849  9253 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.SecureStorage_Tests 7.9950636 ms
      05-12 16:56:36.273  8849  9253 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Shared.Android_FileProvider_Tests
      05-12 16:56:36.282  8849  9253 I DOTNET  : 	[PASS] Get_Existing_Internal_Cache_Shareable_Uri
      05-12 16:56:36.288  8849  9253 I DOTNET  : 	[PASS] Get_Existing_Internal_Cache_Shareable_Uri
      05-12 16:56:36.292  8849  9253 I DOTNET  : 	[PASS] No_Media_Fails_Get_External_Cache_Shareable_Uri
      05-12 16:56:36.330  8849  9253 I DOTNET  : 	[PASS] Get_Shareable_Uri
      05-12 16:56:36.342  8849  9253 I DOTNET  : 	[PASS] Get_Shareable_Uri
      05-12 16:56:36.345  8849  9253 I DOTNET  : 	[PASS] Get_Existing_External_Shareable_Uri
      05-12 16:56:36.350  8849  9253 I DOTNET  : 	[PASS] Get_Existing_External_Shareable_Uri
      05-12 16:56:36.353  8849  9253 I DOTNET  : 	[PASS] Get_Existing_External_Cache_Shareable_Uri
      05-12 16:56:36.358  8849  9253 I DOTNET  : 	[PASS] Get_Existing_External_Cache_Shareable_Uri
      05-12 16:56:36.362  8849  9253 I DOTNET  : 	[PASS] Get_External_Cache_Shareable_Uri
      05-12 16:56:36.362  8849  9253 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Shared.Android_FileProvider_Tests 0.0853868 ms
      05-12 16:56:36.362  8849  9253 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Permissions_Tests
      05-12 16:56:36.369  8849  9253 I DOTNET  : 	[PASS] Check_Status
      05-12 16:56:36.371  8849  9253 I DOTNET  : 	[PASS] Check_Status
      05-12 16:56:36.372  8849  9253 I DOTNET  : 	[PASS] Ensure_Declared
      05-12 16:56:36.372  8849  9253 I DOTNET  : 	[PASS] Ensure_Declared
      05-12 16:56:36.374  8849  9253 I DOTNET  : 	[PASS] Request
      05-12 16:56:36.375  8849  9253 I DOTNET  : 	[PASS] Request
      05-12 16:56:36.377  8849  9253 I DOTNET  : 	[PASS] StorageAndroid13AlwaysGranted
      05-12 16:56:36.377  8849  9253 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Permissions_Tests 0.0130518 ms
      05-12 16:56:36.377  8849  9253 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Accelerometer_Tests
      05-12 16:56:36.415  8849  9258 I DOTNET  : 	[PASS] Stop_Monitor
      05-12 16:56:36.424  8849  9263 I DOTNET  : 	[PASS] IsMonitoring
      05-12 16:56:36.424  8849  9263 I DOTNET  : 	[PASS] IsSupported
      05-12 16:56:36.451  8849  9268 I DOTNET  : 	[PASS] Monitor
      05-12 16:56:36.451  8849  9268 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Accelerometer_Tests 0.0681746 ms
      05-12 16:56:36.457  8849  8877 I DOTNET  : Failed tests:
      05-12 16:56:36.458  8849  8877 I DOTNET  : 1) 	[FAIL] ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy   Test name: ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Assembly:  [Microsoft.Maui.Essentials.DeviceTests, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null]
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Exception messages: Assert.Equal() Failure: Values differ
      05-12 16:56:36.458  8849  8877 I DOTNET  : Expected: Unspecified
      05-12 16:56:36.458  8849  8877 I DOTNET  : Actual:   Ellipsoid   Exception stack traces:    at Microsoft.Maui.Essentials.DeviceTests.Android_Geolocation_Tests.ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy()
      05-12 16:56:36.458  8849  8877 I DOTNET  :    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
      05-12 16:56:36.458  8849  8877 I DOTNET  :    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object , BindingFlags )
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Execution time: 0.012322
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Test trait name: Category
      05-12 16:56:36.458  8849  8877 I DOTNET  :       value: Geolocation
      05-12 16:56:36.458  8849  8877 I DOTNET  : 
      05-12 16:56:36.458  8849  8877 I DOTNET  : 2) 	[FAIL] LocationCopyConstructor_PreservesAltitudeReferenceSystem   Test name: LocationCopyConstructor_PreservesAltitudeReferenceSystem
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Assembly:  [Microsoft.Maui.Essentials.DeviceTests, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null]
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Exception messages: Assert.Equal() Failure: Values differ
      05-12 16:56:36.458  8849  8877 I DOTNET  : Expected: Geoid
      05-12 16:56:36.458  8849  8877 I DOTNET  : Actual:   Unspecified   Exception stack traces:    at Microsoft.Maui.Essentials.DeviceTests.Android_Geolocation_Tests.LocationCopyConstructor_PreservesAltitudeReferenceSystem()
      05-12 16:56:36.458  8849  8877 I DOTNET  :    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
      05-12 16:56:36.458  8849  8877 I DOTNET  :    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object , BindingFlags )
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Execution time: 0.0072347
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Test trait name: Category
      05-12 16:56:36.458  8849  8877 I DOTNET  :       value: Geolocation
      05-12 16:56:36.458  8849  8877 I DOTNET  : 
      05-12 16:56:36.458  8849  8877 I DOTNET  : 3) 	[FAIL] ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem   Test name: ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Assembly:  [Microsoft.Maui.Essentials.DeviceTests, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null]
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Exception messages: Assert.Equal() Failure: Values differ
      05-12 16:56:36.458  8849  8877 I DOTNET  : Expected: Unspecified
      05-12 16:56:36.458  8849  8877 I DOTNET  : Actual:   Ellipsoid   Exception stack traces:    at Microsoft.Maui.Essentials.DeviceTests.Android_Geolocation_Tests.ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem()
      05-12 16:56:36.458  8849  8877 I DOTNET  :    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
      05-12 16:56:36.458  8849  8877 I DOTNET  :    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object , BindingFlags )
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Execution time: 0.0002305
      05-12 16:56:36.458  8849  8877 I DOTNET  :    Test trait name: Category
      05-12 16:56:36.458  8849  8877 I DOTNET  :       value: Geolocation
      05-12 16:56:36.458  8849  8877 I DOTNET  : 
      05-12 16:56:36.490  8849  8877 I DOTNET  : Xml file was written to the provided writer.
      05-12 16:56:36.490  8849  8877 I DOTNET  : Tests run: 302 Passed: 269 Inconclusive: 0 Failed: 3 Ignored: 30
�[41m�[30mfail�[39m�[22m�[49m: Non-success instrumentation exit code: 1, expected: 0
�[40m�[32minfo�[39m�[22m�[49m: <<XHARNESS_RESULT_START>>
      {
        "version": 1,
        "machineName": "runnervmfz4j5",
        "exitCode": 1,
        "exitCodeName": "TESTS_FAILED",
        "platform": "android",
        "instrumentationExitCode": 1,
        "device": "emulator-5554",
        "deviceOsVersion": "API 30",
        "architecture": "x86_64",
        "files": [
          {
            "name": "testResults.xml",
            "type": "test-results"
          },
          {
            "name": "adb-logcat-com.microsoft.maui.essentials.devicetests-default.log",
            "type": "logcat"
          }
        ]
      }
      <<XHARNESS_RESULT_END>>
�[40m�[32minfo�[39m�[22m�[49m: Attempting to remove apk 'com.microsoft.maui.essentials.devicetests'..
�[40m�[37mdbug�[39m�[22m�[49m: Executing command: '/home/vsts/.nuget/packages/microsoft.dotnet.xharness.cli/11.0.0-prerelease.26230.4/runtimes/any/native/adb/linux/adb -s emulator-5554 uninstall com.microsoft.maui.essentials.devicetests'
�[40m�[32minfo�[39m�[22m�[49m: Successfully uninstalled com.microsoft.maui.essentials.devicetests
XHarness exit code: 1 (TESTS_FAILED)
  Tests completed with exit code: 1

🟢 With fix — 📱 Android_Geolocation_Tests (ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem, ToLocation_EllipsoidalAltitude_UsesEllipsoidReferenceSystem, ToLocation_MslAltitude_UsesGeoidReferenceSystem, ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy, LocationCopyConstructor_PreservesAltitudeReferenceSystem): PASS ✅ · 337s

(truncated to last 15,000 chars)

c
      05-12 17:01:45.102 11174 11242 I DOTNET  : 	[PASS] Remove_Get_Int_NonStatic
      05-12 17:01:45.102 11174 11242 I DOTNET  : 	[PASS] Set_Get_String_NonStatic
      05-12 17:01:45.103 11174 11242 I DOTNET  : 	[PASS] Set_Get_String_NonStatic
      05-12 17:01:45.103 11174 11242 I DOTNET  : 	[PASS] Does_ContainsKey
      05-12 17:01:45.103 11174 11242 I DOTNET  : 	[PASS] Does_ContainsKey
      05-12 17:01:45.104 11174 11242 I DOTNET  : 	[PASS] Remove_Get_Int
      05-12 17:01:45.105 11174 11242 I DOTNET  : 	[PASS] Remove_Get_Int
      05-12 17:01:45.107 11174 11242 I DOTNET  : 	[PASS] Remove_Get_Float
      05-12 17:01:45.107 11174 11242 I DOTNET  : 	[PASS] Remove_Get_Float
      05-12 17:01:45.108 11174 11242 I DOTNET  : 	[PASS] Remove_Get_String_NonStatic
      05-12 17:01:45.108 11174 11242 I DOTNET  : 	[PASS] Remove_Get_String_NonStatic
      05-12 17:01:45.109 11174 11242 I DOTNET  : 	[PASS] Set_Get_Double_NonStatic
      05-12 17:01:45.109 11174 11242 I DOTNET  : 	[PASS] Set_Get_Double_NonStatic
      05-12 17:01:45.110 11174 11242 I DOTNET  : 	[PASS] Set_Get_Bool_NonStatic
      05-12 17:01:45.110 11174 11242 I DOTNET  : 	[PASS] Set_Get_Bool_NonStatic
      05-12 17:01:45.110 11174 11242 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Preferences_Tests 0.1006911 ms
      05-12 17:01:45.384 11174 11254 I DOTNET  : 	[PASS] Remove_All_Keys
      05-12 17:01:45.476 11174 11259 I DOTNET  : 	[PASS] Remove_All_Keys
      05-12 17:01:49.117 11174 11265 I DOTNET  : 	[PASS] Set_Get_Remove_Async_MultipleTimes
      05-12 17:01:49.170 11174 11270 I DOTNET  : 	[PASS] Asymmetric_to_Symmetric_API_Upgrade
      05-12 17:01:49.191 11174 11270 I DOTNET  : 	[PASS] Non_Existent_Key_Returns_Null
      05-12 17:01:49.232 11174 11275 I DOTNET  : 	[PASS] Saves_Same_Key_Twice
      05-12 17:01:49.258 11174 11280 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 17:01:49.285 11174 11285 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 17:01:49.323 11174 11290 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 17:01:49.342 11174 11295 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 17:01:49.371 11174 11300 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 17:01:49.394 11174 11305 I DOTNET  : 	[PASS] Saves_And_Loads
      05-12 17:01:50.844 11174 11310 I DOTNET  : 	[PASS] Set_Get_Async_MultipleTimes
      05-12 17:01:50.911 11174 11315 I DOTNET  : 	[PASS] Fix_Corrupt_Data
      05-12 17:01:52.581 11174 11315 I DOTNET  : 	[PASS] Set_Get_Wait_MultipleTimes
      05-12 17:01:52.647 11174 11315 I DOTNET  : 	[PASS] Remove_Key
      05-12 17:01:52.680 11174 11315 I DOTNET  : 	[PASS] Remove_Key
      05-12 17:01:52.680 11174 11315 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.SecureStorage_Tests 7.5260014 ms
      05-12 17:01:52.680 11174 11315 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.WebUtils_Tests
      05-12 17:01:52.687 11174 11315 I DOTNET  : 	[PASS] ParseQueryString
      05-12 17:01:52.688 11174 11315 I DOTNET  : 	[PASS] ParseQueryString
      05-12 17:01:52.689 11174 11315 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.WebUtils_Tests 0.0073533 ms
      05-12 17:01:52.689 11174 11315 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Vibration_Tests
      05-12 17:01:52.689 11174 11315 I DOTNET  : 	[PASS] Vibrate
      05-12 17:01:52.689 11174 11315 I DOTNET  : 	[PASS] Vibrate_Cancel
      05-12 17:01:52.689 11174 11315 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Vibration_Tests 0.0000362 ms
      05-12 17:01:52.689 11174 11315 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Compass_Tests
      05-12 17:01:52.721 11174 11321 I DOTNET  : 	[PASS] Stop_Monitor
      05-12 17:01:52.722 11174 11321 I DOTNET  : 	[PASS] IsSupported
      05-12 17:01:52.792 11174 11326 I DOTNET  : 	[PASS] IsMonitoring
      05-12 17:01:52.806 11174 11331 I DOTNET  : 	[PASS] Monitor
      05-12 17:01:52.807 11174 11331 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Compass_Tests 0.1138963 ms
      05-12 17:01:52.807 11174 11331 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Magnetometer_Tests
      05-12 17:01:52.818 11174 11336 I DOTNET  : 	[PASS] Stop_Monitor
      05-12 17:01:52.833 11174 11341 I DOTNET  : 	[PASS] Monitor
      05-12 17:01:52.845 11174 11346 I DOTNET  : 	[PASS] IsMonitoring
      05-12 17:01:52.845 11174 11346 I DOTNET  : 	[PASS] IsSupported
      05-12 17:01:52.845 11174 11346 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Magnetometer_Tests 0.0349373 ms
      05-12 17:01:52.846 11174 11346 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Android_Geolocation_Tests
      05-12 17:01:52.855 11174 11346 I DOTNET  : 	[PASS] ToLocation_MslAltitude_UsesGeoidReferenceSystem
      05-12 17:01:52.856 11174 11346 I DOTNET  : 	[PASS] ToLocation_EllipsoidalAltitude_UsesEllipsoidReferenceSystem
      05-12 17:01:52.856 11174 11346 I DOTNET  : 	[PASS] ToLocation_MslAltitudeWithoutMslAccuracy_ReportsNullVerticalAccuracy
      05-12 17:01:52.857 11174 11346 I DOTNET  : 	[PASS] LocationCopyConstructor_PreservesAltitudeReferenceSystem
      05-12 17:01:52.857 11174 11346 I DOTNET  : 	[PASS] ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem
      05-12 17:01:52.857 11174 11346 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Android_Geolocation_Tests 0.0104336 ms
      05-12 17:01:52.857 11174 11346 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.AppInfo_Tests
      05-12 17:01:52.862 11174 11346 I DOTNET  : 	[PASS] App_Versions_Are_Correct
      05-12 17:01:52.865 11174 11346 I DOTNET  : 	[PASS] App_RequestedLayoutDirection_Is_Correct
      05-12 17:01:52.865 11174 11346 I DOTNET  : 	[PASS] AppPackageName_Is_Correct
      05-12 17:01:52.866 11174 11346 I DOTNET  : 	[PASS] AppName_Is_Correct
      05-12 17:01:52.866 11174 11346 I DOTNET  : 	[PASS] App_Build_Is_Correct
      05-12 17:01:52.869 11174 11346 I DOTNET  : 	[PASS] App_Theme_Is_Correct
      05-12 17:01:52.869 11174 11346 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.AppInfo_Tests 0.0109040 ms
      05-12 17:01:52.869 11174 11346 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.HapticFeedback_Tests
      05-12 17:01:52.883 11174 11346 I DOTNET  : 	[PASS] LongPress
      05-12 17:01:52.884 11174 11346 I DOTNET  : 	[PASS] Click
      05-12 17:01:52.884 11174 11346 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.HapticFeedback_Tests 0.0141864 ms
      05-12 17:01:52.884 11174 11346 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Battery_Tests
      05-12 17:01:53.891 11174 11354 I DOTNET  : 	[PASS] EnergySaverStatusChanged_Does_Not_Crash
      05-12 17:01:53.896 11174 11354 I DOTNET  : 	[PASS] Charge_State
      05-12 17:01:53.898 11174 11354 I DOTNET  : 	[PASS] Charge_Level
      05-12 17:01:53.902 11174 11354 I DOTNET  : 	[PASS] Charge_Power
      05-12 17:01:53.909 11174 11354 I DOTNET  : 	[PASS] Unsubscribe_BatteryInfoChanged_Does_Not_Crash
      05-12 17:01:53.913 11174 11354 I DOTNET  : 	[PASS] App_Is_Not_Lower_Power_mode
      05-12 17:01:54.921 11174 11359 I DOTNET  : 	[PASS] BatteryInfoChanged_Does_Not_Crash
      05-12 17:01:54.922 11174 11359 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Battery_Tests 2.0345274 ms
      05-12 17:01:54.922 11174 11359 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Barometer_Tests
      05-12 17:01:54.922 11174 11359 I DOTNET  : 	[PASS] IsSupported
      05-12 17:01:54.997 11174 11364 I DOTNET  : 	[PASS] Monitor
      05-12 17:01:55.068 11174 11369 I DOTNET  : 	[PASS] IsMonitoring
      05-12 17:01:55.137 11174 11374 I DOTNET  : 	[PASS] Stop_Monitor
      05-12 17:01:55.137 11174 11374 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Barometer_Tests 0.2136288 ms
      05-12 17:01:55.137 11174 11374 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Accelerometer_Tests
      05-12 17:01:55.145 11174 11379 I DOTNET  : 	[PASS] Stop_Monitor
      05-12 17:01:55.156 11174 11384 I DOTNET  : 	[PASS] IsMonitoring
      05-12 17:01:55.157 11174 11384 I DOTNET  : 	[PASS] IsSupported
      05-12 17:01:55.165 11174 11389 I DOTNET  : 	[PASS] Monitor
      05-12 17:01:55.165 11174 11389 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Accelerometer_Tests 0.0253054 ms
      05-12 17:01:55.165 11174 11389 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Screenshot_Tests
      05-12 17:01:55.397 11174 11393 I DOTNET  : 	[PASS] CaptureAsync
      05-12 17:01:55.603 11174 11397 I DOTNET  : 	[PASS] GetPngScreenshot
      05-12 17:01:55.756 11174 11401 I DOTNET  : 	[PASS] GetJpegScreenshot
      05-12 17:01:55.980 11174 11405 I DOTNET  : 	[PASS] CaptureStaticAsync
      05-12 17:01:55.980 11174 11405 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Screenshot_Tests 0.8068592 ms
      05-12 17:01:55.980 11174 11405 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.DeviceInfo_Tests
      05-12 17:01:55.980 11174 11405 I DOTNET  : 	[PASS] Versions_Are_Correct
      05-12 17:01:55.984 11174 11405 I DOTNET  : 	[PASS] Platform_Is_Correct
      05-12 17:01:55.984 11174 11405 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.DeviceInfo_Tests 0.0040206 ms
      05-12 17:01:55.985 11174 11405 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.AppActions_Tests
      05-12 17:01:56.002 11174 11405 I DOTNET  : 	[PASS] GetSetItems
      05-12 17:01:56.002 11174 11405 I DOTNET  : 	[PASS] IsSupported
      05-12 17:01:56.002 11174 11405 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.AppActions_Tests 0.0168679 ms
      05-12 17:01:56.002 11174 11405 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Connectivity_Tests
      05-12 17:01:56.015 11174 11405 I DOTNET  : 	[PASS] Network_Access
      05-12 17:01:57.051 11174 11518 I DOTNET  : 	[PASS] ConnectivityChanged_Does_Not_Crash
      05-12 17:01:57.064 11174 11518 I DOTNET  : 	[PASS] Connection_Profiles
      05-12 17:01:57.070 11174 11518 I DOTNET  : 	[PASS] Test
      05-12 17:01:57.074 11174 11518 I DOTNET  : 	[PASS] Distict_Connection_Profiles
      05-12 17:01:57.074 11174 11518 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Connectivity_Tests 1.0684055 ms
      05-12 17:01:57.074 11174 11518 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Shared.Android_FileProvider_Tests
      05-12 17:01:57.117 11174 11518 I DOTNET  : 	[PASS] Get_Existing_Internal_Cache_Shareable_Uri
      05-12 17:01:57.134 11174 11518 I DOTNET  : 	[PASS] Get_Existing_Internal_Cache_Shareable_Uri
      05-12 17:01:57.136 11174 11518 I DOTNET  : 	[PASS] Get_Existing_Internal_Cache_Shareable_Uri
      05-12 17:01:57.140 11174 11518 I DOTNET  : 	[PASS] No_Media_Fails_Get_External_Cache_Shareable_Uri
      05-12 17:01:57.300 11174 11518 I DOTNET  : 	[PASS] Get_Shareable_Uri
      05-12 17:01:57.308 11174 11518 I DOTNET  : 	[PASS] Get_Shareable_Uri
      05-12 17:01:57.346 11174 11518 I DOTNET  : 	[PASS] Get_Existing_External_Shareable_Uri
      05-12 17:01:57.350 11174 11518 I DOTNET  : 	[PASS] Get_Existing_External_Shareable_Uri
      05-12 17:01:57.352 11174 11518 I DOTNET  : 	[PASS] Get_Existing_External_Cache_Shareable_Uri
      05-12 17:01:57.354 11174 11518 I DOTNET  : 	[PASS] Get_Existing_External_Cache_Shareable_Uri
      05-12 17:01:57.392 11174 11518 I DOTNET  : 	[PASS] Get_Existing_External_Cache_Shareable_Uri
      05-12 17:01:57.406 11174 11518 I DOTNET  : 	[PASS] Get_External_Cache_Shareable_Uri
      05-12 17:01:57.406 11174 11518 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Shared.Android_FileProvider_Tests 0.3274450 ms
      05-12 17:01:57.406 11174 11518 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Share_Tests
      05-12 17:01:57.407 11174 11518 I DOTNET  : 	[PASS] Share_NullShareMultipleFilesRequest
      05-12 17:01:57.412 11174 11518 I DOTNET  : 	[PASS] Share_ShareMultipleFilesRequestWithEmptyFilesList
      05-12 17:01:57.412 11174 11518 I DOTNET  : 	[PASS] Share_ShareMultipleFilesRequestWithInvalidFilesList
      05-12 17:01:57.413 11174 11518 I DOTNET  : 	[PASS] Share_NullShareTextRequest
      05-12 17:01:57.436 11174 11518 I DOTNET  : 	[PASS] Share_SingleFileIntent_HasClipData
      05-12 17:01:57.437 11174 11518 I DOTNET  : 	[PASS] Share_ShareFileRequestWithInvalidFile
      05-12 17:01:57.437 11174 11518 I DOTNET  : 	[PASS] Share_FiletWithNullFilePath
      05-12 17:01:57.446 11174 11518 I DOTNET  : 	[PASS] Share_MultipleFilesIntent_HasClipData
      05-12 17:01:57.447 11174 11518 I DOTNET  : 	[PASS] Share_NullShareFileRequest
      05-12 17:01:57.447 11174 11518 I DOTNET  : 	[PASS] Share_FiletWithInvalidFilePath
      05-12 17:01:57.452 11174 11518 I DOTNET  : 	[PASS] Share_ShareTextRequestWithInvalidTextAndUri
      05-12 17:01:57.452 11174 11518 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Share_Tests 0.0440022 ms
      05-12 17:01:57.452 11174 11518 I DOTNET  : Test collection for Microsoft.Maui.Essentials.DeviceTests.Launcher_Tests
      05-12 17:01:57.454 11174 11518 I DOTNET  : 	[PASS] InvalidUri
      05-12 17:01:57.456 11174 11518 I DOTNET  : 	[PASS] CanNotOpen
      05-12 17:01:57.461 11174 11518 I DOTNET  : 	[PASS] CanOpenUri
      05-12 17:01:57.468 11174 11518 I DOTNET  : 	[PASS] CanOpenUri
      05-12 17:01:57.469 11174 11518 I DOTNET  : 	[PASS] CanOpen
      05-12 17:01:57.473 11174 11518 I DOTNET  : 	[PASS] CanOpen
      05-12 17:01:57.479 11174 11518 I DOTNET  : 	[PASS] CanNotOpenUri
      05-12 17:01:57.480 11174 11518 I DOTNET  : Microsoft.Maui.Essentials.DeviceTests.Launcher_Tests 0.0241836 ms
      05-12 17:01:57.569 11174 11195 I DOTNET  : Xml file was written to the provided writer.
      05-12 17:01:57.570 11174 11195 I DOTNET  : Tests run: 302 Passed: 272 Inconclusive: 0 Failed: 0 Ignored: 30
�[40m�[32minfo�[39m�[22m�[49m: <<XHARNESS_RESULT_START>>
      {
        "version": 1,
        "machineName": "runnervmfz4j5",
        "exitCode": 0,
        "exitCodeName": "SUCCESS",
        "platform": "android",
        "instrumentationExitCode": 0,
        "device": "emulator-5554",
        "deviceOsVersion": "API 30",
        "architecture": "x86_64",
        "files": [
          {
            "name": "testResults.xml",
            "type": "test-results"
          },
          {
            "name": "adb-logcat-com.microsoft.maui.essentials.devicetests-default.log",
            "type": "logcat"
          }
        ]
      }
      <<XHARNESS_RESULT_END>>
�[40m�[32minfo�[39m�[22m�[49m: Attempting to remove apk 'com.microsoft.maui.essentials.devicetests'..
�[40m�[37mdbug�[39m�[22m�[49m: Executing command: '/home/vsts/.nuget/packages/microsoft.dotnet.xharness.cli/11.0.0-prerelease.26230.4/runtimes/any/native/adb/linux/adb -s emulator-5554 uninstall com.microsoft.maui.essentials.devicetests'
�[40m�[32minfo�[39m�[22m�[49m: Successfully uninstalled com.microsoft.maui.essentials.devicetests
XHarness exit code: 0
  Tests completed successfully

📁 Fix files reverted (2 files)
  • src/Essentials/src/Types/Location.shared.cs
  • src/Essentials/src/Types/LocationExtensions.android.cs

🧪 UI Tests — Essentials

Detected UI test categories: Essentials

⏭️ Deep UI tests — 0 passed, 0 failed across 1 category on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
controls-Essentials
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

🔍 Pre-Flight — Context & Validation

Pre-Flight Summary — PR #35097

PR

Issue Summary

Issue #27554 requests that .NET MAUI surface Location.getMslAltitudeMeters() (Android API 34+) when available, so altitude values on Android are reported against the geoid (MSL) — matching iOS/Windows defaults — rather than the WGS84 ellipsoid. Currently, consumers must apply manual geoid corrections to get consistent cross-platform altitudes.

Files Changed (3)

File +/- Notes
src/Essentials/src/Types/Location.shared.cs +1 / -0 Copy ctor now propagates AltitudeReferenceSystem
src/Essentials/src/Types/LocationExtensions.android.cs +35 / -8 Adds GetAltitude(...) helper; prefers MSL on API 34+, falls back to ellipsoid, returns Unspecified when no altitude
src/Essentials/test/DeviceTests/Tests/Android/Geolocation_Tests.cs +124 / -0 New xUnit device tests (5 cases) covering all branches incl. baseline pre-34 assertions

Fix Approach

  1. Adds a private GetAltitude helper returning (Altitude, AltitudeReferenceSystem, VerticalAccuracy) as a tuple.
  2. Priority order:
    • API 34+ with HasMslAltitudeMslAltitudeMeters + AltitudeReferenceSystem.Geoid + MslAltitudeAccuracyMeters (if HasMslAltitudeAccuracy).
    • HasAltitudeAltitude + Ellipsoid + VerticalAccuracyMeters (API 26+).
    • Otherwise → (null, Unspecified, null) (previously was Ellipsoid with null altitude — minor behavior fix).
  3. Critically pairs the vertical-accuracy source with the altitude source so accuracy is never mismatched against a different reference system.
  4. Location copy-ctor now copies AltitudeReferenceSystem (was missing — silent bug independent of MSL).

Gate Result

✅ PASSED — tests FAIL without fix, PASS with fix (provided by gate script).

Risk / Behavior Notes

  • Public surface unchanged — no PublicAPI deltas required.
  • Guarded by OperatingSystem.IsAndroidVersionAtLeast(34), so pre-34 devices are unaffected.
  • One subtle behavioral change beyond MSL: when HasAltitude is false, AltitudeReferenceSystem is now Unspecified instead of Ellipsoid. That is more correct, but technically observable to callers — low risk and consistent with the cross-platform Unspecified semantics.
  • Copy-ctor change is a strict bug fix; previously AltitudeReferenceSystem was dropped on clone.

Platform Tested

android (per task)


🔧 Fix — Analysis & Comparison

Try-Fix Aggregate Summary

Four diverse alternative fix candidates were generated for PR #35097, each loaded with domain knowledge from a different reviewer dimension:

Candidate Dimension One-Line Description Regression Tests
try-fix-1 API design Add opt-in GeolocationRequest.PreferredAltitudeReferenceSystem knob ✅ pass (after extending tests) — but wrong base branch (needs net11.0)
try-fix-2 Android platform Inline logic, preserve "Ellipsoid even when null altitude" ❌ fails ToLocation_NoAltitude_UsesUnspecifiedReferenceSystem
try-fix-3 Regression risk PR minus the "Unspecified" semantic correction ❌ fails the same test
try-fix-4 Testing practices Same production code as PR; relocate copy-ctor test + use [Trait] ✅ pass

Highlights

  • Best alt approach: try-fix-1 (API knob) honors the issue's explicit suggestion of an option, but introduces public API and would need to target net11.0. Not appropriate to displace the current PR on main.
  • try-fix-2/3 trade away a small correctness fix (the Unspecified case) for marginal backcompat — the trade isn't worth it.
  • try-fix-4 is functionally identical to pr with test-placement polish only.

Conclusion

None of the alternatives meaningfully beats the submitted PR. The PR's chosen factoring (helper method, paired altitude/accuracy, Unspecified correctness fix, copy-ctor bug fix) is the best balance of clarity, correctness, and scope for main.


📋 Report — Final Recommendation

Phase 3 — Comparative Report

Candidates Evaluated

# Candidate Source Regression-Test Outcome
1 pr The raw PR fix as submitted ✅ PASSED (gate)
2 pr-plus-reviewer pr + cosmetic reviewer feedback ✅ PASSED (no behavioral delta)
3 try-fix-1 API-design knob in GeolocationRequest ✅ would pass — but wrong base branch
4 try-fix-2 Inline logic, preserve old Ellipsoid-when-null ❌ FAILS PR's Unspecified test
5 try-fix-3 PR minus the "Unspecified" semantic fix ❌ FAILS PR's Unspecified test
6 try-fix-4 Same code as PR; test polish ✅ PASSED

Ranking (per instructions: failing-regression candidates ranked lower)

  1. pr — passes gate, minimal scope, correct, well-tested.
  2. pr-plus-reviewer — equivalent to pr with cosmetic comment polish.
  3. try-fix-4 — same production code as pr, polished test placement.
  4. try-fix-1 — passes regression but targets wrong base branch (would need net11.0).
  5. try-fix-2 — FAILS regression.
  6. try-fix-3 — FAILS regression.

Dimension-by-Dimension

  • Correctness: pr correctly pairs altitude with its matching VerticalAccuracy source. try-fix-2/3 retain the latent "Ellipsoid even when null" misnomer. ⇒ pr wins.
  • Scope discipline: pr is +160/-8 across 3 files including tests — appropriate. try-fix-1 introduces public API. ⇒ pr wins for main branch.
  • Backcompat: All candidates preserve pre-34 behavior. pr introduces one subtle observable change (Unspecified vs. Ellipsoid when no altitude). try-fix-2/3 avoid that change at the cost of correctness. ⇒ Wash; net favor pr because the change is more correct and unlikely to affect real callers.
  • Public API: pr has zero public-API surface change; try-fix-1 requires API review and a net11.0 target. ⇒ pr wins for shippability against main.
  • Testing: pr adds 5 thoughtful tests with pre-34 baselines and proper conditional branches. try-fix-4's polish (move shared test out of device test) is reasonable follow-up. ⇒ pr is good; try-fix-4 differs only in placement.
  • Bonus: pr also fixes the latent copy-constructor bug in Location.shared.cs (orthogonal but valuable). None of the alternatives improve on this.

Winner: pr

The submitted PR is the best candidate. It:

  • Implements the requested feature correctly with proper API-level guards.
  • Pairs altitude reference and accuracy source — avoiding a subtle correctness bug the inline form is prone to.
  • Fixes an orthogonal latent bug in the copy constructor and tests it.
  • Adds tests with defensive baselines so pre-34 emulators don't silently pass.
  • Requires no public-API change and targets main appropriately.

No reason to displace the PR with an alternative.

Recommendation

Merge pr as-is (the reviewer-suggested polish in pr-plus-reviewer is optional and can be addressed in a follow-up or via inline comments).


@kubaflo kubaflo changed the base branch from main to inflight/candidate May 13, 2026 09:12
@kubaflo kubaflo merged commit e41e5e2 into dotnet:inflight/candidate May 13, 2026
3 of 4 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR7 milestone May 13, 2026
@kubaflo kubaflo added the s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) label May 20, 2026
github-actions Bot pushed a commit that referenced this pull request May 25, 2026
Fixes #27554.

  Android API level 34 introduced

[`Location.getMslAltitudeMeters()`](https://developer.android.com/reference/android/location/Location#getMslAltitudeMeters()),
  which reports altitude measured against the geoid (mean sea level).
  The existing implementation always reads the WGS84 ellipsoidal
  altitude, which is reported inconsistently with iOS and Windows where
  altitude is typically expressed against the geoid. As the issue notes,
  this forces consumers to apply manual geoid corrections to get
  consistent results across platforms.

  This change updates `LocationExtensions.android.cs` to:

  1. Prefer `MslAltitudeMeters` when the device runs Android 34+ and
     `HasMslAltitude` is `true`, reporting
     `AltitudeReferenceSystem.Geoid`.
  2. Fall back to the existing `Altitude` / `Ellipsoid` path on older
     devices or when MSL altitude is not available.
  3. Report `AltitudeReferenceSystem.Unspecified` when no altitude is
     available at all (previously this case was reported as
     `Ellipsoid` even though `Altitude` was `null`).

  The MSL preference is opaque to callers — `Location.Altitude` keeps
  the same shape and semantics; consumers that care about the reference
  system can inspect `AltitudeReferenceSystem` as before.

  ### Issues Fixed

  Fixes #27554

  ### Tested

- Code change is guarded by
`OperatingSystem.IsAndroidVersionAtLeast(34)`
    so older devices are unaffected.
- Device validation for Android 34+ devices to confirm
`MslAltitudeMeters`
is surfaced will rely on existing `Geolocation_Tests.cs` device tests
    exercised on CI.

  ---

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@PureWeen PureWeen mentioned this pull request Jun 2, 2026
PureWeen added a commit that referenced this pull request Jun 2, 2026
## What's Coming

.NET MAUI inflight/candidate introduces significant improvements across
all platforms with focus on quality, performance, and developer
experience. This release includes 85 commits with various improvements,
bug fixes, and enhancements.


## Button
- [Android, iOS] Button: Fix VisualState properties not restored when
leaving custom state by @BagavathiPerumal in
#33346
  <details>
  <summary>🔧 Fixes</summary>

- [Button VisualStates do not
work](#19690)
  </details>

## CollectionView
- Fix CollectionView grid spacing updates for first row and column by
@KarthikRajaKalaimani in #34527
  <details>
  <summary>🔧 Fixes</summary>

- [[MAUI] I2_Vertical grid for horizontal Item Spacing and Vertical Item
Spacing - horizontally updating the spacing only applies to the second
column](#34257)
  </details>

- CarouselView: Fix cascading PositionChanged/CurrentItemChanged events
on collection update by @praveenkumarkarunanithi in
#31275
  <details>
  <summary>🔧 Fixes</summary>

- [[Windows] CurrentItemChangedEventArgs and PositionChangedEventArgs
Not Working Properly in
CarouselView](#29529)
  </details>

- [Windows] Fixed ItemSpacing doesn't work in Carousel View by
@SubhikshaSf4851 in #30014
  <details>
  <summary>🔧 Fixes</summary>

- [ItemSpacing on CarouselView is not applied on
Windows.](#29772)
  </details>

- Fix CollectionView not scrolling to top on iOS status bar tap by
@jfversluis in #34687
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] UICollectionView ScrollToTop does not
work](#19866)
  </details>

- [iOS] Fixed CollectionView Scroll Jitter for TextType HTML Labels by
@SubhikshaSf4851 in #34383
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView scrolling is jittery when ItemTemplate contains Label
with TextType="Html" in .NET
10](#33065)
  </details>

- Fix CollectionView Header is not visible when ItemsSource is not set
and an EmptyView is set in iOS, Mac platform by @KarthikRajaKalaimani in
#34989
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView Header is not visible when ItemsSource is not set and
EmptyView is set in iOS, Mac
platform](#34897)
  </details>

- [Android] Fix CollectionView EmptyView not displayed correctly by
@KarthikRajaKalaimani in #34956
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] CollectionView - EmptyView not displayed
correctly](#34861)
  </details>

- [iOS] Fix CollectionView ScrollOffset not resetting when ItemsSource
changes by @SyedAbdulAzeemSF4852 in
#34488
  <details>
  <summary>🔧 Fixes</summary>

- [[IOS] CollectionView ScrollOffset does not reset when the ItemSource
is changed in iOS.](#26366)
- [Re-enable Issue7993 test on iOS/Catalyst - CollectionView scroll
position not reset when updating
ItemsSource](#33500)
  </details>

- [Revert] [iOS] Fixed CollectionView Scroll Jitter for TextType HTML
Labels by @SubhikshaSf4851 in #35341

## Core Lifecycle
- [Android] Fix NRE in ContainerView when Android Context is null during
lifecycle transition by @rmarinho in
#34901
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] NullReferenceException in NavigationRootManager.Connect
when mapping Window
content](#34900)
  </details>

## DateTimePicker
- [Android] Fix for TimePicker Dialog doesn't update the layout when
rotating the device with dialog open by @HarishwaranVijayakumar in
#31910
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] TimePicker Dialog doesn't update the layout when rotating
the device with dialog
open](#31658)
  </details>

- [Android, iOS] Fixed TimePicker FlowDirection Not Applied Across
Platforms by @Dhivya-SF4094 in #30369
  <details>
  <summary>🔧 Fixes</summary>

- [TimePicker FlowDirection Not Working on All
Platforms](#30192)
  </details>

- [Windows] Fixed TimePicker CharacterSpacing issue by @SubhikshaSf4851
in #30533
  <details>
  <summary>🔧 Fixes</summary>

- [[Windows] TimePicker CharacterSpacing Property Not Working on
Windows](#30199)
  </details>

- [MacCatalyst] Fix DatePicker Opened/Closed events not being raised by
@SubhikshaSf4851 in #34970
  <details>
  <summary>🔧 Fixes</summary>

- [[MacCatalyst] DatePicker Opened and Closed events are not raised on
Mac platform](#34848)
  </details>

## Dialogalert
- [Android] Fix AlertDialog, ActionSheet, and Prompt render with
Material 2 styles when Material 3 is enabled by @HarishwaranVijayakumar
in #35121
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] AlertDialog, ActionSheet, and Prompt render with Material 2
styles when Material 3 is
enabled](#35119)
  </details>

## Docs
- docs: Add UITesting-Guide, ReleasePlanning, and ReleaseProcess to
docs/README.md index by @PureWeen in
#35195

- docs: Fix hardcoded path and add library overview in Essentials.AI
README by @PureWeen in #35194

- docs: Update branch reference from net10.0 to net11.0 in
DEVELOPMENT.md by @PureWeen in #35193

## Drawing
- Fix Path Rendering Issue Inside StackLayout When Margin Is Set by
@Shalini-Ashokan in #28071
  <details>
  <summary>🔧 Fixes</summary>

- [Path does not render if it has
Margin](#13801)
  </details>

- Fixed FlowDirection property not working on Drawable control and
GraphicsView by @Dhivya-SF4094 in
#34557
  <details>
  <summary>🔧 Fixes</summary>

- [[Android, Windows, iOS, macOS] FlowDirection property not working on
BoxView Control](#34402)
  </details>

- [iOS & Mac] Fix image tile misalignment in GraphicsView ImagePaint by
@SubhikshaSf4851 in #34935
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Image resized with ResizeMode.Fit is not rendered correctly in
GraphicsView](#34755)
  </details>

- Fix Shadow does not honour Styles by @KarthikRajaKalaimani in
#35081
  <details>
  <summary>🔧 Fixes</summary>

- [Shadow does not honour
Styles](#19560)
  </details>

## Entry
- [iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set
to null by @Shalini-Ashokan in #34741
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS, Maccatalyst] Entry & Editor BackgroundColor not reset to
Null](#34611)
  </details>

- [Windows] Fix password Entry crash when setting text on empty field by
@praveenkumarkarunanithi in #33891
  <details>
  <summary>🔧 Fixes</summary>

- [[WinUI] Password Obfuscation causes unhandled
crash](#33334)
  </details>

## Essentials
- [Essentials] Use mean sea level altitude on Android API 34+ by
@KitKeen in #35097
  <details>
  <summary>🔧 Fixes</summary>

- [Add support for MslAltitudeMeters in Essentials Geolocation on
Android](#27554)
  </details>

## Flyout
- Fixed Flyout Not Displayed on Android When FlyoutWidth Is Set Only for
Desktop via OnIdiom by @NanthiniMahalingam in
#29028
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] FlyoutWidth with OnIdiom shows no
flyout](#13243)
  </details>

- Revert "[Windows] Fix Flyout/Locked mode header collapse regression
causing UI test failures on candidate branch" by @kubaflo in
#35339

- Revert "Revert "[Windows] Fix Flyout/Locked mode header collapse
regression causing UI test failures on candidate branch"" by @kubaflo in
#35342

## Flyoutpage
- Fix [Android] Title of FlyOutPage is not updating anymore after
showing a NonFlyOutPage by @KarthikRajaKalaimani in
#34839
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] Title of FlyOutPage is not updating anymore after showing a
NonFlyOutPage](#33615)
  </details>

## Label
- [iOS] Fix span Tap gesture on wrapped Label lines in iOS 26+ by
@SubhikshaSf4851 in #34640
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS]Span TapGestureRecognizer does not work on the second line of
the span, if the span is wrapped to the next
line](#34504)
  </details>

## Layout
- Fixed Stacklayout is not rendered when clip is applied and StackLayout
placed child to the Border control in iOS/ Mac platform by
@KarthikRajaKalaimani in #33330
  <details>
  <summary>🔧 Fixes</summary>

- [[Mac/iOS] StackLayout fails to render content while applying Clip,
and the layout is placed inside a Border with Background in .NET
MAUI](#33241)
  </details>

## Map
- Fix Changing Location on a Pin does nothing by @NirmalKumarYuvaraj in
#30201
  <details>
  <summary>🔧 Fixes</summary>

- [[Maps] [Regression from Xamarin.Forms.Maps] Changing Location on a
Pin does nothing](#12916)
  </details>

## Mediapicker
- [iOS] Fix HEIC images picked via PickPhotosAsync not displayed by
@HarishwaranVijayakumar in #34954
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] [Regression] HEIC images picked via PickPhotosAsync not
displayed](#34953)
  </details>

- [Android] Fix MediaPicker.PickPhotosAsync UnauthorizedAccessException
on API 28 and below by @HarishwaranVijayakumar in
#34981
  <details>
  <summary>🔧 Fixes</summary>

- [MediaPicker.PickPhotos fails to modify image, tries to load original
source, fails to load source on Android
9.0](#34889)
  </details>

## Pages
- [iOS] Fix ContentPage with ToolbarItem Clicked event leaks when
presented as modal page by @devanathan-vaithiyanathan in
#35009
  <details>
  <summary>🔧 Fixes</summary>

- [ContentPage with ToolbarItem Clicked event leaks when presented as
modal page](#34892)
  </details>

## Platform
- [Android] Fix OnBackButtonPressed not invoked for Shell by
@Dhivya-SF4094 in #35150
  <details>
  <summary>🔧 Fixes</summary>

- [On Screen Back Button Does Not Fire OnBackButtonPressed in
Android](#9095)
  </details>

## RadioButton
- Fix RadioButtonGroup not working with ContentView by @Dhivya-SF4094 in
#34781
  <details>
  <summary>🔧 Fixes</summary>

- [RadioButtonGroup not working with
ContentView](#34759)
  </details>

- [Windows] Fix for RadioButton BorderColor and BorderWidth not updated
at runtime by @SyedAbdulAzeemSF4852 in
#28335
  <details>
  <summary>🔧 Fixes</summary>

- [RadioButton Border color not working for focused visual
state](#15806)
  </details>

- [iOS] Fix RadioButton BackgroundColor bleeding outside CornerRadius by
@SyedAbdulAzeemSF4852 in #34844
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] RadioButton BackgroundColor bleeds outside
CornerRadius](#34842)
  </details>

## SafeArea
- [iOS] Fix stale bottom safe area after changing SafeAreaEdges with
keyboard open by @praveenkumarkarunanithi in
#35083
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] ContentPage bottom has white space after changing SafeAreaEdges
while keyboard is open](#34846)
  </details>

## ScrollView
- [Windows] Fix Preserve ScrollView offsets when Orientation changes to
Neither by @SubhikshaSf4851 in #34827
  <details>
  <summary>🔧 Fixes</summary>

- [[Windows] ScrollView offsets do not preserve when Orientation changes
to Neither](#34671)
  </details>

## Searchbar
- [iOS] Fix SearchBar unexpected left margin in iPad windowed mode on 26
Version by @SubhikshaSf4851 in #34704
  <details>
  <summary>🔧 Fixes</summary>

- [in iPad windowed mode SearchBar adds left margin equivaltent to
SafeAreaInsets when placed inside
grid](#34551)
  </details>

## Shell
- [Windows] Fix for Shell.FlyoutBehavior="Flyout" forces the title
height space above the tab bar even if the page title is empty by
@BagavathiPerumal in #30382
  <details>
  <summary>🔧 Fixes</summary>

- [(Windows) Shell.FlyoutBehavior="Flyout" forces the title height space
above the tab bar even if the page title is
empty](#30254)
  </details>

- Fix Shell flyout items scrolling behind FlyoutHeader on iOS by @Qythyx
in #34936
  <details>
  <summary>🔧 Fixes</summary>

- [Shell flyout items scroll behind FlyoutHeader on
iOS](#34925)
  </details>

- [iOS, Mac] Fix Shell.CurrentState.Location stale in OnNavigated after
GoToAsync by @Vignesh-SF3580 in
#34880
  <details>
  <summary>🔧 Fixes</summary>

- [Shell.OnNavigated not called for route
navigation](#34662)
  </details>

- [iOS26]Fix
BackButtonBehavior_IsEnabled_False_BackButtonDoesNotNavigate UITest
fails by @devanathan-vaithiyanathan in
#34890
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS 26] BackButtonBehavior_IsEnabled_False_BackButtonDoesNotNavigate
test fails with
TimeoutException](#34771)
  </details>

- [iOS] Fix Shell page memory leak when using TitleView with x:Name by
@Shalini-Ashokan in #35082
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Title view memory
leak](#34975)
  </details>

- [Material 3] Fix Material 2 color flash in AppBar when switching tabs
for the first time by @Dhivya-SF4094 in
#35117
  <details>
  <summary>🔧 Fixes</summary>

- [Material 3: AppBar briefly displays Material 2 colors when switching
tabs for the first time](#35116)
  </details>

- [Android] Fix Shell/TabbedPage "More" BottomSheet uses hard-coded M2
colors when Material3 is enabled by @HarishwaranVijayakumar in
#35129
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] Shell/TabbedPage "More" BottomSheet uses hard-coded M2
colors when Material3 is
enabled](#35127)
  </details>

- [Android] Shell: Fix top-tab unselected text visibility in Material 3
light theme by @SyedAbdulAzeemSF4852 in
#35128
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] Shell top-tab unselected text appears too faint in Material
3 light theme](#35125)
  </details>

- Fix Shell.Items.Clear() memory leak by disconnecting child handlers on
removal (#34898) by @Shalini-Ashokan in
#35031
  <details>
  <summary>🔧 Fixes</summary>

- [Shell.Items.Clear() does not disconnect handlers
correctly](#34898)
  </details>

- [iOS&Mac] Fix Shell SearchHandler Query update on Initial load by
@SubhikshaSf4851 in #35008
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS&Mac] Shell SearchHandler Query not shown in search bar on
initial load](#35005)
  </details>

## SwipeView
- [iOS,MacCatalyst] Fix for SwipeView.Open() throwing an
ArgumentException on the second programmatic call by @BagavathiPerumal
in #34982
  <details>
  <summary>🔧 Fixes</summary>

- [[net 11.0][iOS,MacCatalyst] SwipeView.Open() throws ArgumentException
on second programmatic
call](#34917)
  </details>

- [Android/iOS] Fix SwipeItem visibility change causing double command
execution in Execute mode by @praveenkumarkarunanithi in
#35087
  <details>
  <summary>🔧 Fixes</summary>

- [Changing visibility on an SwipeItem causes multiple items to be
executed](#7580)
  </details>

## Switch
- [iOS] Fix Switch ThumbColor reset on iOS 26+ theme changes. by
@Shalini-Ashokan in #33953
  <details>
  <summary>🔧 Fixes</summary>

- [Switch ThumbColor not Initialized Using VisualStateManager on iOS
Device](#33783)
- [I9-On macOS 26.2, the "Animate scroll" button is white by default on
iOS and Maccatalyst
platforms.](#33767)
  </details>

## TabbedPage
- [Windows] TabbedPage: Refresh layout when NavigationView size changes
by @BagavathiPerumal in #26217
  <details>
  <summary>🔧 Fixes</summary>

- [TabbedPage - ScrollView not allowing scrolling when it
should](#26103)
- [TabbedPage App on resize hides page bottom
content](#11402)
- [Grid overflows child ContentPage of parent TabbedPage on initial load
and when resizing on
Windows](#20028)
  </details>

- [Android] Material 3 Fixed BottomNavigationView overflowing in Tabbed
page by @NirmalKumarYuvaraj in #35064
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] Material3 - TabbedPage bottom tabs overflowing the
contents](#35063)
  </details>

- [Windows] Fix for Multiple Tabs Being Selected in WinUI TabbedPage by
@SyedAbdulAzeemSF4852 in #33312
  <details>
  <summary>🔧 Fixes</summary>

- [WinUI TabbedPage can have multiple tabs
selected](#31799)
  </details>

## Theming
- [iOS] Fix StaticResource Hot Reload crash on iOS by @StephaneDelcroix
in #35020
  <details>
  <summary>🔧 Fixes</summary>

- [The maui app quit and no errors in error list after editing
ResourceDictionary XAML file on iOS Simulator with MAUI SR6
10.0.60](#35018)
  </details>

## Toolbar
- [Windows] Fix for CS1061 build error caused by missing
HasMenuBarContent property in MauiToolbar by @BagavathiPerumal in
#35040

## Tooling
- Fix VisualStateGroups duplicate name crash with implicit styles
(#34716) by @StephaneDelcroix in
#34719
  <details>
  <summary>🔧 Fixes</summary>

- [SourceGen: VisualStateManager.VisualStateGroups causes 'Names must be
unique' at startup](#34716)
  </details>

## WebView
- Refactor the HybridWebView and properly support complex parameters by
@mattleibow in #32491

- [Android] Fix WebView scrolling inside ScrollView by @Shalini-Ashokan
in #33133
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] WebView's content does not scroll when placed inside a
ScrollView](#32971)
  </details>


<details>
<summary>🔧 Infrastructure (1)</summary>

- [Windows] Fix Narrator announcing ContentView children twice when
Description is set by @praveenkumarkarunanithi in
#33979
  <details>
  <summary>🔧 Fixes</summary>

- [[Windows] SemanticProperties.Description announced twice when set on
focusable container cell (Label
inside)](#33373)
  </details>

</details>

<details>
<summary>🧪 Testing (14)</summary>

- [Testing] SafeArea Feature Matrix Test Cases for ContentPage by
@TamilarasanSF4853 in #34877
- [Windows] Fix CollectionView ScrollTo related test cases failed in CI
by @HarishwaranVijayakumar in #34907
  <details>
  <summary>🔧 Fixes</summary>

- [[Testing][Windows]CollectionView ScrollTo related test cases failed
in CI](#34772)
  </details>
- [Testing] Fixed Build error on inflight/ candidate PR 35234 by
@HarishKumarSF4517 in #35241
- Fix CI for
ValidateKeyboardRuntime_SwitchContainerToSoftInput_WhileKeyboardOpen
test failure in May 4th Candidate by @devanathan-vaithiyanathan in
#35307
- [Windows] Fix Flyout/Locked mode header collapse regression causing UI
test failures on candidate branch by @BagavathiPerumal in
#35312
- [iOS/macCatalyst] [Candidate Fix] Editor shadow and theme regression
caused by BackgroundColor reset on initial handler connection by
@Shalini-Ashokan in #35343
- [Testing] Fixed UI test image failure in PR 35234 - [30/03/2026]
Candidate - 1 by @HarishKumarSF4517 in
#35325
- [iOS] Fix ShellFeatureMatrix test failures on candidate branch by
@Vignesh-SF3580 in #35346
- [Windows] Fix Issue29529VerifyPreviousPositionOnInsert test failure on
candidate branch by @praveenkumarkarunanithi in
#35398
- [Android] [Candidate Fix] Shell: Fix handler disconnect timing to
preserve WebView navigation and memory leak fix by @Shalini-Ashokan in
#35417
- [Testing]Revert 'Fix Preserve ScrollView offsets when Orientation
changes to Neither' by @TamilarasanSF4853 in
#35412
- [Windows] Fix VerifyAllIndicatorDotsShowShadowsWhenIndicatorSize test
failure on candidate branch by @praveenkumarkarunanithi in
#35458
- [Testing] Fixed test failure in PR 35234 - [05/08/2026] Candidate by
@TamilarasanSF4853 in #35362
- [Testing] Fixed test failure in PR 35234 - [05/04/2026] Candidate - 3
by @TamilarasanSF4853 in #35639

</details>

<details>
<summary>📦 Other (6)</summary>

- [UIKit] Avoid useless measure invalidation propagation cycles by
@albyrock87 in #33459
- BindableObject property access micro-optimizations by @albyrock87 in
#33584
- Extract filename from DisplayName and add extension if missing by
@mattleibow in #35050
- [core] Add keyed-DI screenshot extensibility for 3rd-party platform
backends by @Redth in #35096
  <details>
  <summary>🔧 Fixes</summary>

- [`ViewExtensions.CaptureAsync(IView)` and `IPlatformScreenshot` need
extensibility for third-party platform
backends](#34266)
  </details>
- Fix MainThread throwing on custom platform backends by @Redth in
#35070
  <details>
  <summary>🔧 Fixes</summary>

- [`MainThread.BeginInvokeOnMainThread` throws on custom platform
backends - Common UI-thread marshaling pattern crashes; `Dispatcher`
works but isn't the documented/recommended
path](#34101)
  </details>
- Tests: Add 11 missing UnitConverters unit tests by @PureWeen in
#35191

</details>

<details>
<summary>📝 Issue References</summary>

Fixes #7580, Fixes #9095, Fixes #11402, Fixes #12916, Fixes #13243,
Fixes #13801, Fixes #15806, Fixes #19560, Fixes #19690, Fixes #19866,
Fixes #20028, Fixes #26103, Fixes #26366, Fixes #27554, Fixes #29529,
Fixes #29772, Fixes #30192, Fixes #30199, Fixes #30254, Fixes #31658,
Fixes #31799, Fixes #32971, Fixes #33065, Fixes #33241, Fixes #33334,
Fixes #33373, Fixes #33500, Fixes #33615, Fixes #33767, Fixes #33783,
Fixes #34101, Fixes #34257, Fixes #34266, Fixes #34402, Fixes #34504,
Fixes #34551, Fixes #34611, Fixes #34662, Fixes #34671, Fixes #34716,
Fixes #34755, Fixes #34759, Fixes #34771, Fixes #34772, Fixes #34842,
Fixes #34846, Fixes #34848, Fixes #34861, Fixes #34889, Fixes #34892,
Fixes #34897, Fixes #34898, Fixes #34900, Fixes #34917, Fixes #34925,
Fixes #34953, Fixes #34975, Fixes #35005, Fixes #35018, Fixes #35063,
Fixes #35116, Fixes #35119, Fixes #35125, Fixes #35127

</details>

**Full Changelog**:
main...inflight/candidate
@PureWeen PureWeen modified the milestones: .NET 10 SR7, .NET 10 SR8 Jun 11, 2026
Shalini-Ashokan pushed a commit to Shalini-Ashokan/maui that referenced this pull request Jun 15, 2026
…5097)

Fixes dotnet#27554.

  Android API level 34 introduced

[`Location.getMslAltitudeMeters()`](https://developer.android.com/reference/android/location/Location#getMslAltitudeMeters()),
  which reports altitude measured against the geoid (mean sea level).
  The existing implementation always reads the WGS84 ellipsoidal
  altitude, which is reported inconsistently with iOS and Windows where
  altitude is typically expressed against the geoid. As the issue notes,
  this forces consumers to apply manual geoid corrections to get
  consistent results across platforms.

  This change updates `LocationExtensions.android.cs` to:

  1. Prefer `MslAltitudeMeters` when the device runs Android 34+ and
     `HasMslAltitude` is `true`, reporting
     `AltitudeReferenceSystem.Geoid`.
  2. Fall back to the existing `Altitude` / `Ellipsoid` path on older
     devices or when MSL altitude is not available.
  3. Report `AltitudeReferenceSystem.Unspecified` when no altitude is
     available at all (previously this case was reported as
     `Ellipsoid` even though `Altitude` was `null`).

  The MSL preference is opaque to callers — `Location.Altitude` keeps
  the same shape and semantics; consumers that care about the reference
  system can inspect `AltitudeReferenceSystem` as before.

  ### Issues Fixed

  Fixes dotnet#27554

  ### Tested

- Code change is guarded by
`OperatingSystem.IsAndroidVersionAtLeast(34)`
    so older devices are unaffected.
- Device validation for Android 34+ devices to confirm
`MslAltitudeMeters`
is surfaced will rely on existing `Geolocation_Tests.cs` device tests
    exercised on CI.

  ---

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Dhivya-SF4094 pushed a commit to Dhivya-SF4094/maui that referenced this pull request Jun 15, 2026
…5097)

Fixes dotnet#27554.

  Android API level 34 introduced

[`Location.getMslAltitudeMeters()`](https://developer.android.com/reference/android/location/Location#getMslAltitudeMeters()),
  which reports altitude measured against the geoid (mean sea level).
  The existing implementation always reads the WGS84 ellipsoidal
  altitude, which is reported inconsistently with iOS and Windows where
  altitude is typically expressed against the geoid. As the issue notes,
  this forces consumers to apply manual geoid corrections to get
  consistent results across platforms.

  This change updates `LocationExtensions.android.cs` to:

  1. Prefer `MslAltitudeMeters` when the device runs Android 34+ and
     `HasMslAltitude` is `true`, reporting
     `AltitudeReferenceSystem.Geoid`.
  2. Fall back to the existing `Altitude` / `Ellipsoid` path on older
     devices or when MSL altitude is not available.
  3. Report `AltitudeReferenceSystem.Unspecified` when no altitude is
     available at all (previously this case was reported as
     `Ellipsoid` even though `Altitude` was `null`).

  The MSL preference is opaque to callers — `Location.Altitude` keeps
  the same shape and semantics; consumers that care about the reference
  system can inspect `AltitudeReferenceSystem` as before.

  ### Issues Fixed

  Fixes dotnet#27554

  ### Tested

- Code change is guarded by
`OperatingSystem.IsAndroidVersionAtLeast(34)`
    so older devices are unaffected.
- Device validation for Android 34+ devices to confirm
`MslAltitudeMeters`
is surfaced will rely on existing `Geolocation_Tests.cs` device tests
    exercised on CI.

  ---

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution s/agent-fix-win AI found a better alternative fix than the PR s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for MslAltitudeMeters in Essentials Geolocation on Android

5 participants