Select to view content in your preferred language

.NET MAUI 8 + v200.3: App crashes on page change when location is active

2680
5
12-27-2023 07:55 AM
SokoFromNZ
Regular Contributor

Hello,

Coming from this issue I have found an even more severe one with the current versions of MAUI & ArcGIS Runtime on Android which renders the whole runtime non-usable!

This is a standard .NET8 MAUI app with two pages:

Page 1: Plain ArcGIS Map with location enabled:

using System;
using System.Threading;
using System.Threading.Tasks;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.UI;
using Microsoft.Maui.Devices.Sensors;
using Map = Esri.ArcGISRuntime.Mapping.Map;

namespace ArcGISTry1;

public partial class MainPage
{
    public MainPage()
    {
        InitializeComponent();

        // Create the UI, setup the control references and execute initialization
        _ = Initialize();
    }

    private async Task Initialize()
    {
        // Just to ask for users permission
        await GetCurrentLocation();

        // Set map to mapview
        MyMapView.Map = new Map(BasemapStyle.OSMLightGray);
        MyMapView.Loaded += MyMapViewOnLoaded;
    }

    void MyMapViewOnLoaded(object? sender, EventArgs e)
    {
        MyMapView.LocationDisplay.IsEnabled = true;
        MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Navigation;
    }

    public async Task GetCurrentLocation()
    {
        try
        {

            GeolocationRequest request = new GeolocationRequest(GeolocationAccuracy.Medium, TimeSpan.FromSeconds(10));

            var cancelTokenSource = new CancellationTokenSource();

            var location = await Geolocation.Default.GetLocationAsync(request, cancelTokenSource.Token);

            if (location != null)
                Console.WriteLine($"Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}");
        }
        // Catch one of the following exceptions:
        //   FeatureNotSupportedException
        //   FeatureNotEnabledException
        //   PermissionException
        catch (Exception ex)
        {
            // Unable to get location
        }
    }
}

 

Page 2 is just a plain text input.

When changing pages to page 2 and back again the app crashes.

Only thing I get with attached Visual Studio 17.8.3 (see last line):

[EGL_emulation] app_time_stats: avg=228.13ms min=13.63ms max=4884.68ms count=23
[OnBackInvokedCallback] OnBackInvokedCallback is not enabled for the application.
[OnBackInvokedCallback] Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
[TabLayout] MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
[TextureView] onSurfaceTextureAvailable
[TextureView] onSurfaceTextureAvailable done
[TextureView] Starting pulse
[libc] Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40 in tid 11029 (Rendering threa), pid 10965 (name.arcgistry1)

 

Find the full solution attached.

Please help!

PS: It does not matter if the location moves between leaving and coming back to the map page.

5 Replies
PreetiMaske
Esri Regular Contributor

Thanks for reporting it to us, I am able to reproduce the issue and have a logged a bug in our system. We will investigate it further next week. I will report back here if we find a way to workaround the crash.

pshearon
Emerging Contributor

The problem is the Ping Animation, whenever that tries to happen the system crashes. In order to get around this for now you can issue  MyMapView.LocationDisplay.ShowPingAnimationSymbol = false;

This will stop you from crashing but you will not get the ping animation.

PreetiMaske
Esri Regular Contributor

FYI, We have fixed the issue in 200.5 tentatively to be released mid-August.

SokoFromNZ
Regular Contributor

Thanks for the update,

The way more pressing issue is this one as we cannot deliver a new version of our app since months now!

https://community.esri.com/t5/net-maps-sdk-questions/net-8-maui-8-big-memory-leak-in-mapview-on-andr...

Can you please have a look at this?

thanks

Soko

0 Kudos
PreetiMaske
Esri Regular Contributor

Good news!  ArcGIS Maps SDK version 200.5.0 was just released today and the crash on navigation issue is fixed with this release.

Thank you for bringing this one to our attention!

 

As regards to your other issue, unfortunately, we are not able to reproduce the memory leak with .NET on Android or with ArcGIS Maps SDK for Kotlin counterpart, with same data. We don't see any noticeable increase in memory spikes.

0 Kudos