Bug 19082

Summary: Assembly.GetAssembly(x).DefinedTypes.Select(v => v.AsType()) vs typeof(X)
Product: [Mono] Runtime Reporter: Oguzhan <oguzhntopcu>
Component: ReflectionAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: masafa, mono-bugs+runtime, oguzhntopcu
Priority: ---    
Version: 3.2.x   
Target Milestone: ---   
Hardware: PC   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:

Description Oguzhan 2014-04-16 09:48:04 UTC
using System;
using System.Linq;
using System.Reflection;

namespace DefinedTypesRepro
{
    class Program
    {
        static void Main(string[] args)
        {
            var testType = Assembly.GetExecutingAssembly()
                .DefinedTypes.Select(b => b.AsType())
                .First(n => n.BaseType == typeof(TestBase));

            Console.WriteLine(testType.FullName);
            Console.WriteLine(testType == typeof(Test));
            Console.ReadLine();
        }
    }

    public class TestBase
    {
    }

    public class Test : TestBase
    {
        
    }
}

.Net Framework 4.5 Output:
DefinedTypesRepro.Test
True

Mono 3.3.0 (Both of windows and linux) Output:
DefinedTypesRepro.Test
False

I think they need to be same :)
Comment 2 Oguzhan 2014-04-16 10:08:13 UTC
Sorry for wrong link,

https://entityframework.codeplex.com/workitem/2147
Comment 3 Marek Safar 2014-04-17 14:00:37 UTC
Fixed in master