Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug] Segmentation Fault receiving message on WatchOS with debugger attached #17926

@chamons

Description

@chamons

From @jschroeder-avi on Fri, 22 Nov 2019 19:55:03 GMT

I am developing an Apple Watch app in Xamarin to connect to the iOS side of my existing Xamarin.Forms app. This issue started appearing on the latest versions of Xcode and Xamarin.

When I run the watch project and send a message from the phone using WCSession.DefaultSession.SendMessage(...), the watch app crashes. This usually happens the second time a message is sent, although it varies. When the crash occurs, the debugger immediately exits and no relevant log is printed. It seems to crash in some internal logic, not on any line of my code. I sometimes (~5% of the time) get a crash file generated in "/Users/johns/Library/Logs/DiagnosticReports/", which is how I know the crash is due to a segmentation fault.

I created a sample project to reproduce the issue. The iOS app has a button that sends a message to the watch. Both projects set a WCSessionDelegate and activate the WCSession on startup. The behavior was reproduced on both an iMac and a Macbook. I made a forum post here https://forums.xamarin.com/discussion/174876/segmentation-fault-receiving-message-on-watchos-with-debugger-attached/p1?new=1 and attached the sample project and one of the crash logs.

Any help would be appreciated. Thanks.

My Environment:
=== Visual Studio Community 2019 for Mac ===

Version 8.3.10 (build 2)
Installation UUID: ca9efe8c-cd51-499b-83d0-27b4a235045b
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

=== 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-preview8-013656
2.1.701
2.1.700
2.1.505
2.1.301
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-preview8-28405-07
2.1.13
2.1.12
2.1.11
2.1.9
2.1.1

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.0.6.2 (Visual Studio Community)
Commit: xamarin-android/d16-3/c407838
Android SDK: /Users/johns/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: 27.0.3

Build Information:
Mono: 476d72b9e32
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3fd
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/johns/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_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-11-19 20:33:22 UTC

=== Android Device Manager ===

Version: 1.2.0.116
Hash: d2b2af0
Branch: remotes/origin/d16-3
Build date: 2019-11-19 20:33:42 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

=== Xamarin Designer ===

Version: 16.3.0.256
Hash: 8a223bfd7
Branch: remotes/origin/d16-3
Build date: 2019-11-01 21:02:02 UTC

=== Apple Developer Tools ===

Xcode 11.2.1 (15526.1)
Build 11B500

=== Xamarin.Mac ===

Version: 6.6.0.12 (Visual Studio Community)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:07-0400

=== Xamarin.iOS ===

Version: 13.6.0.12 (Visual Studio Community)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:08-0400

=== Build Information ===

Release ID: 803100002
Git revision: add3a4998a5cb5b081e0404e1fe13acfecb7801d
Build date: 2019-11-20 13:35:15+00
Build branch: release-8.3
Xamarin extensions: 79c69708816813b498283eeda7bcb4d464433a04

=== 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

Copied from original issue dotnet/macios#7486

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions