Bug 53244 - mcs generates ParamArrayAttribute when specifying "params" in overridden method where base doesn't have it
Summary: mcs generates ParamArrayAttribute when specifying "params" in overridden meth...
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2017-03-10 22:16 UTC by Alexander Köplinger [MSFT]
Modified: 2017-05-30 17:38 UTC (History)
1 user (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 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 Alexander Köplinger [MSFT] 2017-03-10 22:16:48 UTC

> public abstract class A {
>     public abstract void Bind(string[] args);
> }
> public class B : A {
>    public override void Bind(params string[] args) {
>    }
> }

Compiling with "mcs /t:library test.cs" and then disassembling reveals:

>  .method public hidebysig virtual instance void
>          Bind(string[] args) cil managed
>  {
>    .param [1]
>    .custom instance void [mscorlib]System.ParamArrayAttribute::.ctor() = ( 01 00 00 00 )
>    // Code size       1 (0x1)
>    .maxstack  8
>    IL_0000:  ret
>  } // end of method B::Bind

Roslyn doesn't emit the ParamArrayAttribute and according to http://stackoverflow.com/questions/15774529/changing-the-params-modifier-in-a-method-override this is the correct behavior. Found while looking at the genapi diffs.
Comment 1 Marek Safar 2017-05-30 17:38:59 UTC
Fixed in master