How to Debug Remote MAUI App Launch

Marc George 191 Reputation points
2025-07-01T10:53:00.0633333+00:00

I have a .NET 9 MAUI app being deployed to a remote Xcode iOS iPhone 16 Plus. All components have the latest release software. The deployment is successful, and the application is launched and the splash screen displayed on the phone. However, the first line of code, "InitializeComponent()" with a breakpoint applied is never reached. The app is terminated and the following debug output is generated.

INFO: Closing debug connection from device (USB) INFO: Disposing input and output streams... ERROR: An error occurred when writing to the output stream. Details: net_io_readfailure, Operation canceled INFO: Disposing input and output streams... INFO: Closing debug connection from remote debugger (TCP) ERROR: An error occurred while writing to the debug stream. Details: ObjectDisposed_Generic ObjectDisposed_ObjectName_Name, UsbStream INFO: Disposing console and debugger streams... INFO: An error occurred while forwarding HotReload local tunnel: System.IO.IOException: USB connect timeout (ENODATA), likely because the app failed to launch. Please review device logs and/or crash reports for more information. at Xamarin.MacDev.AggregateAsyncResult.CheckError(Boolean cancelled) at Xamarin.MacDev.IPhoneDevice.EndConnectStream(IAsyncResult result) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location --- at Xamarin.Messaging.IDB.IPhoneUsbLocalTunnelConnection.StartLocalTunnelAsync() at Xamarin.Messaging.IDB.LaunchAppMessageHandler.ForwardLocalTunnelsAsync(LaunchAppMessage, IPhoneDevice) ERROR: [iOS HotReload] Failed to connect to "iRogue" over USB on port 11000.

What is necessary to debug/fix the problem?

Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

10 answers

Sort by: Most helpful
  1. Gade Harika (INFOSYS LIMITED) 330 Reputation points Microsoft External Staff
    2025-07-09T12:33:39.6833333+00:00

    Thank you for sharing the details

    If you're still seeing debugger tunnel failures on port 11000 or wondering whether it’s actually open, the key thing to remember is that Visual Studio uses that port as a local bridge for USB communication—it’s not an internet-facing port that needs traditional firewall “open” rules. It just needs to be free, accessible, and unblocked locally on your development machine or Mac build host.

    If you're dealing with debugging issues, especially MAUI app crashes before InitializeComponent() runs, you can isolate root causes by:

    Disabling Hot Reload (it often destabilizes the tunnel)

    Checking whether another app is occupying port 11000 (netstat -ano)

    Inspecting crash logs in Xcode’s Devices window

    Testing the app over Wi-Fi instead of USB

    Deploying a minimal MAUI app to check baseline behavior

    And if you're planning to try Android next week, you’ll likely have smoother results—Android debugging uses ADB rather than WebSocket tunnels, and is usually less sensitive to port issues.

    Let me know if the issue persists after following these steps. I’ll be happy to assist further if needed.

    1 person found this answer helpful.

  2. Gade Harika (INFOSYS LIMITED) 330 Reputation points Microsoft External Staff
    2025-07-02T11:01:32.1133333+00:00

    Thank you for sharing the details and debug output.

    Here are a few steps you can try to resolve this:

    Recommended Troubleshooting Steps:

    Ensure Unpacked Deployment: Since remote debugging requires deploying an unpackaged version of your app, make sure you are following the steps outlined for publishing your app using the CLI or by modifying your launch settings. You can check the process in the "Remote Debugging a .NET MAUI app" documentation to ensure that the deployment is correct.

    1. Update All Software: Ensure that Xcode, iOS on your iPhone, Visual Studio, and .NET MAUI workloads are all up to date. 
    2. Trust the Computer on iPhone: Reconnect your iPhone via USB. Make sure the device trusts the Mac/PC, and check for the "Trust This Computer" popup on the phone.
    3. Reset USB Connection: Disconnect and reconnect the iPhone. Use a different USB cable and USB port. Restart both your development machine and the iPhone.
    4. Check Device Logs and Crash Reports: Open Xcode > Devices and Simulators, select your device, and review the device logs for app crash or launch issues.
    5. Kill rogue mtouch processes (Mac only): Sometimes background processes like mtouch or launchd interfere. Restarting the machine or manually killing such processes via Terminal might help. 
    6. Disable Hot Reload Temporarily: In Visual Studio, disable Hot Reload for MAUI and try deploying again to isolate the issue.
    7. Manual Provisioning Profile Check: Ensure correct provisioning profiles and code signing are set for the app in Visual Studio > iOS Bundle Signing.

    If the issue persists after following the above steps, please let us know the following for deeper investigation:

    Visual Studio version

    .NET MAUI version

    Xcode and iOS versions

    Whether the same issue occurs on a simulator

    We’ll be glad to help further based on the additional details.


  3. Gade Harika (INFOSYS LIMITED) 330 Reputation points Microsoft External Staff
    2025-07-04T08:36:57.7266667+00:00

    Thank you for sharing the details and debug output.

    Here are a few steps you can try to resolve this:

    This indicates Hot Reload or remote debugging transport is being blocked or unstable, usually because of:

     

    1. Improper provisioning/profile signing
    2. Background USB/mTouch or usbmuxd process conflicts
    3. Tunnel or port (11000) being blocked or timed out
    4. Hot Reload instability or incompatible versions
    5. Device trust/certificate or app sandboxing crash

    Steps to Fix It

    1. Fully Disable Hot Reload and Fast Deployment

        Hot Reload is known to cause debug tunnel failures on real devices.

         Go to Tools > Options > Debugging > .NET MAUI Hot Reload

         Disable both Hot Reload and XAML Hot Reload

         Rebuild and deploy again.

     2. Manually Kill Background USB Debug Processes

         On your Mac machine (remote builder), run:

          sudo killall -9 usbmuxd

          sudo killall -9 mtouch

          Then reboot the Mac, reconnect the iPhone, and trust the computer again. This clears stale port bindings.

     3. Use Wi-Fi Deployment Instead of USB

          If USB is flaky:

          Connect both iPhone and Mac to same Wi-Fi.

      In Visual Studio:

      Go to iOS project > Properties > iOS Debugging

      Enable wireless debugging

       Then re-pair the iPhone and try again.

    4.Clean Build Artifacts

       Manually delete bin and obj folders

       Then run:

    1. Check Code Signing & Certificates

        Your screenshot shows manual provisioning. Ensure:

        Apple Dev Certificate is not expired

        Provisioning profile matches app ID and bundle

        In Visual Studio: Tools > Options > Xamarin > Apple Accounts — re-sync all identities

         You can also revoke and recreate the provisioning profile.

    1. Update Everything

        Visual Studio 2022 (latest)

        Xcode 16.4+ with latest command line tools

        .NET MAUI SDK (dotnet --list-sdks) – ensure latest

        iPhone iOS version must be compatible with Xcode

    Use:

        dotnet workload update

    1. Check Mac Logs

        On the remote Mac, check this log:

         ~/Library/Logs/Xamarin/mtouch.log

      Look for provisioning, signing, or tunneling errors.

     8. Test with a Simulator

         Try running the same MAUI app on an iOS Simulator instead of a real device. If the simulator works, issue is with:

         USB transport

         Code signing

         Device provisioning

    Temporary Workaround

    Until remote debug is resolved:

    Use Release build with manual logging (e.g., System.Diagnostics.Debug.WriteLine) to file, then inspect via Console.app or Device Logs.

    Or, run on iOS Simulator until deployment works.

    Let us know if the issue persists after following these steps. We’ll be happy to assist further if needed.


  4. Gade Harika (INFOSYS LIMITED) 330 Reputation points Microsoft External Staff
    2025-07-07T07:08:55.15+00:00

    Thank you for your detailed update and for trying the earlier steps. Based on your latest findings, it looks like we're getting closer to isolating the issue. Please follow the updated steps below to resolve the remaining blockers.

    1. Reset Trust on iPhone

    On your iPhone, go to:

    Settings > General > Transfer or Reset iPhone > Reset > Reset Location & Privacy

    Reconnect your iPhone to the Mac via USB and ensure you see and accept the "Trust This Computer?" prompt.

    1. Disable Personal Hotspot

    Please turn off Personal Hotspot on the iPhone:

    Settings > Personal Hotspot > Allow Others to Join → Turn OFF

    Ensure both your Mac and iPhone are connected to the same regular Wi-Fi network (not via hotspot).

    1. Port Forwarding (If Needed)

    Visual Studio expects port 11000, but your device is only exposing 62078.

    You can forward the port using iproxy:

    brew install usbmuxd

    iproxy 11000 62078

    This maps port 62078 to 11000 for proper communication.

    1. Enable Wireless Debugging

    Open Xcode > Window > Devices and Simulators

    Select your iPhone and ensure “Connect via network” is checked.

    1. Check iPhone in Visual Studio

    Restart both Mac and Visual Studio.

    Navigate to Debug > iOS Remote Devices and confirm the iPhone now appears in the remote targets list.

    Additional Notes:

    Since you mentioned planning to switch devices, testing on a different iPhone may help rule out hardware-specific issues.

    If the problem persists, please share updated logs (especially after trust and port configuration) so we can dig further.


  5. Gade Harika (INFOSYS LIMITED) 330 Reputation points Microsoft External Staff
    2025-07-08T13:03:40.38+00:00

    Thank you for sharing the details and debug output.

    Here are a few steps you can try to resolve this:

    Based on the latest findings and recent discussions in the developer community, here's a clearer picture of what's likely happening with your remote debugging issue in .NET MAUI on iOS:

    Root Cause Summary

    The core issue appears to be Visual Studio's remote debugger expecting communication over port 11000, while modern iOS devices (especially with iOS 17/18) are only exposing port 62078, which is the standard port used by usbmuxd for device communication.

    This mismatch leads to:

    Debugger tunnel failures

    Hot Reload connection errors

    App termination before InitializeComponent() is reached

    Why Port 11000?

    Port 11000 is used by Visual Studio’s Hot Reload and debugger tunnel to communicate with the app on the device. However, if the app crashes or the port isn't opened by the app (due to provisioning, sandboxing, or iOS restrictions), the debugger cannot attach.

    Why Forwarding 62078 to 11000 Doesn’t Work

    Port 62078 is managed by usbmuxd and is used for general device communication, not app-specific debugging. Forwarding it to 11000 doesn't help because:

    The app itself must open port 11000 for the debugger to connect.

    iOS sandboxing may prevent this unless the app is properly signed and provisioned.

    Recommended Workaround

    Since all other steps have been exhausted, here’s a practical workaround:

    1. Use Manual Logging Instead of Debugger

    Temporarily replace breakpoints with logging:

    System.Diagnostics.Debug.WriteLine("Reached InitializeComponent");

    Then view logs via:

    Xcode > Devices and Simulators > Device Logs

    Or use Console.app on the Mac

    2. Run in Release Mode with Logging

    This avoids debugger attachment entirely and helps isolate whether the app is crashing due to debugger or runtime issues.

    3. Use Simulator for Debugging Logic

    Since the simulator works (even if it terminates), try:

    Stripping down the app to a minimal version

    Gradually reintroducing components to isolate the crash

    References

    Unable to debug iOS MAUI app · Issue #15065 · dotnet/maui - GitHub

    Let us know if the issue persists after following these steps. We’ll be happy to assist further if needed.

     


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.