xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] Native crash using HotRestart #13179

Open omatrot opened 3 years ago

omatrot commented 3 years ago

Description

I'm trying to use Xamarin HotRestart with Visual Studio 2019 16.9.0 Preview 2.

I've already removed the Splash Screen from info.plist, but this does not solve the problem.

Steps to Reproduce

I'm afraid I can't give steps on how to reproduce this issue as the iOS project has been recently upgraded to Xamarin Forms 4.8.0.1687.

A new project created from scratch works well.

Expected Behavior

No crash.

Actual Behavior

Here is the stack trace:

=================================================================
Got a segv 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 Crash Reporting

=================================================================

=================================================================
    Native stacktrace:
=================================================================

    0x100c28120 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_dump_native_crash_info

    0x100c2ba60 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_sigsegv_signal_handler_debug
    0x1c8b96d90 - /usr/lib/system/libsystem_platform.dylib : <redacted>

    0x100c1ecbc - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_handle_native_crash

    0x100dd2e90 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_transform_method

    0x100de7758 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_interp_transform_method

    0x100dc6ef4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_interp_get_imethod
    0x100de4ef0 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : generate_code

    0x100dca354 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

    0x100dcd03c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

    0x100dc8028 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke

    0x100cdeaf4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_try_invoke

    0x100c2ed3c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke

    0x100c39e54 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : suspend_current

    0x100c405bc - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : process_event

    0x100c37268 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : debugger_agent_breakpoint_from_context

    0x100be71d4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : sdb_breakpoint_trampoline

    0x100c3a928 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_invoke_method

    0x100dd3044 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_debugger_tramp

    0x100dd1390 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

    0x100c386d4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : process_breakpoint_events
    0x100c52390 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_de_process_breakpoint

    0x100dc8028 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke

    0x100ce3974 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_try_invoke_array

    0x100c2ed3c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke
    0x100cdd2c0 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_invoke_checked

    0x100c8b9c4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : ves_icall_InternalInvoke

    0x100dd4a74 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_icall
    0x100dd3188 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_icall_wrapper

    0x100dc8028 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke

    0x100c9bb68 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : ves_icall_InternalInvoke_raw

    0x100bdbbc8 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : main
    0x1800ca568 - /usr/lib/system/libdyld.dylib : <redacted>

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x100dc6f00):
    0x100ce2564 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_exec_main_checked

    0x100c138f4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_exec

    0x100dc9c04 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

fa 97 f6 03 00 aa 14 00 00 f9 17 58 00 f9  4............X..
0x100dc6f00  08 13 40 79 08 68 

0x100dc6f20  e8 17 9f 
    0x100dc5afc - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : xamarin_main

1a 09 
0f 40 b9 08 59 16 53  ..@y.h....@..Y.S
0x100dc6f10  08 6c 00 b9 08 0f 40 b9 08 15 10 12 1f 41 41 71  .l....@......AAq
b9 
90 
40 39 29 79 1e 12 28 05 
0x100dc6ef0  34 db 
00 
08 
    0x100c2ed3c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke
    0x100cdd2c0 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_invoke_checked

      at Xamarin.HotReload.Forms.FormsAgent:InitializeAgentAsync <0x001d0>
      at <InitAgents>d__28:MoveNext <0x0023a>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00052>
      at Xamarin.HotReload.HotReloadAgent:InitAgents <0x0003e>
      at Xamarin.HotReload.HotReloadAgent:.ctor <0x00096>
      at Xamarin.HotReload.HotReloadAgent:GetInstance <0x0001e>
      at <Module>:runtime_invoke_direct_HotReloadAgent_uint_bool_string <0x00064>
      at <unknown> <0xffffffff>
      at GeoFleet.iOS.Application:Main <0x00004>
      at <Module>:runtime_invoke_direct_void_string[] <0x0008c>
      at <unknown> <0xffffffff>
      at System.Reflection.RuntimeMethodInfo:InternalInvoke <0x00030>
      at System.Reflection.RuntimeMethodInfo:Invoke <0x000fc>
      at System.Reflection.MethodBase:Invoke <0x0001a>
      at Xamarin.PreBuilt.iOS.Applications:Main <0x00254>
      at <Module>:runtime_invoke_direct_void_string[] <0x00092>
=================================================================

08 2a  ......@9)y..(..*

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at <unknown> <0xffffffff>
      at Xamarin.HotReload.Forms.VisualTreeService.DiagnosticVisualTreeService:Initialize <0x00140>
      at Xamarin.HotReload.Forms.FormsAgent:SetupAgent <0x000a8>

The app has been terminated.

Basic Information

Show/Hide Visual Studio info ``` Microsoft Visual Studio Enterprise 2019 Preview Version 16.9.0 Preview 2.0 VisualStudio.16.Preview/16.9.0-pre.2.0+30803.129 Microsoft .NET Framework Version 4.8.04084 Installed Version: Enterprise Visual C++ 2019 00435-60000-00000-AA084 Microsoft Visual C++ 2019 ASP.NET and Web Tools 2019 16.9.311.8738 ASP.NET and Web Tools 2019 ASP.NET Core Razor Language Services 16.1.0.2057006+e0968ea4b5f5c523cc7efea1d91fec21e0adc648 Provides languages services for ASP.NET Core Razor. ASP.NET Web Frameworks and Tools 2019 16.9.311.8738 For additional information, visit https://www.asp.net/ Azure App Service Tools v3.0.0 16.9.311.8738 Azure App Service Tools v3.0.0 Azure Functions and Web Jobs Tools 16.9.311.8738 Azure Functions and Web Jobs Tools C# Tools 3.9.0-2.20602.2+eb0a7ff1c241695e17b07b096593804fdd5cfcfd C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. CodeMaid 11.1.209 CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. GitFlow.VS.Extension 1.0 Visual Studio extension that integrates GitFlow IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info JetBrains ReSharper 2020.2.4 Build 202.0.20200925.65451 JetBrains ReSharper package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper. Copyright © 2020 JetBrains, Inc. Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.31203.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.113+g422d40002e.RR 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.9.7 (df23ba6) Support for debugging Mono processes with Visual Studio. Node.js Tools 1.5.21118.1 Commit Hash:c1baf2dc21587d4a1866798c1ca7491581d11614 Adds support for developing and debugging Node.js apps in Visual Studio NuGet Package Manager 5.9.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 Snapshot Debugging Extension 1.0 Snapshot Debugging Visual Studio Extension Detailed Info SQL Server Data Tools 16.0.62011.24130 Microsoft SQL Server Data Tools TypeScript Tools 16.0.21120.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 3.9.0-2.20602.2+eb0a7ff1c241695e17b07b096593804fdd5cfcfd 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 16.9.0-beta.20567.7+c02b2ef997f1dd07993e1f85b017c858bdf82530 Microsoft Visual F# Tools 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 1.0 View, manage, and diagnose containers within Visual Studio. Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Foo 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio Xamarin 16.9.000.196 (main@7f5b5b9) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 16.9.0.105 (remotes/origin/c2adbf832aee3f27874ac90b17c433d311053b06@c2adbf832) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 16.9.41 (0d792de) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 11.1.99.218 (master/9bc0003) Xamarin.Android Reference Assemblies and MSBuild support. Mono: ac59637 Java.Interop: xamarin/java.interop/master@99897b2 ProGuard: Guardsquare/proguard/v7.0.0@84e8560 SQLite: xamarin/sqlite/3.32.1@1a3276b Xamarin.Android Tools: xamarin/xamarin-android-tools/main@ab650f5 Xamarin.iOS and Xamarin.Mac SDK 14.9.0.27 (f4c9327fa) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```
omatrot commented 3 years ago

I'm using this package, may be this is related?

omatrot commented 3 years ago

I'm also using Custom renderers, WkWebView in particular for iOS.

hartez commented 3 years ago

@omatrot Does the problem persist if you update to Xamarin.Forms 5.0.0?

If not, you might be running into this issue: https://developercommunity2.visualstudio.com/t/XAML-Hot-Reload-Error-after-upgrading-VS/1295357

Which should be fixed in preview 3.

omatrot commented 3 years ago

Yes I've tried upgrading to Xamarin.Forms 5.0.0 and I still have the problem.

kumarc-123 commented 3 years ago

Even I am facing this issue. Using the latest version of Xamarin forms to this date.

mtucker6784 commented 3 years ago

Anyone else come across a resolution? I'm using 16.9.000.271 against iOS 14.4. Newly created project crashes on startup from the phone itself. Can't get to the point to attach the debugger because VS doesn't see the app live long enough to connect to it. Quite frustrating!

Thanks all.

nor0x commented 2 years ago

i can confirm that this is still happening with Xamarin.Forms 5.0.0.2244 and Visual Studio 2022 Version 17.1.0 Preview 1.1

StephaniesHusband commented 2 years ago

Still seeing it in VS2022 17.0.5 + Xamarin Forms 5.0.0.2337

Full version info... Microsoft Visual Studio Enterprise 2022 Version 17.0.5 VisualStudio.17.Release/17.0.5+32112.339 Microsoft .NET Framework Version 4.8.03752

Installed Version: Enterprise

Azure App Service Tools v3.0.0 17.0.795.42246 Azure App Service Tools v3.0.0

C# Tools 4.0.1-1.21568.1+6ab6601178d9fba8c680b56934cd1742e0816bff 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.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

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

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

Mono Debugging for Visual Studio 17.0.11 (54f19d2) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.0.1 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

Visual Basic Tools 4.0.1-1.21568.1+6ab6601178d9fba8c680b56934cd1742e0816bff 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 17.0.0-beta.21522.2+6d626ff0752a77d339f609b4d361787dc9ca93a5 Microsoft Visual F# Tools

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

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Foo 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

VsVim 2.10.0.5 VsVim is a Vim emulator for Visual Studio

Xamarin 17.0.0.343 (d17-0@fb07a17) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.0.0.183 (remotes/origin/d17-0@a351f0f1f) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.0.17 (9e779b0) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 12.1.0.5 (d17-0/6b0e6b2) Xamarin.Android Reference Assemblies and MSBuild support. Mono: c633fe9 Java.Interop: xamarin/java.interop/d17-0@febb1367 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.36.0@a575761 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-0@a5194e9

Xamarin.iOS and Xamarin.Mac SDK 15.4.0.0 (8fc41ae82) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.