Bug 26412

Summary: ConstructorInfo.ContainsGenericParameters behaves differently to MS.NET
Product: [Mono] Class Libraries Reporter: Alexander Jesner <alexander.jesner>
Component: mscorlibAssignee: Marek Safar <masafa>
Severity: normal CC: masafa, mono-bugs+mono, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: Untriaged   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

Description Alexander Jesner 2015-01-26 06:51:20 UTC
ConstructorInfo.ContainsGenericParameters seems to behave differently to MS.NET
  on Windows is is true for types with generic type parameters 
  on Linux it is false for the same generic type.

This code snippet can be used to reproduce the error:

using System;

public class Test
  class Something<T>        
  { }

  public static void Main()
      var type = typeof(Something<>);
      Console.WriteLine("{0}.ContainsGenericParameters: {1}", type.Name, type.ContainsGenericParameters);

      var ctor = type.GetConstructor(new Type[0]);
      Console.WriteLine("{0}.ContainsGenericParameters: {1}", ctor.Name, ctor.ContainsGenericParameters);

I tested with two different Mono versions and .NET 4.5:

Output on Windows (.NET 4.5.51209)
    Something`1.ContainsGenericParameters: True
    .ctor.ContainsGenericParameters: True

Output on Linux (Mono JIT compiler version 3.6.0 ((detached/f2987d2 Thu Oct  9 09:28:22 CEST 2014)
    Something`1.ContainsGenericParameters: True
    .ctor.ContainsGenericParameters: False

Output on Linux (Mono JIT compiler version 3.12.0 (tarball Sun Jan 25 23:32:43 PST 2015)
    Something`1.ContainsGenericParameters: True
    .ctor.ContainsGenericParameters: False
Comment 1 Alexander Jesner 2015-01-26 07:33:00 UTC
Update: It seems that older MS.NET versions (2.0, 3.5) show the same behaviour as Mono. The reported bug is only true when targeting assemblies for >= 4.0.
Comment 2 Marek Safar 2015-01-26 12:15:51 UTC
Fixed in master