Bug 21196

Summary: newobj does not recognise closed delegate
Product: [Mono] Runtime Reporter: Marek Safar <masafa>
Component: JITAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: major CC: kumpera, mono-bugs+mono, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: test

Description Marek Safar 2014-07-09 08:56:42 UTC
Created attachment 7301 [details]
test

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.