Bug 3251 - GetAllBaseTypeDefinitions now returns the class *and* the base types
Summary: GetAllBaseTypeDefinitions now returns the class *and* the base types
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-02-07 09:53 UTC by Alan McGovern
Modified: 2012-02-07 13:43 UTC (History)
1 user (show)

Tags: resolver
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 Developer Community or GitHub 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 FIXED

Description Alan McGovern 2012-02-07 09:53:26 UTC
The extension method 'GetAllBaseTypeDefinitions' in contrib/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs returns the base types *and* also the type itself. This means that code such as the following no longer works and instead results in infinite recursion:

ParseTypes (Type type) {
    foreach (var baseType in type.GetAllBaseTypeDefinitions ()) {
        ParseTypes (baseType);
    }
}

Repro steps:
1) Build any project using gtk-sharp custom widgets, such as MonoDevelop.
Comment 1 Alan McGovern 2012-02-07 09:54:06 UTC
A typical infinite recursion stacktrace:


  at MonoDevelop.GtkCore.WidgetParser.CollectMembers (ITypeDefinition cls, Boolean inherited, System.String topType, System.Collections.Specialized.ListDictionary properties, System.Collections.Specialized.ListDictionary events) [0x000e5] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetParser.cs:89 
  at MonoDevelop.GtkCore.WidgetParser.CollectMembers (ITypeDefinition cls, Boolean inherited, System.String topType, System.Collections.Specialized.ListDictionary properties, System.Collections.Specialized.ListDictionary events) [0x000e5] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetParser.cs:89 
  at MonoDevelop.GtkCore.WidgetParser.CollectMembers (ITypeDefinition cls, Boolean inherited, System.String topType, System.Collections.Specialized.ListDictionary properties, System.Collections.Specialized.ListDictionary events) [0x000e5] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetParser.cs:89
Comment 2 Mike Krüger 2012-02-07 11:40:19 UTC
It's not a bug in the method, it's by design.

It makes more sense that way - in most operations you need to have the whole type hierarchy for that. 

The GetAllBaseTypeDefinitions extension method is "GetInheritanceTree" in the old dom.

The thing that should be used above is 

"type.DirectBaseTypes" - I searched for GetAllBaseTypeDefinitions usages & corrected them. This is an error in the "port" - maybe that changed from an older version of the type system or that was a port bug from begin.
Comment 3 Mike Krüger 2012-02-07 13:43:39 UTC
We're searching a different name for GetAllBaseTypeDefinitions - that should fix it.