Repository navigation
Description
Apple platform
iOS
Framework version
net9.0-*
Affected platform version
.NET 9.0.305
Description
I tried migrating my app to .NET 9 iOS, but I ran into an issue: there’s a bug that prevents me from launching the iOS Simulator on my Mac. To double-check, I created a clean net9-ios project with dotnet new ios and tested it.
When I use the .NET 8 SDK and build/launch a .NET 8 iOS app, everything works fine. But when I try with the .NET 9 SDK and a .NET 9 iOS project, it fails with an exception.
error MT0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Text.Json.JsonElement.GetProperty(String)
at Xamarin.Hosting.SimulatorDevice.From(JsonElement, String) in /Users/builder/azdo/_work/4/s/src/Xamarin.Hosting/Xamarin.Hosting/SimCtlDevice.cs:line 44
at Xamarin.Hosting.Services.LoadSimCtlInfoAsync(Boolean ) in /Users/builder/azdo/_work/4/s/src/Xamarin.Hosting/Xamarin.Hosting/Services.cs:line 1480
at Xamarin.Hosting.Services.GetSupportedRuntimesAsync(Boolean ) in /Users/builder/azdo/_work/4/s/src/Xamarin.Hosting/Xamarin.Hosting/Services.cs:line 1516
at Xamarin.Launcher.SimController.ListSimulatorsAsync(String) in /Users/builder/azdo/_work/4/s/src/Xamarin.Hosting/Xamarin.Launcher/controller-simulator.cs:line 243
at Xamarin.Launcher.Driver.MainAsync() in /Users/builder/azdo/_work/4/s/src/Xamarin.Hosting/Xamarin.Launcher/Main.cs:li
this is the command
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net9.0_18.5/18.5.9219/tools/bin/mlaunch --launchsim /Users/andrey/Desktop/xxx/bin/Debug/net9.0-ios/iossimulator-arm64/xxx.app --device=:v2:udid=FF7BEED0-6BAB-49CC-81D2-E05BD0399DD1 -sdk 18.6 --argument=-monodevelop-port --argument=10001 --setenv=__XAMARIN_DEBUG_PORT__=10001 --sdkroot /Applications/Xcode.app/Contents/Developer
Exactly the same command but using .net8 works fine.
I use .net 9.0.305 + Xcode 16.4 + iOS simulator 18.6 and 18.2
Steps to Reproduce
- Instal Xcode 14.6 and use net9 SDK
- Create empty .net9-ios project
- Try to run debug on iOS Simulator from IDE like Rider or from terminal
Did you find any workaround?
No
Relevant logs
No response
Activity
rolfbjarne commentedon Sep 17, 2025
Can you run this on your mac, and attach the resulting
output.jsonfile here?zoooN commentedon Sep 17, 2025
@rolfbjarne here you go
output.json
rolfbjarne commentedon Sep 17, 2025
Thanks, can you try running this and see if that fixes the problem?
zoooN commentedon Sep 17, 2025
@rolfbjarne Awesome, it works perfectly! You’re a lifesaver 🙌 I've been struggling with this for 2 days.
Can I ask why exactly
DC4D0FBA-9E51-4683-85C9-183195E8D292?There are a lot similar records with availabilityError field.
rolfbjarne commentedon Sep 17, 2025
It's missing the
deviceTypeIdentifierfield, which no other device does in the json file.zoooN commentedon Sep 17, 2025
@rolfbjarne Thanks for the explanation! Doesn’t this show that we can just ignore badly formatted devices without failing the whole task?
rolfbjarne commentedon Sep 18, 2025
Yes, and that's exactly what the fix is going to be too.
Bump mlaunch to get fix for #23833.
Bump mlaunch to get fix for #23833. (#23840)
mozahid commentedon Oct 3, 2025
Thanks rolbjarne - I tried looking up in chatgpt and all they told to disable extensions. Certainly AI is still way behind