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.49k stars 515 forks source link

Debugger disconnects automatically after a few seconds on watchOS simulator on 1st attempt. #5757

Open rolfbjarne opened 5 years ago

rolfbjarne commented 5 years ago

Steps to reproduce

  1. Create a WatchOS app.
  2. Right click on solution and Add new WatchKit App(WatchOS-> App-> WatchKit App) (Select WatchOS2 template)
  3. Place a breakpoint on InterfaceController.cs line number 17 i.e. base.Awake(context);
  4. Deploy on Simulator in debug mode.
  5. Once breakpoint is hit, wait for a few seconds (~10)

Actual behavior

Debugger disconnects automatically after a few seconds on WatchOS Simulator

Expected behavior

Breakpoint should hit once the app is deployed on the simulator and should not be resolved till it’s user initiated

Environment

https://gist.github.com/umesh-kamble/2fad56d81085f694513876bc7c373e42

References

https://bugzilla.xamarin.com/show_bug.cgi?id=61090 https://devdiv.visualstudio.com/DevDiv/_workitems/edit/589689

VS bug #589689

rolfbjarne commented 5 years ago

From bugzilla #61090:

Rolf Bjarne Kvinge [MSFT] 2018-01-10 15:13:11 CET

I can reproduce with Xcode 9.0, 9.1 and 9.2, but not Xcode 8.3.3, so this is something that changed in Xcode.

I've had a look at it, and it doesn't look trivial to fix, so I'm bumping to d15-7.


Rolf Bjarne Kvinge [MSFT] 2018-03-09 15:31:14 CET

This will probably take some time to track down and fix, so let's postpone until Xcode 11 (when Apple might change/break it again, or even fix it if we're lucky).

DamianMehers commented 5 years ago

@rolfbjarne is this related to https://github.com/xamarin/xamarin-macios/issues/7275#issuecomment-548912130 ? That one looks to be a crash when attaching a new native thread to the mono runtime when a new thread gets created to handle an http response.

rolfbjarne commented 5 years ago

@DamianMehers no, that's a different issue. This issue is because watchOS is terminating the watch app ~20 seconds when stopped in a breakpoint in the launch sequence, because watchOS detects that the app is not launching (watchOS doesn't know the app is being debugged).

onurhazar commented 4 years ago

@rolfbjarne I am having a similar issue which may be occurred by the same reason. Mine is crashing and exits from debugger in ApplicationDidFinishLaunching when executes WCSession.ActivateSession.

rolfbjarne commented 4 years ago

@onurhazar does it still crash if you don't put a breakpoint anywhere?

onurhazar commented 4 years ago

@rolfbjarne yes it was crashing but now debugging on the simulator is working again with the latest version of Visual Studio For Mac and Xamarin.iOS Version: 13.10.0.17 (Visual Studio Community)

onurhazar commented 4 years ago

@rolfbjarne just wanted to give an update; debugging is working on watch simulator but it is not working on physical watch device. Using the latest versions of VSMac and Xcode. It would be great if you give any help on that. Thanks!