Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger detaches on REST call while debugging watchOS app #7275

Open
artur-malendowicz-gain opened this issue Oct 22, 2019 · 3 comments
Open

Debugger detaches on REST call while debugging watchOS app #7275

artur-malendowicz-gain opened this issue Oct 22, 2019 · 3 comments
Assignees
Milestone

Comments

@artur-malendowicz-gain
Copy link

@artur-malendowicz-gain artur-malendowicz-gain commented Oct 22, 2019

Steps to Reproduce

  1. Create iOS + watchOS app
  2. Add System.Net.Http nuget package to watchOS app extension project
  3. Use HttpClient with Get/Post on some endpoint

Expected Behavior

Response is returned.

Actual Behavior

Debugger detaches, app is closed.

Environment

Visual Studio Community 2019 for Mac
Version 8.3.4 (build 8)
Installation UUID: 556929dc-ef0e-4bec-9c85-fb17f1142b3b
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

	Package version: 604000208

Mono Framework MDK
Runtime:
	Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit)
	Package version: 604000208

Xamarin Designer
Version: 16.3.0.247
Hash: 52eac1a9e
Branch: remotes/origin/d16-3
Build date: 2019-10-03 23:04:28 UTC

NuGet
Version: 5.3.0.6192

.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK Versions:
	3.0.100
	3.0.100-rc1-014190
	2.2.300
	2.2.204
	2.2.203
	2.2.106
	2.2.106-old copy
	2.1.701
	2.1.505
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	3.0.0
	3.0.0-rc1-19456-20
	2.2.5
	2.2.4
	2.1.13
	2.1.12
	2.1.9

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

Updater
Version: 11

Xamarin.Android
Version: 10.0.3.0 (Visual Studio Community)
Commit: xamarin-android/d16-3/4d45b41
Android SDK: /Users/artur.malendowicz/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: mono/mono/2019-06@5608fe0abb3
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Microsoft Mobile OpenJDK
Java SDK: /Users/artur.malendowicz/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-10-08 23:36:20 UTC

Android Device Manager
Version: 1.2.0.116
Hash: d2b2af0
Branch: remotes/origin/d16-3
Build date: 2019-10-08 23:36:44 UTC

Apple Developer Tools
Xcode 11.1 (15405)
Build 11A1027

Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Xamarin.iOS
Version: 13.4.0.2 (Visual Studio Community)
Hash: e37549bc
Branch: xcode11.1
Build date: 2019-10-07 22:43:23-0400

Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

Build Information
Release ID: 803040008
Git revision: 8da5857bc3d33e5667cacaab3bd1ab55375ed3e3
Build date: 2019-10-14 18:26:13+00
Build branch: release-8.3
Xamarin extensions: 61c91e660a01512a3b8187c749fd3bccc75a2bf4

Operating System
Mac OS X 10.15.0
Darwin 19.0.0 Darwin Kernel Version 19.0.0
    Wed Sep 25 20:18:50 PDT 2019
    root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64

Enabled user installed extensions
Straight8's SpecFlow Integration 1.11.3.0

Build Logs

Example Project (If Possible)

@mandel-macaque

This comment has been minimized.

Copy link
Contributor

@mandel-macaque mandel-macaque commented Oct 22, 2019

Hello,

I there any particular reason on why you are using the nuget over the HttpClient provided by Xamarin?

Thanks for the info!

@mandel-macaque mandel-macaque added this to the Future milestone Oct 22, 2019
@DamianMehers

This comment has been minimized.

Copy link

@DamianMehers DamianMehers commented Nov 1, 2019

I'm having exactly the same issue. I cannot debug any WatchOS app in the Simulator that uses HttpClient: The process crashes if the debugger is attached.

To reproduce, create a new iOS app, add a WatchOS app to it, and then add this code to your WillActivate in the watch's interface controller (accept VS's default import suggestions for Task etc.):

public override void WillActivate()
{
    // This method is called when the watch view controller is about to be visible to the user.
    Console.WriteLine("{0} will activate", this);
    BeginInvokeOnMainThread(async () =>
    {
        try
        {
            var client = new HttpClient();
            var s = await client.GetStringAsync("https://www.microsoft.com"); // Crashy
            Console.WriteLine(s); // Not reached
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex); // Not caught.  Hard crash
        }
    });
}

I targeted WatchOS 5.1. Not sure if this is relevant.

This is the stack trace from the crash. Note there is no user code in the stack.

Thread 8 Crashed:: tid_5503  Dispatch queue: NSOperationQueue 0x83019aa0 (QOS: UNSPECIFIED)
0   com.companyname.Test.watchkitapp.watchkitextension	0x0039cbd1 mono_get_hazardous_pointer + 17 (hazard-pointer.c:208)
1   com.companyname.Test.watchkitapp.watchkitextension	0x0029490a mono_jit_info_table_find_internal + 58 (jit-info.c:295)
2   com.companyname.Test.watchkitapp.watchkitextension	0x00220b3d debugger_interrupt_critical + 77 (debugger-agent.c:2693)
3   com.companyname.Test.watchkitapp.watchkitextension	0x003ae4e7 mono_thread_info_safe_suspend_and_run + 743 (mono-threads.c:1343)
4   com.companyname.Test.watchkitapp.watchkitextension	0x00220a59 notify_thread + 89 (debugger-agent.c:2725)
5   com.companyname.Test.watchkitapp.watchkitextension	0x002d9c59 mono_g_hash_table_foreach + 73 (mono-hash.c:310)
6   com.companyname.Test.watchkitapp.watchkitextension	0x0021edbc suspend_vm + 188 (debugger-agent.c:2822)
7   com.companyname.Test.watchkitapp.watchkitextension	0x00222ec9 process_event + 3097 (debugger-agent.c:3873)
8   com.companyname.Test.watchkitapp.watchkitextension	0x0021cc50 thread_startup + 496 (debugger-agent.c:4014)
9   com.companyname.Test.watchkitapp.watchkitextension	0x002eec63 mono_profiler_raise_thread_started + 51 (profiler-events.h:103)
10  com.companyname.Test.watchkitapp.watchkitextension	0x00322a0d mono_thread_attach + 253 (threads.c:1115)
11  com.companyname.Test.watchkitapp.watchkitextension	0x0032c37d mono_threads_attach_coop_internal + 125 (threads.c:6074)
12  com.companyname.Test.watchkitapp.watchkitextension	0x0032c45c mono_threads_attach_coop + 44 (threads.c:6111)
13  com.companyname.Test.watchkitapp.watchkitextension	0x0010c1f0 native_to_managed_trampoline_87(objc_object*, objc_selector*, _MonoMethod**, NSURLSession*, NSURLSessionTask*, NSHTTPURLResponse*, NSURLRequest*, objc_object*, unsigned int) + 288 (Xamarin.WatchOS.registrar.watchos.i386.m:5304)
14  com.companyname.Test.watchkitapp.watchkitextension	0x0010c0c6 -[System_Net_Http_NSUrlSessionHandler_NSUrlSessionHandlerDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:] + 182 (Xamarin.WatchOS.registrar.watchos.i386.m:9201)
15  com.apple.CFNetwork           	0x42ce0056 0x42b3c000 + 1720406
16  com.apple.Foundation          	0x453c7df7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
17  com.apple.Foundation          	0x453c7cf4 -[NSBlockOperation main] + 88
18  com.apple.Foundation          	0x453cacee __NSOPERATION_IS_INVOKING_MAIN__ + 27
19  com.apple.Foundation          	0x453c6ebd -[NSOperation start] + 835
20  com.apple.Foundation          	0x453cb606 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 27
21  com.apple.Foundation          	0x453cb12e __NSOQSchedule_f + 194
22  com.apple.Foundation          	0x453cb255 ____addOperations_block_invoke_3 + 20
23  libdispatch.dylib             	0x65dedf49 _dispatch_block_async_invoke2 + 77
24  libdispatch.dylib             	0x65de4461 _dispatch_block_async_invoke_and_release + 17
25  libdispatch.dylib             	0x65de126f _dispatch_client_callout + 14
26  libdispatch.dylib             	0x65de3788 _dispatch_continuation_pop + 421
27  libdispatch.dylib             	0x65de2ee3 _dispatch_async_redirect_invoke + 818
28  libdispatch.dylib             	0x65df087d _dispatch_root_queue_drain + 354
29  libdispatch.dylib             	0x65df0ff3 _dispatch_worker_thread2 + 109
30  libsystem_pthread.dylib       	0x66024fa0 _pthread_wqthread + 208
31  libsystem_pthread.dylib       	0x66024e44 start_wqthread + 36

I think this is a relatively critical issue since debugging in the Simulator is really the only sane option given how slow working with real devices is. Also only Release builds run on newer real devices.

I believe I'm using the latest and greatest release Xcode and VS bits.

Visual Studio Community 2019 for Mac
Version 8.3.6 (build 4)
Installation UUID: 7148da70-3f7e-4f36-b5ec-1959365c5ccd
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

	Package version: 604000208

Mono Framework MDK
Runtime:
	Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit)
	Package version: 604000208

Xamarin Designer
Version: 16.3.0.247
Hash: 52eac1a9e
Branch: remotes/origin/d16-3
Build date: 2019-10-03 23:04:28 UTC

NuGet
Version: 5.3.0.6192

.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK Versions:
	3.0.100
	2.1.701
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	3.0.0
	2.1.13
	2.1.12

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

Updater
Version: 11

Apple Developer Tools
Xcode 11.2 (15526)
Build 11B52

Xamarin.Mac
Version: 6.4.0.2 (Visual Studio Community)
Hash: e37549bc
Branch: xcode11.1
Build date: 2019-10-07 22:43:23-0400

Xamarin.iOS
Version: 13.4.0.2 (Visual Studio Community)
Hash: e37549bc
Branch: xcode11.1
Build date: 2019-10-07 22:43:23-0400

Xamarin.Android
Version: 10.0.3.0 (Visual Studio Community)
Commit: xamarin-android/d16-3/4d45b41
Android SDK: /Users/damian/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.2
SDK Build Tools Version: 28.0.3

Build Information: 
Mono: mono/mono/2019-06@5608fe0abb3
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Microsoft Mobile OpenJDK
Java SDK: /Users/damian/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-10-10 12:15:44 UTC

Android Device Manager
Version: 1.2.0.116
Hash: d2b2af0
Branch: remotes/origin/d16-3
Build date: 2019-10-10 12:16:06 UTC

Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

Build Information
Release ID: 803060004
Git revision: 081f7b8bbd534cb73bbfb5cff3d9aa4907396a4f
Build date: 2019-10-31 17:10:49+00
Build branch: release-8.3
Xamarin extensions: ade6d975df7634a5d81feda320a6102e5bacf309

Operating System
Mac OS X 10.15.1
Darwin 19.0.0 Darwin Kernel Version 19.0.0
    Thu Oct 17 16:17:15 PDT 2019
    root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
@DamianMehers

This comment has been minimized.

Copy link

@DamianMehers DamianMehers commented Nov 6, 2019

@mandel-macaque, I see this has the "need-info" label ... I'm not sure what info you still need ... this should be easily reproduceable (see my trivial steps above) and is severely impacting Xamarin Apple Watch development since debugging WatchOS apps is now impossible for all but the most trivial of cases ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.