dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.83k stars 1.67k forks source link

Simulator server fail when running on alternative xcode path #23283

Open amodaresi-archerpoint-com opened 1 week ago

amodaresi-archerpoint-com commented 1 week ago

Description

I have a setup with Visual Studio 2022/net8/windows11 and a Macbook Pro M3 with xcode 15.4 and mono framework, Running Hello world on net 8 works great. Visual studio pairs to Mac, compiles, links and runs the ios simulators nicely.

I need to run net7. For this purpose I have installed xcode 14.3 as well in the mac /Applications folder. Added the alternative path to visual studio. Visual studio then compiles, links and attempts to run the simulator. It goes into a connecting, checking server, connected loop. I did try the suggested remedy in https://learn.microsoft.com/en-us/dotnet/maui/ios/remote-simulator?view=net-maui-8.0#troubleshooting without success

For every loop, I get a new file in the ~/Library/Logs/Xamarin/Simulator.Server folder. The content of the file is a null pointer reference exception (see attached file) Running the same simulator on mac with xcode 14.3 works just fine.

Simulator.Server.2024-06-26__09-47-35-2555.log

Steps to Reproduce

  1. Install xcode 14.3 as a secondary xcode
  2. give the path to visual studio on windows
  3. compile and debug a net maui 7.0 hello world app

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

tried simulators ios 16.4 and 17.5

Did you find any workaround?

No

Relevant log output

Startup:
    version: 17.6.0.524 (6fbf037)
Connection made:
    Connection ID: 1
    Disconnected previous: False
    Previous ID: -
Xcode search:
    Supplied path: /Applications/Xcode_14_3.app
    xcode-select: False
    Final path: /Applications/Xcode_14_3.app
Xcode found:
    Xcode Version: 14.3
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoTouch.Hosting.DeviceConfig.set_DeviceType (Bindings.SimDeviceType value) [0x00000] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at MonoTouch.Hosting.DeviceConfig..ctor (Bindings.CoreSimulator cs, Bindings.SimRuntime runtime, Bindings.SimDeviceType deviceType) [0x00014] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at MonoTouch.Hosting.DeviceConfig..ctor (Bindings.CoreSimulator cs, Bindings.SimDevice device) [0x0000e] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at MonoTouch.Hosting.DeviceSet.AddDevice (Bindings.SimDevice simDevice, MonoTouch.Hosting.DeviceConfig config) [0x0005f] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at MonoTouch.Hosting.DeviceSet..ctor (Bindings.CoreSimulator cs, System.Func`2[T,TResult] getDeviceSet) [0x000a5] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at MonoTouch.Hosting.DeviceSet.GetDeviceSet (MonoTouch.Hosting.XcodeInfo xcode, System.Func`2[T,TResult] getDeviceSet) [0x00010] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at MonoTouch.Hosting.DeviceSet.GetDefaultDeviceSet (MonoTouch.Hosting.XcodeInfo xcode) [0x00000] in <c24d6390d8644b3594a1fda95d2f3de5>:0 
  at Xamarin.Simulator.Server.SimulatorServer.BuildCapabilities (System.String newPath) [0x0026d] in <098c0a52fa2f4896b074004cb41e2a57>:0 
  at Xamarin.Simulator.Server.SimulatorServer.OnRequestCapabilitiesMessage (Tempest.MessageEventArgs`1[T] e) [0x00059] in <098c0a52fa2f4896b074004cb41e2a57>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) [0x00000] in <207d12884485488d9288cc8cbf474289>:0 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <207d12884485488d9288cc8cbf474289>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <207d12884485488d9288cc8cbf474289>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <207d12884485488d9288cc8cbf474289>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <207d12884485488d9288cc8cbf474289>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <207d12884485488d9288cc8cbf474289>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <207d12884485488d9288cc8cbf474289>:0
github-actions[bot] commented 1 week ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

amodaresi-archerpoint-com commented 1 week ago

Here is the log on the windows side: Startup: arguments: --device=5AF25C35-0DD6-4776-B9C1-92E2FA8930B3 --mlaunch=/Users/anmo/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.iOS.Sdk/16.4.7142/tools/bin/mlaunch --launchsim=//Users/anmo/Library/Caches/Xamarin/mtbs/builds/MauiApp1/75bd00036887ea966bf7a0907c59db09c8ec5417a1f7fe67cac687fadb6d52ff/bin/Debug/net7.0-ios/iossimulator-arm64/MauiApp1.app -argument=-monodevelop-port -argument=59239 -setenv=__XAMARIN_DEBUG_PORT__=59239 --sdkroot=/Applications/Xcode_14_3.app -h=192.168.1.251 -ssh=My Name version: 17.6.0.524 (6fbf037fe377bc629637183dd5ac69df8194404f) Connection state changed: State: Connecting SSH Connect: target: 192.168.1.251 Using SSH pass phrase SSH connected Connection state changed: State: SshConnected Connection state changed: State: CheckingServer Connection state changed: State: SettingUpServer Starting server [Server] ready:60408 Connection state changed: State: Connecting Connection state changed: State: CheckingServer Connection state changed: State: Connected Connection state changed: State: Disconnected

amodaresi-archerpoint-com commented 1 week ago

I found a workaround, kind of. If I disable "remote simulator to windows" in options/xamarin/ios settings, at least the simulator launches on the mac. Reverting back, creates the problem again, the simulator won't launch in windows.

dotnet-policy-service[bot] commented 1 week ago

Thanks for the issue report @amodaresi-archerpoint-com! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.
dotnet-policy-service[bot] commented 1 week ago

Thanks for the issue report @amodaresi-archerpoint-com! This issue appears to be a problem with Visual Studio (Code), so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS (Code).

If you encounter a problem with Visual Studio or the .NET MAUI VS Code Extension, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or .NET MAUI VS Code Extension repository to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.
amodaresi-archerpoint-com commented 1 week ago

Hi @PureWeen I don't see why this would be a VS issue, specifically part of the stack trace is by Xamarin.Simulator.Server.SimulatorServer.BuildCapabilities unless you care to explain further

drasticactions commented 1 week ago

@amodaresi-archerpoint-com The MAUI team doesn't maintain this tooling, Visual Studio does. The MAUI team can't fix this and it's unrelated to what they work on.

I am the person maintaining that tooling at the moment. Yes, you should file that issue through VSFeedback, and I can look at it when I can.