MAUI - Error on iOS when targeting .NET 8 (in CoreArcGISRuntimeEnvironment.SetInstallDirectory)

5093
9
Jump to solution
10-23-2023 09:01 PM
Labels (2)
DavidSchuster
Occasional Contributor

Hello!

Is .NET 8 (net8.0-ios) supported as a target framework for the .NET Maps SDK for MAUI?

I'm using Microsoft Visual Studio Professional 2022 (64-bit) - Preview Version 17.8.0 Preview 3on Windows OS and deploying/debugging to an iPhone using HotReload.

If I create a new project using the ArcGIS Maps SDK .NET MAUI App (Esri) template, the app builds and runs fine when deployed to iOS and Windows (targeting .NET 7).  However, when I edit the project settings and change the target framework to .NET 8, it stops working on iOS (it still runs on Windows though).  It crashes right away during the builder call to .UseArcGISRuntime()

Any ideas?  Thanks in advance!

-David

Here's the exception call stack:

[0:] An error occurred: '__Internal'. Callstack: ' at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.SetInstallDirectory(String installPath)
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitNative()
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitializeRuntimeCore()
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize(Action`1 configure)
at Esri.ArcGISRuntime.Maui.AppHostBuilderExtensions.UseArcGISRuntime(MauiAppBuilder builder, Action`1 configure)
at MauiArcGISApp1.MauiProgram.CreateMauiApp() in C:\Users\dschuster\source\GitHub\MauiArcGISApp1\MauiArcGISApp1\MauiProgram.cs:line 29
at MauiArcGISApp1.AppDelegate.CreateMauiApp() in C:\Users\dschuster\source\GitHub\MauiArcGISApp1\MauiArcGISApp1\Platforms\iOS\AppDelegate.cs:line 8
at Microsoft.Maui.MauiUIApplicationDelegate.WillFinishLaunching(UIApplication application, NSDictionary launchOptions)
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
at MauiArcGISApp1.Program.Main(String[] args) in C:\Users\dschuster\source\GitHub\MauiArcGISApp1\MauiArcGISApp1\Platforms\iOS\Program.cs:line 13
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)'
2023-10-23 22:36:40.873 Xamarin.PreBuilt.iOS[1723:8025329] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor
9 Replies
dotMorten_esri
Esri Notable Contributor

Are you remote-deploying from Windows via a Mac, or with an iPhone connected directly to Windows using Hot Restart?
Remote deploy works for me with 200.2 - just note that xcode 15 currently doesn't work due to this issue: https://github.com/xamarin/xamarin-macios/issues/19157 (workaround in issue, or downgrade to xcode 14).

v200.3 will have official support for .NET 8.

0 Kudos
DavidSchuster
Occasional Contributor

Hi Morten, thanks for your reply.

I'm using Hot Restart with an iPhone connected directly to my Windows machine (my apologies - I typed "Hot Reload" earlier when I meant "Hot Restart").

This Hot Restart option is the most practical for our dev team due to some current hardware and network policy limitations.  Do you think this issue might be resolved in the 200.3 release?

Thank you for your work on the MAUI Maps SDK - we're really excited about this cross-platform technology!

-David

0 Kudos
PreetiMaske
Esri Regular Contributor

Thanks to you for using our SDK. 

>Do you think this issue might be resolved in the 200.3 release

It is a Microsoft's bug, we can only hope it gets fixed in .NET 8.

 

 

0 Kudos
DavidSchuster
Occasional Contributor

Thanks Preeti - keeping my fingers crossed that Microsoft fixes it!

0 Kudos
PreetiMaske
Esri Regular Contributor

Just to clarity @DavidSchuster , The bug I am referring to was deployment issue XCode and .NET 8 https://github.com/xamarin/xamarin-macios/issues/19157

As per your original issue with Hot-restart , we are still trying to reproduce. Will keep you posted what we find.

0 Kudos
dotMorten_esri
Esri Notable Contributor

I've reproduced the issue. It does appear that the .NET 8 RC2 SDK has introduced a regression and doesn't deploy the native references. The moment I switch back to the .NET 7 SDK things are fine again.

0 Kudos
dotMorten_esri
Esri Notable Contributor
DavidSchuster
Occasional Contributor

Morten, thank you for tracking this down and entering the Xamarin ticket!

0 Kudos
DavidSchuster
Occasional Contributor

I've confirmed that this was fixed in the recent .NET 8 release.  Thanks again!

0 Kudos