xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

Xamarin WatchOS Waiting for Debugger to Connect with real Apple Watch Serie 7 #13364

Closed SprengerS closed 2 years ago

SprengerS commented 2 years ago

At the moment it is not possible to Debug a real Apple Watch Hardware Device via Wifi. Watch OS Simulator can be debugged

Steps to Reproduce

  1. Create A Watch App, plug in iPhone via USB
  2. Select Watch OS Target and run on paired Apple Watch

Expected Behavior

  1. Wach App will be started
  2. Debugger should be connected and stopped when a Breakpoint is reached

Actual Behavior

  1. Watch App will be started
  2. Debugger is waiting for Connection over Wifi to port 10001

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.10.11 (build 8)
Installation UUID: 15e61cf8-1958-4c13-8382-8b037596ad0e
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000140

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit)
    Package version: 612000140

=== Roslyn (Language Service) ===

3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb

=== NuGet ===

Version: 5.9.0.7134

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.402/Sdks
SDK Versions:
    5.0.402
    5.0.401
    5.0.400
    5.0.302
    5.0.301
    5.0.203
    5.0.202
    5.0.201
    5.0.103
    5.0.102
    5.0.101
    5.0.100
    3.1.414
    3.1.413
    3.1.412
    3.1.411
    3.1.410
    3.1.409
    3.1.408
    3.1.407
    3.1.406
    3.1.405
    3.1.404
    3.1.403
    3.1.402
    3.1.401
    3.1.300
    3.1.202
    3.1.200
    3.1.102
    3.1.101
    3.1.100
    3.0.101
    3.0.100
    2.2.100
    2.1.701
    2.1.700
    2.1.505
    2.1.302
    2.1.301
    2.1.4
    2.0.0
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    5.0.11
    5.0.10
    5.0.9
    5.0.8
    5.0.7
    5.0.6
    5.0.5
    5.0.4
    5.0.3
    5.0.2
    5.0.1
    5.0.0
    3.1.20
    3.1.19
    3.1.18
    3.1.17
    3.1.16
    3.1.15
    3.1.14
    3.1.13
    3.1.12
    3.1.11
    3.1.10
    3.1.9
    3.1.8
    3.1.7
    3.1.4
    3.1.2
    3.1.1
    3.1.0
    3.0.1
    3.0.0
    2.2.0
    2.1.23
    2.1.22
    2.1.21
    2.1.18
    2.1.17
    2.1.16
    2.1.15
    2.1.14
    2.1.13
    2.1.12
    2.1.11
    2.1.9
    2.1.2
    2.1.1
    2.0.5
    2.0.0

=== .NET Core 3.1 SDK ===

SDK: 3.1.414

=== Xamarin.Profiler ===

Version: 1.6.12.26
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 11.3.0.4 (Visual Studio Community)
Commit: xamarin-android/d16-10/ae14caf
Android SDK: /Users/sprenger_m/Library/Android/sdk
    Supported Android versions:
        8.0 (API level 26)
        8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 31.0.3
SDK Build Tools Version: 31.0.0

Build Information: 
Mono: b4a3858
Java.Interop: xamarin/java.interop/d16-10@f39db25
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.35.4@85460d3
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-10@c5732a0

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home
2021-07-20
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.10.0.13
Hash: 1b81df5
Branch: remotes/origin/d16-10
Build date: 2021-09-21 02:30:50 UTC

=== Android Device Manager ===

Version: 16.10.0.15
Hash: 89dcc0b
Branch: remotes/origin/d16-10
Build date: 2021-09-21 02:31:08 UTC

=== Xamarin Designer ===

Version: 16.10.0.119
Hash: 36a2d986f
Branch: remotes/origin/d16-10
Build date: 2021-06-02 19:41:34 UTC

=== Apple Developer Tools ===

Xcode 13.0 (19234)
Build 13A233

=== Xamarin.Mac ===

Version: 7.14.0.27 (Visual Studio Community)
Hash: 2566861a9
Branch: d16-10
Build date: 2021-07-27 02:34:12-0400

=== Xamarin.iOS ===

Version: 15.0.0.6 (Visual Studio Community)
Hash: 2771277e0
Branch: xcode13-ios
Build date: 2021-09-23 10:36:08-0400

=== Build Information ===

Release ID: 810110008
Git revision: 5467245e1f99a0c8ccdd2acea02d16c3fb65c220
Build date: 2021-10-07 10:49:46-04
Build branch: release-8.10

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.6.0 Darwin Kernel Version 20.6.0
    Mon Aug 30 06:12:21 PDT 2021
    root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

MSBuild Editor 2.4.0

Build Logs

  1. Ide Log for Real Apple Watch
    INFO [2021-11-15 14:44:41Z]: [iOS Debugger] Awaiting connection over WiFi to 0.0.0.0:10001
    INFO [2021-11-15 14:44:42Z]: Launching app on device: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -sdkroot "/Applications/Xcode.app/Contents/Developer" --killdev "eu.hoermann.garador.bluesecur.watchkitapp" --wait-for-unlock --launchdev "/Users/sprenger_m/source/bluesecur/src/Hoermann.BleApp.iOS/bin/iPhone/Debug/Hoermann.BleApp.iOS.app/Watch/Hoermann.BleApp.WatchOS.app" --watchlaunchmode=Default --devname "Apple Watch Series 7 (GPS)" --argument=-monodevelop-port --argument=10001 --setenv=__XAMARIN_DEBUG_PORT__=10001 --argument=-connection-mode --argument=wifi
    ERROR [2021-11-15 14:46:52Z]: [iOS Debugger] Failed to accept connection over WiFi.
  2. Ide Log for Watch Simulator
    INFO [2021-11-15 13:04:18Z]: [iOS Debugger] Awaiting connection over WiFi to 127.0.0.1:10001
    INFO [2021-11-15 13:04:18Z]: Launching iOS Simulator: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -sdkroot "/Applications/Xcode.app/Contents/Developer" --launchsimwatch "/Users/sprenger_m/source/bluesecur/src/Hoermann.BleApp.iOS/bin/iPhoneSimulator/Debug/Hoermann.BleApp.iOS.app/Watch/Hoermann.BleApp.WatchOS.app" --watchlaunchmode=Default --argument=-monodevelop-port --argument=10001 --setenv=__XAMARIN_DEBUG_PORT__=10001 --sdk "8.0" --device=:v2:udid=35E8529A-222A-4B29-87E1-6DEFEAA2F0CD
    INFO [2021-11-15 13:05:19Z]: [iOS Debugger] Accepted connection over WiFi from 127.0.0.1:60942
    INFO [2021-11-15 13:05:19Z]: [iOS Debugger] Accepted connection over WiFi from 127.0.0.1:60943
    INFO [2021-11-15 13:05:19Z]: [iOS Debugger] Accepted connection over WiFi from 127.0.0.1:60944

Beside this strange behaviour I have inspected the WatchExtension.appex. The WatchExtension contains a file called MonoTouchDebugConfiguration.txt. This file contains some IP Addresses. I think this IP Adresse are necessary for the debugger for connecting to the watch app. For the Real AppleWatch the file contains

IP: 192.168.201.28
IP: 10.30.17.191
IP: fe80::aede:48ff:fe00:1122
IP: fe80::43e:44b7:ebb8:61d5
IP: fe80::1492:fd1c:16f8:e042
IP: fe80::4819:45ff:fe68:dd6
IP: fe80::3ec4:3782:c541:8b1e
Port: 10001

and for the Simulator

IP: 127.0.0.1
Port: 10001
chamons commented 2 years ago

Closing as duplicate of https://github.com/xamarin/xamarin-macios/issues/8810

SprengerS commented 2 years ago

@chamons Since you closed this issue you don't give us a workaround or future date when this bug will be fixed. This bug is really old and should be fixed because there are a lot of Users who are using an Apple Watch and we want to give them an Apple Watch App. But without debugging on a real Hardware device it is difficult to use Bluetooth, because the app will depend on Bluetooth.

chamons commented 2 years ago

@SprengerS - I closed it as a duplicate of an existing issue, which is open. We try to only have one copy of a given issue in our repository to make it easier to search.

cc @davidortinau