Bug 26412 - ConstructorInfo.ContainsGenericParameters behaves differently to MS.NET
Summary: ConstructorInfo.ContainsGenericParameters behaves differently to MS.NET
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-01-26 06:51 UTC by Alexander Jesner
Modified: 2015-01-26 12:15 UTC (History)
3 users (show)

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


Attachments

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:

<code>
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);
  }
}
</code>



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

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.


Create a new report for Bug 26412 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


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.

Related Links: