Bug 17423 - [iOS] System.Core tests fails on iOS devices
Summary: [iOS] System.Core tests fails on iOS devices
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: master
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
: 17974 ()
Depends on:
Blocks:
 
Reported: 2014-01-24 15:18 UTC by GouriKumari
Modified: 2014-04-30 15:29 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 FIXED

Description GouriKumari 2014-01-24 15:18:49 UTC
Steps to Reproduce:

Update System with latest head of monotouch master  fc7ea5c50224a80ec4f916b54fd7cc5a9ffbd6bd 
Update to corresponding mono and maccore
Execute bcltests System.Core on device

Actual Behaviour:
98 tests failures reported on device.

Test Env:
Xamarin.iOS: fc7ea5c50224a80ec4f916b54fd7cc5a9ffbd6bd
Devices
iPhone 5C 7.0.4
iPadmini  7.0.3
iPadAir 7.0.3

TestLog:
https://gist.github.com/GouriKumari/9bd0399f690c3cf95c44
https://gist.github.com/GouriKumari/e8cc660e31f71e63c0ee
https://gist.github.com/GouriKumari/2b57bfad7a8d86cf4922
Comment 1 Sebastien Pouliot 2014-01-27 16:42:16 UTC
Several tests fails on the simulator too (54 here) but some are decorated with:

   [Category ("NotWorkingInterpreter")]

so it might be more a test configuration issue (at least for some of them).

OTOH those were working before (e.g. 7.0.6) so it look like regressions.
Comment 2 Marek Safar 2014-01-28 03:18:12 UTC
Resolved
Comment 4 Marek Safar 2014-01-30 17:18:38 UTC
ioS 7.1 is not tracking latest mono master.

monotouch master is failing in AOT. Zoltan, could you have a look if it's another AOT limitation?
Comment 5 Zoltan Varga 2014-01-30 22:45:27 UTC
There are a lot of failures, some of them like:
        [FAIL] HoistedParameter : System.ExecutionEngineException : Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_string__this___Func`1<string> (System.Func`1<string>)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
look like an aot limitation, but others like:
        [FAIL] CallQueryableSelect : System.ArgumentNullException : Argument cannot be null.
could be something ele.
Comment 6 Marek Safar 2014-01-31 02:37:18 UTC
Only https://wrench.internalx.com/Wrench/WebServices/Download.aspx?workfile_id=1940111 is relevant and that has only ExecutionEngineException failures
Comment 7 Zoltan Varga 2014-02-03 08:03:06 UTC
Testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
		Func<string> f = delegate () { return "A"; };

		var f2 = (Func<Func<string>, string>)Delegate.CreateDelegate (typeof (Func<Func<string>, string>), null, f.GetType ().GetMethod ("Invoke"));

		Console.WriteLine (f2 (f));
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Here a delegate is created with a null target and a delegate invoke method as its target, when
f2 is called, the runtime calls the Invoke method with the 'f' argument as this. This is really hard to support with full aot, since the relevant wrapper depends on both the delegate type, and the target method. So it would be better to make changes to the System.Core code to avoid running into this issue.
Comment 8 Marek Safar 2014-02-26 10:28:56 UTC
There are 2 kid of error. The first one you described, which is even harder to fix in System.Core because that's the code user written.

Second failure has object:gsharedvt_out () on top of stack and looks like vt-sharing bug or issue
Comment 9 Marek Safar 2014-02-26 10:29:38 UTC
ExpressionTest_And
	[FAIL] AndBoolItem : System.ExecutionEngineException : Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_bool__this___Item`1<bool> (MonoTests.System.Linq.Expressions.Item`1<bool>)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

		  at (wrapper unknown) object:gsharedvt_out ()
		  at Microsoft.Scripting.Interpreter.FuncCallInstruction`2[MonoTests.System.Linq.Expressions.Item`1[System.Boolean],System.Boolean].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs:692 
		  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0001b] in /Developer/MonoTouch/Source/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs:126
Comment 10 Zoltan Varga 2014-02-26 10:33:55 UTC
This is probably the same issue, the runtime is trying to use a wrapper method which we don't generate because it is very hard to generate at AOT time.
Comment 11 Marek Safar 2014-02-26 10:40:59 UTC
The method is like

class Item<T> {
	public T Right {
		get {
		}
	}
}


then mi.CreateDelegate(typeof(Func<T0, TRet>)); is called on it. I don't know what is special on it.
Comment 12 Marek Safar 2014-02-26 10:52:10 UTC
*** Bug 17974 has been marked as a duplicate of this bug. ***
Comment 13 Zoltan Varga 2014-02-26 11:11:29 UTC
That is an instance method, and if a delegate is created without passing in a target object, the the first argument of the delegate is used as the this pointer, which means the wrapper method which is used to invoke the delegate needs to depend on both the delegate type, and the exact method which is called. These pairs of types+methods are very hard to enumerate at AOT time.
Comment 14 Zoltan Varga 2014-03-10 14:55:52 UTC
Added a workaround in mono 98619c109aed12c98f37cf0414e5b67035e9fbc2 which fixes a subset of the failures, but the general case is still not fixed.
Comment 15 GouriKumari 2014-04-23 12:44:45 UTC
An update on this bug : Reported System.Core failures are still occuring  in QA monotouch wrench lanes .

Below is the log file from QA mtvs 2.0 series

Log: https://gist.github.com/GouriKumari/d97e668647ec417de8ee

monotouch 7.2.3.2pkg :  f3cf074be1b63d8fa86b883896279894160798af
Comment 16 GouriKumari 2014-04-30 15:29:47 UTC
Test failures are no longer occurring with mtvs2.0 series 91882df9746d118aa7fefff2a1a2baf15cb449ca
Log: https://gist.github.com/GouriKumari/778e6e8957265308e225
Marking this bug as resolved fixed