You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reflection import imports indexers as an "Item" member, interface property accessors as get_/set_ functions, and drops methods inherited from base interfaces #301
Three problems in Schema/Models/ClrTypeImporter.cs:
Indexers become members.Import (~L52) enumerates type.GetProperties(Public | Instance), and that list includes indexers. A class with public string this[int i] imports a member Item : String that the type doesn't actually have as data. Regenerating then emits a real Item property.
Interface property accessors become functions.ImportInterface (~L263) enumerates type.GetMethods(Public | Instance). For an interface with int Count { get; }, that list includes the compiler-generated get_Count, so the schema gains a function get_Count. Regenerating emits int get_Count();, and a hand-written implementation of the original interface no longer satisfies it.
Inherited interface methods are dropped.Type.GetMethods on an interface doesn't return methods inherited from base interfaces. For interface IDerived : IBase, only IDerived's own methods are imported. IBase.Ping disappears and nothing reports it.
Repro
AddClass(typeof(Indexed)), where Indexed has Name and an indexer, gives members Name and Item.
AddInterface(typeof(IDerived)), where:
IDerived : IBase declares int Count { get; } and void Pong()
IBase declares void Ping()
gives functions get_Count and Pong. Ping is missing.
Suggested fix / acceptance criteria
Skip properties with GetIndexParameters().Length > 0.
Skip accessor methods where MethodInfo.IsSpecialName is true. Whether interface properties should later be imported, for example as query functions, or refused with a diagnostic is a separate decision.
Walk type.GetInterfaces() to pick up inherited methods, de-duplicating by name. Two inherited methods with the same name would collide in AddFunction, so report that case.
Add tests for all three cases in AddClassFromTypeTests and the AddInterface tests.
Severity is moderate: this only affects hand-written types. Generated C# never emits indexers, interface properties or interface inheritance.
Priority: Medium. Reflection import silently produces a wrong schema (a phantom Item member, get_X functions, missing inherited methods), and regenerating from it breaks existing implementations. Limited to hand-written types, as the issue notes.
Area / suggested assignee:Schema/Models/ClrTypeImporter.cs (Import, ImportInterface). Owner: @matt-edmondson
Next step: apply the three filters/walks listed in the issue and add the tests to AddClassFromTypeTests and the AddInterface tests. Leave importing interface properties as a separate decision.
Activity
matt-edmondson commentedon Oct 19, 2026
Triage
Itemmember,get_Xfunctions, missing inherited methods), and regenerating from it breaks existing implementations. Limited to hand-written types, as the issue notes.Schema/Models/ClrTypeImporter.cs(Import,ImportInterface). Owner: @matt-edmondsonAddClassFromTypeTestsand theAddInterfacetests. Leave importing interface properties as a separate decision.Generated by Claude Code
Import only real members and every inherited function from CLR types