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...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-03-10 22:16 UTC by Alexander Köplinger [MSFT]
Modified: 2017-05-30 17:38 UTC (History)
1 user (show)

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


Attachments

Description Alexander Köplinger [MSFT] 2017-03-10 22:16:48 UTC
Repro:

> 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

Note You need to log in before you can comment on or make changes to this bug.