Skip to content

Commit

Permalink
Fix "ambiguous match" error when exporting interface with multiple in…
Browse files Browse the repository at this point in the history
…dexers (#197)

Co-authored-by: Manuel Leßmann <[email protected]>
  • Loading branch information
mlessmann and Manuel Leßmann authored Oct 16, 2023
1 parent fda665c commit 7e50dcc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/dscom.demo/assembly3/IDemoInterfaceComInvisible.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ public interface IDemoInterfaceComVisible
{
void DoSomething(IDemoInterfaceComInvisible param);
}

[ComVisible(true)]
public interface IDemoInterfaceIndexerInvisible
{
public string this[int x] { get; }

[ComVisible(false)]
public string this[string s] { get; }
}
2 changes: 1 addition & 1 deletion src/dscom/writer/PropertyMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class PropertyMethodWriter : MethodWriter
private readonly PropertyInfo? _propertyInfo;
public PropertyMethodWriter(InterfaceWriter interfaceWriter, MethodInfo methodInfo, WriterContext context, string methodName) : base(interfaceWriter, methodInfo, context, methodName)
{
_propertyInfo = methodInfo.DeclaringType!.GetProperty(GetPropertyName());
_propertyInfo = methodInfo.DeclaringType!.GetProperties().First(p => p.GetGetMethod() == methodInfo || p.GetSetMethod() == methodInfo);
MemberInfo = _propertyInfo!;
}

Expand Down

0 comments on commit 7e50dcc

Please sign in to comment.