Bug 21196 - newobj does not recognise closed delegate
Summary: newobj does not recognise closed delegate
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-07-09 08:56 UTC by Marek Safar
Modified: 2014-07-20 22:01 UTC (History)
3 users (show)

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

test (3.50 KB, application/x-msdownload)
2014-07-09 08:56 UTC, Marek Safar

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 GitHub or Developer Community 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 Marek Safar 2014-07-09 08:56:42 UTC
Created attachment 7301 [details]

run attached program

Unhandled Exception:
System.Reflection.TargetParameterCountException: Number of parameter does not match expected count.
  at System.Reflection.Binder.ConvertValues (System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, Boolean exactMatch) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at X.Main () [0x00000] in <filename unknown>:0

Should print "nn"

Note the issue is not in DynamicInvokeImpl which already handles closed delegates via DelegateData.ClosedDelegateForStaticMethod flag
Comment 1 Rodrigo Kumpera 2014-07-20 22:01:06 UTC
This is a regression on master corlib. It works with 3.6.0.

Fixed in 56fb85195ffc740d306bd542fcd7774776c724e4.