Context
In commit 6b30bfd (fix: Generator adjustment for indexers), a workaround was added to IsCollectionInterfaceMember in src/Uno.UWPSyncGenerator/Generator.cs to handle CsWinRT projections that use explicit interface implementations for collection members (e.g., IList<T>.this[int]) while also exposing a public member with the same signature.
The issue is that FindImplementationForInterfaceMember returns the explicit implementation, which doesn't match the public member via SymbolEqualityComparer. The current workaround falls back to loose name+kind matching for indexers and parameter-count matching for methods, which is overly broad and could suppress generation of legitimate stubs.
Current workaround (to be removed)
// Fall back to name+kind matching for indexers and common collection members.
if (member is IPropertySymbol memberProp && ifaceMember is IPropertySymbol ifaceProp
&& memberProp.IsIndexer && ifaceProp.IsIndexer)
{
return true;
}
if (member is IMethodSymbol memberMethod && ifaceMember is IMethodSymbol ifaceMethod
&& memberMethod.Name == ifaceMethod.Name
&& memberMethod.Parameters.Length == ifaceMethod.Parameters.Length)
{
return true;
}
Proposed fix
Instead of the loose matching workaround, the affected types (those inheriting from DependencyObjectCollection<T>) should have proper new shadowing members generated that delegate to the base class implementation. This would:
- Remove the need for the fuzzy matching workaround
- Make the generated code explicit about which members are provided
- Avoid accidentally suppressing stubs for unrelated members that happen to match by name/arity
Files involved
src/Uno.UWPSyncGenerator/Generator.cs — IsCollectionInterfaceMember method (around line 992)
Context
In commit 6b30bfd (
fix: Generator adjustment for indexers), a workaround was added toIsCollectionInterfaceMemberinsrc/Uno.UWPSyncGenerator/Generator.csto handle CsWinRT projections that use explicit interface implementations for collection members (e.g.,IList<T>.this[int]) while also exposing a public member with the same signature.The issue is that
FindImplementationForInterfaceMemberreturns the explicit implementation, which doesn't match the public member viaSymbolEqualityComparer. The current workaround falls back to loose name+kind matching for indexers and parameter-count matching for methods, which is overly broad and could suppress generation of legitimate stubs.Current workaround (to be removed)
Proposed fix
Instead of the loose matching workaround, the affected types (those inheriting from
DependencyObjectCollection<T>) should have propernewshadowing members generated that delegate to the base class implementation. This would:Files involved
src/Uno.UWPSyncGenerator/Generator.cs—IsCollectionInterfaceMembermethod (around line 992)