Bug 35164 - condition method not met
Summary: condition method not met
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 9.0 (iOS9)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-10-22 09:51 UTC by softlion
Modified: 2016-04-12 15:21 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description softlion 2015-10-22 09:51:05 UTC
Hi, 
i'm getting an impossible crash every time in an ios test app on the ios 8.4 simulator.
Is it caused by VS2015 Update 1 CTP?
This vs 2015 update1 fixes the false bug reports in code, so it is a must.

App Log:

Oct 22 15:31:35 MacDeMiniMac.local XamSvgIos2Tests[4143]: error: * Assertion at ../../../../../mono/mono/metadata/marshal.c:3803, condition `method' not met
Oct 22 15:31:35 MacDeMiniMac.local XamSvgIos2Tests[4143]: critical: Stacktrace:
Oct 22 15:31:35 MacDeMiniMac.local XamSvgIos2Tests[4143]: critical:   at <unknown> <0xffffffff>
Oct 22 15:31:35 MacDeMiniMac.local XamSvgIos2Tests[4143]: critical:   at XamSvg.Shared.Internal.BaseSvgHandler.parseSVG () [0x00180] in D:\dev\Repos\XamSvg\Lib\XamSvg.Shared\Internal\SvgParserHelper.cs:269

...
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	0   libmonosgen-2.0.dylib               0x021244b7 mono_handle_native_sigsegv + 311
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	1   libmonosgen-2.0.dylib               0x0217a111 sigabrt_signal_handler + 145
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	2   libsystem_platform.dylib            0x030ba03b _sigtramp + 43
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	3   ???                                 0xffffffff 0x0 + 4294967295
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	4   libsystem_sim_c.dylib               0x02e41a5a abort + 156
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	5   XamSvgIos2Tests                     0x0003029b _ZL12log_callbackPKcS0_S0_iPv + 91
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	6   libmonosgen-2.0.dylib               0x022a3b80 log_adapter + 176
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	7   libmonosgen-2.0.dylib               0x022bd8db monoeg_assertion_message + 107
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	8   libmonosgen-2.0.dylib               0x021c4ae3 mono_marshal_get_runtime_invoke + 2659
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	9   libmonosgen-2.0.dylib               0x0207d9e7 mono_jit_runtime_invoke + 183
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	10  libmonosgen-2.0.dylib               0x0222f79f mono_runtime_invoke + 127
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	11  libmonosgen-2.0.dylib               0x0219ed02 create_exception_two_strings + 290
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	12  libmonosgen-2.0.dylib               0x0219ebd3 mono_exception_from_name_two_strings + 51
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	13  libmonosgen-2.0.dylib               0x022b14ad mono_error_prepare_exception + 525
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	14  libmonosgen-2.0.dylib               0x022b194a mono_error_convert_to_exception + 58
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	15  libmonosgen-2.0.dylib               0x0207a767 mono_jit_compile_method_with_opt + 2727
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	16  libmonosgen-2.0.dylib               0x02079c69 mono_jit_compile_method + 57
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	17  libmonosgen-2.0.dylib               0x02125d3b common_call_trampoline + 1275
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	18  libmonosgen-2.0.dylib               0x02126e73 mono_vcall_trampoline + 211
Oct 22 15:40:20 MacDeMiniMac.local XamSvgIos2Tests[4199]: critical: 	19  ???                                 0x0a3eac89 0x0 + 171879561



SvgParserHelper.cs:

    public abstract class BaseSvgHandler
    {
        protected IPlatformSvgHandler platform;
        ...

268            if(platform==null) throw Exception("platform is null");
269            platform.BeginRecording();
        }
    }

    internal class IosSvgHandler : BaseSvgHandler, IPlatformSvgHandler
    {
        public IosSvgHandler()
        {
            platform = this;
        }

        public void BeginRecording()
        {
            Debug.WriteLine("BeginRecording called");
        }
    }

    public interface IPlatformSvgHandler
    {
        void BeginRecording();
    }



Microsoft Visual Studio Professional 2015
Version 14.0.24606.01 Update 1 CTP
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Professional

Visual Basic 2015   00322-40000-00000-AA669
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA669
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA669
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA669
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.60814.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

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

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JetBrains ReSharper Ultimate 10 EAP 5   Build 104.0.20151015.192321-EAP5
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure HDInsight HQL Service   2.0.2600.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   2.0.2600.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.7
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.7.30818.1601

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

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50730.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23309.00 d14oob
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   3.11.1537.0 (a11147b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.7.12 (53fce3730830417896a42f365a5ba35f1ee58d9d)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   9.0.1.0 (73db6324ad6864caae30bf4010c185598d262e69)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-10-22 10:03:41 UTC
Can you attach a complete project we can use to reproduce this?
Comment 2 softlion 2015-10-22 10:26:20 UTC
I disabled the linker (which was set to "sdk only" in debug mode!), and the error is at the same line, but different.

System.MissingFieldException: Field 'XamSvg.Shared.Internal.BaseSvgHandler.bounds' not found.


        protected RectangleF bounds;

RectangleF is coming from the "Splat" PCL library on nuget.
The base class is inside a PCL.

I try to create a repro.
Comment 3 softlion 2015-10-22 10:38:37 UTC
I have a repro !
I posted it here:  

https://onedrive.live.com/redir?resid=8797CB9EE5CA6B7A!444&authkey=!AJc3Y9GDyRPwja8&ithint=file%2crar

I suppose the root cause is the "Splat" nuget, which is not referenced in the main iOS app (because it should be imported automatically by the linker).


Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: FinishedLaunching called
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: platform not null
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: 
	Unhandled Exception:
	System.MissingFieldException: Field 'ClassLibrary1.BaseSvgHandler.bounds' not found.
	  at ClassLibrary1.BaseSvgHandler.Run () [0x00024] in C:\Users\benjamin\Documents\Visual Studio 2015\Projects\App1\ClassLibrary1\BaseSvgHandler.cs:22 
	  at App1.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00012] in C:\Users\benjamin\Documents\Visual Studio 2015\Projects\App1\App1\AppDelegate.cs:21 
	  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
	  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:74 
	  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:57 
	  at App1.Application.Main (System.String[] args) [0x00001] in C:\Users\benjamin\Documents\Visual Studio 2015\Projects\App1\App1\Main.cs:15 
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: Unhandled managed exception:
	Field 'ClassLibrary1.BaseSvgHandler.bounds' not found. (System.MissingFieldException)
	  at ClassLibrary1.BaseSvgHandler.Run () [0x00024] in C:\Users\benjamin\Documents\Visual Studio 2015\Projects\App1\ClassLibrary1\BaseSvgHandler.cs:22 
	  at App1.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00012] in C:\Users\benjamin\Documents\Visual Studio 2015\Projects\App1\App1\AppDelegate.cs:21 
	  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
	  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:74 
	  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:57 
	  at App1.Application.Main (System.String[] args) [0x00001] in C:\Users\benjamin\Documents\Visual Studio 2015\Projects\App1\App1\Main.cs:15 
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: Stacktrace:
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 
	Native stacktrace:
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	0   App1                                0x001e2b67 mono_handle_native_sigsegv + 311
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	1   App1                                0x001e9ba1 sigabrt_signal_handler + 145
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	2   libsystem_platform.dylib            0x07eef03b _sigtramp + 43
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	3   ???                                 0xffffffff 0x0 + 4294967295
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	4   libsystem_sim_c.dylib               0x07c76a5a abort + 156
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	5   App1                                0x00374246 xamarin_unhandled_exception_handler + 342
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	6   App1                                0x001e33db mono_invoke_unhandled_exception_hook + 91
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	7   App1                                0x001e229e mono_handle_exception_internal + 6206
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	8   App1                                0x001e0a59 mono_handle_exception + 41
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	9   App1                                0x0017a347 mono_x86_throw_exception + 135
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	10  ???                                 0x13543f57 0x0 + 324288343
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	11  App1                                0x001eab5b common_call_trampoline + 1275
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	12  App1                                0x001ebc93 mono_vcall_trampoline + 211
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 	13  ???                                 0x13543c89 0x0 + 324287625
Oct 22 16:34:11 MacDeMiniMac.local App1[5070]: critical: 
	=================================================================
	Got a SIGABRT while executing native code. This usually indicates
	a fatal error in the mono runtime or one of the native libraries 
	used by your application.
	=================================================================
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-10-22 11:50:22 UTC
@softlion, that project crashes because of an unhandled exception (Unhandled Exception: System.MissingFieldException: Field 'ClassLibrary1.BaseSvgHandler.bounds' not found.), which is not the same as the original crash you reported (error: * Assertion at
../../../../../mono/mono/metadata/marshal.c:3803, condition `method' not met)

Here's a patch that makes your project run fine: https://gist.github.com/rolfbjarne/cfa004d8f29cefd47ce2
Comment 5 softlion 2015-10-22 13:46:03 UTC
Well it is the same.

If you enable linking "SDK only", you will get the initial exception i reported.
Comment 6 Zoltan Varga 2015-10-22 23:46:26 UTC
This looks like a strange c# compilation problem.

Class1Library.BaseSvgHandler has a 'bounds' field, which is resolved to an assembly named 'Splat':

.class public abstract auto ansi beforefieldinit ClassLibrary1.BaseSvgHandler
       extends [mscorlib_2]System.Object
{
  .field family class ClassLibrary1.IPlatformSvgHandler platform
  .field family valuetype [Splat]System.Drawing.RectangleF bounds

IosClassLibrary.IosSvgHandler references this field:

        public void BeginRecording()
        {
            Debug.WriteLine("BeginRecording called");
            var t = bounds;
        }

but it gets compiled to:

    IL_000c:  ldfld      valuetype [Xamarin.iOS]System.Drawing.RectangleF [ClassLibrary1]ClassLibrary1.BaseSvgHandler::bounds

This causes a JIT error at AOT time, leading to the missing method error.
Comment 7 Rolf Bjarne Kvinge [MSFT] 2015-10-23 04:14:57 UTC
@Marek, can you have a look at comment #6 and see if this is something in mcs?
Comment 8 softlion 2015-10-23 04:40:42 UTC
Just to let you know: if the "Splat" assembly is added to the iOS app project, it works fine.
So the Splat assembly is the cause of the strange linker behavior. I suppose this assembly was hand made with facade like classes in the System namespace.

Note tha Splat is open source:
https://github.com/paulcbetts/splat
Comment 9 Marek Safar 2015-10-26 12:48:03 UTC
This is expected as different Splat.dll is used

ClassLibrary1 references ..\packages\Splat.1.6.2\lib\Portable-net45+win+wpa81+wp80\Splat.dll
IosClassLibrary references ..\packages\Splat.1.6.2\lib\Xamarin.iOS10\Splat.dll

Each version declares System.Drawing.RectangleF differently. Portable-net45+win+wpa81+wp80 has it inline and Xamarin.iOS10 uses type forwarder to Xamarin.iOS
Comment 10 Sebastien Pouliot 2016-04-12 15:21:58 UTC
Answered in comment #9