Bug 53295 - Mono sets FullName on a Type when MS.NET does not
Summary: Mono sets FullName on a Type when MS.NET does not
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.8.0 (C9)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-03-14 01:00 UTC by Alex Earl
Modified: 2017-03-16 11:14 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Alex Earl 2017-03-14 01:00:59 UTC
We are running into this in the IronPython test suite. There is a test that imports the extension methods from System.Linq and then chains Where() and Select() calls on a collection. The Select() after the Where() functions correctly on MS.NET because of some code added to check for some specific cases which are found here:

https://github.com/IronLanguages/main/blob/ipy-2.7-maint/Languages/IronPython/IronPython/Runtime/Binding/MetaBuiltinFunction.cs#L245


In MS.NET, Value.DeclaringType.FullName returns null, but in the Mono case it returns System.Collections.Generic.IEnumerable`1[[TSource]].

In MSDN it says this about FullName:

The fully qualified name of the type, including its namespace but not its assembly; or null if the current instance represents a generic type parameter, an array type, pointer type, or byref type based on a type parameter, or a generic type that is not a generic type definition but contains unresolved type parameters.

I'm not sure which of the clauses is causing it to return null on MS.NET exactly, I haven't looked deeply into the code.
Comment 1 Marek Safar 2017-03-16 11:14:02 UTC
This looks like a workaround for .NET bug. MSDN documents FullName null behaviour only for type parameter which is not this case. This case is type parameter parent type which I believe can never by another type parameter.

Simple example like

class G<T>
{
    public static void Foo<U>()
    {

        var ga = MethodBase.GetCurrentMethod().GetGenericArguments();
        var fn = ga[0].DeclaringType.FullName;
        return;
    }
}


works consistently on .NET and Mono