Bug 15744 - AOT Bug on code which worked before
Summary: AOT Bug on code which worked before
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.0.2.x
Hardware: PC Windows
: Normal normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2013-10-28 10:55 UTC by felix.Speedmaster
Modified: 2017-07-24 14:38 UTC (History)
6 users (show)

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


Attachments
Version information and code (3.76 KB, text/plain)
2013-10-28 10:55 UTC, felix.Speedmaster
Details
Testcase ( untested ) (124.39 KB, application/octet-stream)
2013-10-29 05:47 UTC, felix.Speedmaster
Details


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 NOT_REPRODUCIBLE

Description felix.Speedmaster 2013-10-28 10:55:03 UTC
Created attachment 5252 [details]
Version information and code

Hi,

the code in the attachment is not working but it has actually worked before the big AOT update ( so i think before 6.3 ). This issue prevents me from updating my applications and is hard to fix for me from the code site ( And i'm not interested in fixing code which worked before the update ).

Regards
Felix K.
Comment 1 Sebastien Pouliot 2013-10-28 11:17:50 UTC
Can you attach a self-contained test case so we can see:

a) the build options you used;

b) how you called the code (code generation wrt generics vary a lot depending on the actual types being used);

Thanks!
Comment 2 felix.Speedmaster 2013-10-29 05:47:03 UTC
Created attachment 5259 [details]
Testcase ( untested )

Added a attachment which should represent the case ( Actually not tested because i've no iPad here  ). I tried to represent the original situation of my code. If this not causing a bug i've to upload the hole project ( But only "private" because its owned by the company ).
Comment 3 Zoltan Varga 2013-10-29 11:15:19 UTC
I can't reproduce the problem with this testcase.
Comment 5 felix.Speedmaster 2013-11-13 14:12:43 UTC
This bug is still waiting for process. Is there any new information on the bug? This bug appears since 6.3.X and we can't update our software.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2013-11-13 17:05:30 UTC
I get this exception at startup (once I've added support for the iPad Air - imho you should not crash at startup if you encounter an unknown device, because you'll have to update your app every time Apple releases a new device):

2013-11-13 23:02:59.548 MyPuzzle[206:60b] [E] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_void__this___Drawable_object_PropertyChangedArgs (Pipedream.UI.Drawable,object,Pipedream.PropertyChangedArgs)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at Pipedream.WeakDelegate`3[Pipedream.UI.Drawable,System.Object,Pipedream.PropertyChangedArgs].HandleEvent (System.Object sender, Pipedream.PropertyChangedArgs args) [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at (wrapper delegate-invoke) Pipedream.DataEventHandler`2<object, Pipedream.PropertyChangedArgs>:invoke_void__this___S_T (object,Pipedream.PropertyChangedArgs)
  at Pipedream.DependencyObject.ForceUpdate (Pipedream.DependencyProperty property, System.Object newValue, System.Object oldValue) [0x00019] in /Users/rolf/Downloads/AOTBug/Pipedream/Components/DependencyObject.cs:141 
  at Pipedream.UI.UIElement.ForceUpdate (Pipedream.DependencyProperty property, System.Object newValue, System.Object oldValue) [0x00005] in /Users/rolf/Downloads/AOTBug/Pipedream/UI/UIElement.cs:582 
  at Pipedream.UI.UIContainer.get_Children () [0x00078] in /Users/rolf/Downloads/AOTBug/Pipedream/UI/UIContainer.cs:43 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00044] in /work/monotouch/master/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
Comment 7 felix.Speedmaster 2013-11-13 17:08:44 UTC
Well as i said, it worked before. Normaly it should not crash, i think my team need to test this.
Comment 8 Zoltan Varga 2013-11-13 19:00:05 UTC
So the problem here is the WeakDelegate class, which binds instance methods to a delegate which has no target object:

            _CallDelegate = (Action<TThis, TSender, TArgs>)Delegate.CreateDelegate(CallDelegateType, target.Method);

This is not currently supported by our AOT compiler, if this ever worked, it only worked by accident.

A workaround until this is fixed would be to create the delegate in HandleEvent (), i.e.:

				var del = (Action<TSender, TArgs>)Delegate.CreateDelegate(typeof(Action<TSender, TArgs>), target, minfo);
				del(sender, args);

where minfo is target.Method as saved in the constructor.
Comment 9 John Miller [MSFT] 2017-07-24 14:38:07 UTC
I attempted to reproduce this issue based on the bug description with the latest Xamarin.iOS 10.12.0.14, and I was unable to hit the problem. If this issue is still occurring for you, please reopen this report and attach an updated reproduction project, ideally starting with a new template project and then adding just the code necessary to demonstrate the issue.