Bug 19500 - Upgrade to 7.2.1 Causes "Non-Static method requires a target"
Summary: Upgrade to 7.2.1 Causes "Non-Static method requires a target"
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.2.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2014-05-02 18:27 UTC by Dillon Buchananq
Modified: 2014-07-29 09:22 UTC (History)
6 users (show)

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:

Description Dillon Buchananq 2014-05-02 18:27:54 UTC
The following issue can be reproduced with the following: https://github.com/thedillonb/XamarinTargetNull

Code that was originally working in 7.2.0 is now broken in 7.2.1 due to a "Non-Static method requires a target" issue that arises with nullable objects.

The code example attempts to JSON serialize a nullable object using a previously working SimpleJSON library (single .cs file - also attached). The SimpleJSON library does extensive Expression handling, but for what ever reason, leaves me with a "Non-static method requires a target" exception.
Comment 1 Dillon Buchananq 2014-05-02 18:29:28 UTC
Before being quick to blame the SimpleJson library it should be noted that it works on all other platforms.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-05-05 10:42:32 UTC
Marek, it looks like this is related to the new interpreter support:

Unhandled managed exception: Non-static method requires a target. (System.Reflection.TargetException)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006b] in /work/monotouch/master/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:243 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /work/monotouch/master/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:114 
  at Microsoft.Scripting.Interpreter.MethodInfoCallInstruction.InvokeWorker (System.Object[] args) [0x00030] in /work/monotouch/7.2.1/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs:268 
  at Microsoft.Scripting.Interpreter.MethodInfoCallInstruction.Invoke (System.Object[] args) [0x00000] in /work/monotouch/7.2.1/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs:239 
  at Microsoft.Scripting.Interpreter.MethodInfoCallInstruction.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0003b] in /work/monotouch/7.2.1/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs:289 
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0001b] in /work/monotouch/7.2.1/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs:126
Comment 3 Marek Safar 2014-05-05 13:44:48 UTC
Fixed in Mono master
Comment 4 Dillon Buchananq 2014-05-05 14:02:34 UTC
Any idea when this will hit a stable Xamarin.iOS release?
Comment 5 Rolf Bjarne Kvinge [MSFT] 2014-05-06 04:46:33 UTC
@Dillon, at the moment no, but it usually takes between a month or two.
Comment 6 Gerry 2014-06-19 01:21:35 UTC
I can confirm this error also occurs with Json.Net in the same scenario.  It is still broken in

I am surprised that something as important as this bug fix would take a month or two to make it into the stable release.  You're requiring everyone to jump onto alpha/beta?

I can also confirm that it is not fixed in the beta channel but is fixed in the alpha channel