mono / mono

Mono open source ECMA CLI, C# and .NET implementation.
https://www.mono-project.com
Other
10.94k stars 3.81k forks source link

Assertion hit when resolving a break point #19899

Open whitneyschmidt opened 4 years ago

whitneyschmidt commented 4 years ago

From @Tragetaschen on Tue, 02 Jun 2020 14:10:49 GMT

Steps to Reproduce

I have a couple of view model constructors where, when I set a break point on the line with the closing curly brace, the process on the iPhone hits an assertion and crashes. So far, I have not identified anything special about the constructor or last instruction—for example, there is one that just sets five ICommand properties. Some break points on the closing brace trigger it, some don't.

  1. Set or start with an existing break point

Expected Behavior

No crash

Actual Behavior

Resolved pending breakpoint at '*ViewModel.cs:22,1' to void *ViewModel..ctor (*ViewModel viewModel, *Service) [0x00053].
2020-06-02 16:01:50.740 *.iOS[8111:12135283] error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/mini-arm64.c:5439, condition `native_offset % 4 == 0' not met
The app has been terminated.
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int
[…]

Environment

Microsoft Visual Studio Professional 2019
Version 16.6.0
VisualStudio.16.Release/16.6.0+30114.105
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Professional

Visual C++ 2019   00435-60000-00000-AA445
Microsoft Visual C++ 2019

Add New File   3.5.138
The fastest and easiest way to add new files to any project - including files that start with a dot

ASP.NET and Web Tools 2019   16.6.936.3669
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2020603+b3ac44798c16fff5b95dbcfe62dea84aa9a1bd72
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019   16.6.936.3669
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.6.936.3669
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   16.6.936.3669
Azure Functions and Web Jobs Tools

C# Tools   3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30212.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.50+g25aae5a24a.R
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.6.17 (9692114)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.20317.1 Commit Hash:3e70368beb9630c811076c051f4c9a59b45d7c10
Adds support for developing and debugging Node.js apps in Visual Studio

NPM Task Runner   1.4.90
Adds support for npm scripts defined in package.json directly in Visual Studio's Task Runner Explorer. Includes full support for Yarn

NuGet Package Manager   5.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62004.28040
Microsoft SQL Server Data Tools

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   16.0.20417.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.9.1.0 for F# 4.7   16.6.0-beta.20217.4+1c969cac25e2d38d71872efe6c8226029e42bb59
Microsoft Visual F# Tools 10.9.1.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions (Preview)   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

WebPack Task Runner   1.5.94
Adds support for WebPack in Visual Studio 2015 and 2017's Task Runner Explorer.

Xamarin   16.6.000.1055 (d16-6@2873694)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.6.0.318 (remotes/origin/d16-6@66afc5421)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.6.40 (1f1466f)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   10.3.1.0 (d16-6/3fe860a)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 165f4b0
    Java.Interop: xamarin/java.interop/d16-6@2cab35c
    ProGuard: xamarin/proguard/master@905836d
    SQLite: xamarin/sqlite/3.31.1@49232bc
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3

Xamarin.iOS and Xamarin.Mac SDK   13.18.1.31 (b3eedfe)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Copied from original issue xamarin/xamarin-macios#8731

whitneyschmidt commented 4 years ago

From @Tragetaschen on Tue, 02 Jun 2020 14:28:10 GMT

Also frequently, when the assertion hits, the Visual Studio instance hard-locks and I have to kill it through Task Manager.

Tragetaschen commented 4 years ago

Out of curiosity: In other projects, I have seen issues being transferred "inline", so it just changed the project it's visible in. This here is a verbatim copy (with changed authorship). Is this due to the issue being moved from one org to another?

whitneyschmidt commented 4 years ago

@Tragetaschen Yep, that's exactly what's happening :)

We'd be able to reassign it without the copy/paste if we were moving to another repo inside of xamarin, but mono/mono is a completely separate repo so we create a new issue and c/p the issue history.

Your issue was transferred because it looks like a mono runtime issue, not an SDK issue with Xamarin.iOS or Xamarin.Mac.

nor0x commented 3 years ago

any progress on this issue? i'm still experiencing this crash which makes debugging an iOS project impossible. Do you need more info?

whitneyschmidt commented 3 years ago

cc @vargaz for visibility.

One bit of info that wasn't copied from the original issue filed in x-ios: It looks like this line is getting hit: https://github.com/mono/mono/blob/87ef5557017a8d822ae31587846a54fcd66daf1b/mono/mini/mini-arm64.c#L5439

vargaz commented 3 years ago

Can somebody at ms able to reproduce this ?

whitneyschmidt commented 3 years ago

@nor0x Could you upload a small sample solution that reproduces this issue and share where exactly you're setting breakpoints?

It also looks like you're using VSWin + VSMac, could you share the version information for both?

I wasn't able to reproduce this using VSMac + an iOS device.

nor0x commented 3 years ago

@whitneyschmidt i will prepare a fresh project with a repro and will share it with you. For the record i'm seeing this issue on an iPhone 5S with iOS 12.4.8 installed. Here is my info from VSMac

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

Version 8.7.3 (build 13)
Installation UUID: 095fb574-1e9d-4d96-970e-dc7f3a099470
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000090

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.90 (2020-02/d3daacdaa80) (64-bit)
    Package version: 612000090

=== Roslyn (Language Service) ===

3.7.0-6.20375.2+34202cc2f3e869fd70a26d8237f4552cf9e192cf

=== NuGet ===

Version: 5.7.0.6702

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.401/Sdks
SDK Versions:
    3.1.401
    3.1.302
    3.1.301
    3.1.300
    3.1.202
    3.1.200
    3.1.102
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    3.1.7
    2.1.21

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.6 (16141)
Build 11E708

=== Xamarin.Mac ===

Version: 6.20.2.2 (Visual Studio Community)
Hash: 817b6f72a
Branch: d16-7
Build date: 2020-07-18 18:44:59-0400

=== Xamarin Designer ===

Version: 16.7.0.492
Hash: f5afe667d
Branch: remotes/origin/d16-7-vsmac
Build date: 2020-07-10 18:42:54 UTC

=== Xamarin.iOS ===

Version: 13.20.2.2 (Visual Studio Community)
Hash: 817b6f72a
Branch: d16-7
Build date: 2020-07-18 18:45:00-0400

=== Xamarin.Android ===

Version: 11.0.2.0 (Visual Studio Community)
Commit: xamarin-android/d16-7/025fde9
Android SDK: /MYUSER/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        7.0 (API level 24)
        7.1 (API level 25)
        8.0 (API level 26)
        8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 27.0.3

Build Information: 
Mono: 83105ba
Java.Interop: xamarin/java.interop/d16-7@1f3388a
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7@017078f

=== Microsoft OpenJDK for Mobile ===

Java SDK: /MYUSER/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: 16.7.0.13
Hash: 8380518
Branch: remotes/origin/d16-7~2
Build date: 2020-08-13 18:19:24 UTC

=== Android Device Manager ===

Version: 16.7.0.22
Hash: 576004d
Branch: remotes/origin/d16-7
Build date: 2020-08-13 18:19:46 UTC

=== Build Information ===

Release ID: 807030013
Git revision: 793cad2e5999f9797bc6bc71759f31e97f57d94a
Build date: 2020-08-13 12:22:13-04
Build branch: release-8.7
Xamarin extensions: 793cad2e5999f9797bc6bc71759f31e97f57d94a

=== Operating System ===

Mac OS X 10.15.6
Darwin 19.6.0 Darwin Kernel Version 19.6.0
    Thu Jun 18 20:49:00 PDT 2020
    root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
KirillOsenkov commented 3 years ago

We have a VSMac bug hitting this: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1231042

KirillOsenkov commented 3 years ago
Resolved pending breakpoint at 'LoginVM.cs:85,1' to void MillionAndUp.ViewModels.LoginVM.<_doLogin>d__21.MoveNext () [0x000bf].
2020-09-29 15:38:13.589 App.iOS[2772:1005358] XPC connection interrupted
Thread finished: <Thread Pool> #13
2020-09-29 15:38:30.970 App.iOS[2772:1005364] error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/mini-arm64.c:5439, condition `native_offset % 4 == 0' not met

=================================================================
    Native Crash Reporting
=================================================================
Got a abrt while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x105720104 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_dump_native_crash_info
    0x10571637c - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_handle_native_crash
    0x10571f650 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : sigabrt_signal_handler
    0x1bdbc9414 - /usr/lib/system/libsystem_platform.dylib : <redacted>
    0x1bdbcc948 - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
    0x1bdb5bba4 - /usr/lib/system/libsystem_c.dylib : abort
    0x1058de71c - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : _ZL12log_callbackPKcS0_S0_iPv
    0x1058a9c4c - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : monoeg_g_logv_nofree
    0x1058a9ce0 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : monoeg_assertion_message
    0x1058a9d24 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_assertion_message_unreachable
    0x105710de8 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_arch_set_breakpoint
    0x10574a6cc - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : insert_breakpoint
    0x10574aaac - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_de_set_breakpoint
    0x10574ce18 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : ss_bp_add_one
    0x10574be64 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_de_ss_start
    0x10574c944 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : mono_de_ss_create
    0x10573f2c8 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : debugger_thread
    0x105831b98 - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : start_wrapper_internal
    0x105831a1c - /private/var/containers/Bundle/Application/23B0457C-D67A-4093-9101-7A5B10F5651D/App.iOS.app/App.iOS : start_wrapper
    0x1bdbcb914 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
    0x1bdbd39d4 - /usr/lib/system/libsystem_pthread.dylib : thread_start
clifzero commented 3 years ago

Any updates on this issue as yet, I've also experienced it recently

chamons commented 3 years ago

Hey @Cliffy786 - There are no updates as we've been unable to reproduce this issue locally (so we can debug and fix it).

If you have interest in resolving this, please create a small sample application that reproduces it and attach it here.

omghb commented 3 years ago

I have the same error and crash with VS 16.8.3 together with VS for MAC 8.8.3 and Xcode 12.2. iPhone with iOS 14.2.

whitneyschmidt commented 3 years ago

Thanks for reporting this issue @omghb.

If it's possible, could you create a small sample application that reproduces the problem and upload it here? That is the best way for the team to investigate.

cc @dalexsoto @rolfbjarne for visibility.

omghb commented 3 years ago

I tried to create a small sample app. Unfortunately, I was not able to reproduce this issue with it.

I have seen the issue when I set the breakpoint within a constructor of a class which is instantiated via AutoFac within the AppDelegate.FinishedLaunching(UIApplication app, NSDictionary options) method. Breakpoints at other places work correct.

monolara commented 3 years ago

I'm having the same issue here. My project works on emulator but not on physical device. Are there any updates?

error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/mini-arm64.c:5439, conditionnative_offset % 4 == 0' not met Step request failed: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.`

Visual Studio Community 2019 for Mac Version 8.8.3 (build 16) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

alanspires commented 3 years ago

What worked for me was disabling "Enable the Mono interpreter" in the project options -> iOS Build

lester-fh commented 3 years ago

What worked for me was disabling "Enable the Mono interpreter" in the project options -> iOS Build

This!

softlion commented 3 years ago

Having the same issue today with latest version of all tools. disabling the Mono interpreter fixed it.

Hiilbig commented 3 years ago

@alanspires You are correct, it does fix the issue - but opens another (minor, since it is not a crash): The XAML HotReload in Visual Studio stops working when using Xamarin.iOS. Is there any known workarounds for that?

Deepfreezed commented 3 years ago

Thanks, disabling "Enable the Mono interpreter" worked. Hot reload does not work now, it's at least something.

znelson32 commented 3 years ago

This saved me after hours of troubleshooting. Disabling the Mono Interpreter solves the problem, but also removing all breakpoints and then adding a few back works, too. Ultimately there's an issue with Hot Reload as that crashes randomly even with Mono Interpreter enabled.

johnn82 commented 2 years ago

Hi there, we are working on a very complex project and now we are facing the same issue. Disabling the mono interpreter fixed the problem, not a real solution tho.

Microsoft Visual Studio Professional 2019 Version 16.11.2 Xamarin 16.11.000.174 (d16-11@e8f56f1) Xamarin.iOS and Xamarin.Mac SDK 14.20.0.25 (3b53e529b)

barmouta commented 2 years ago

I have the same problem. The app crashes while debugging, but works fine when just running it. Disabling the mono interpreter now allows me to debug, but hot reload no longer works.

@whitneyschmidt @dalexsoto @rolfbjarne if you guys want to reproduce the issue, then include a native C library in xamarin ios project (libX,iOS.a) and then call one of its functions (P/Invoke) using System.Runtime.InteropServices, e.g.:

[DllImport("__Internal", EntryPoint = "interpret_scan_data_buffer")] public static extern int DeserialiseScanDataIos(byte[] buffer, int bufferSize, ref NativeScanData scanData);

Seems like I can either use hot reload, or call native C functions, but not both.

abhcr commented 2 years ago

What worked for me was disabling "Enable the Mono interpreter" in the project options -> iOS Build

I have a few dynamic type resolves in my code and disabling this is not an option for me (since iOS doesn't support JIT)

MichaelRumpler commented 1 year ago

The problem still persists, just the line number has changed. The error is now:

error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/mini-arm64.c:5447, condition `native_offset % 4 == 0' not met

My breakpoint is in a XF solution in the iOS project.

image

The app crashes when the breakpoint is hit.

This is VS2022, version 17.7.0 Preview 2.0 on Windows and 17.6 Preview (Build 1539) and Xamarin.iOS 16.4.0.5 on the Mac.

Maybe the issue text should be "App crashes when resolving a breakpoint" instead.

When I disable the Mono Interpreter, then it works.

MichaelRumpler commented 1 year ago

Are we really still running on a Mono version from 2020 like the path suggests? Cause in the current version that assert is in line 5491 and the file mini-arm64.c was last changed two years ago. Why isn't that updated?

LeadAssimilator commented 12 months ago

xamarin-ios 16.4.0.6 (latest shipping in vs 2022 at tow) is built against 6.12.0.179, which is from May of 2022 but built off of the 2020-02 branch.

LeadAssimilator commented 11 months ago

Repro app: XMI8731_M19899.zip

MichaelRumpler commented 11 months ago

Great @LeadAssimilator ! Finally somebody managed to write a repro! I can reproduce it at once with the steps you provided.

LennoxP90 commented 10 months ago

any leads on this?

LeadAssimilator commented 10 months ago

Have you been able to reproduce this @BrzVlad with the provided sample?

Surfrat commented 8 months ago

Any progress on this. This bug stops us from debugging Xamarin iOS projects. The result is a crash.

Please let me know if I can provide you another sample project to help fix this.

BrzVlad commented 8 months ago

Is this issue reproducible in the latest dotnet (7/8) ? There isn't much focus on legacy mono.

Surfrat commented 8 months ago

Thanks for the update.

I don't know as Xamarin uses .Net Standard. If it can't be fixed is there a work around?