Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Microsoft.VisualStudio.Composition.ComposablePartDefinition.ComposablePartDefini
Microsoft.VisualStudio.Composition.ComposablePartDefinition.OnImportsSatisfiedMethodRefs.get -> System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.Reflection.MethodRef!>!
Microsoft.VisualStudio.Composition.ComposablePartDefinition.OnImportsSatisfiedMethods.get -> System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo!>!
Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimePart.OnImportsSatisfiedMethodRefs.get -> System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.Reflection.MethodRef!>!
Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimePart.RuntimePart(Microsoft.VisualStudio.Composition.Reflection.TypeRef! type, Microsoft.VisualStudio.Composition.Reflection.MethodRef? importingConstructor, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport!>! importingConstructorArguments, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport!>! importingMembers, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeExport!>! exports, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.Reflection.MethodRef!>! onImportsSatisfiedMethods, string? sharingBoundary) -> void
Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimePart.RuntimePart(Microsoft.VisualStudio.Composition.Reflection.TypeRef! type, Microsoft.VisualStudio.Composition.Reflection.MethodRef? importingConstructor, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport!>! importingConstructorArguments, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport!>! importingMembers, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeExport!>! exports, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Composition.Reflection.MethodRef!>! onImportsSatisfiedMethods, string? sharingBoundary) -> void
override Microsoft.VisualStudio.Composition.Reflection.MethodRef.ToString() -> string!
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class MethodRef : MemberRef, IEquatable<MethodRef>
/// Gets the string to display in the debugger watch window for this value.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal virtual string DebuggerDisplay => $"{this.DeclaringType.FullName}.{this.Name}({string.Join(", ", this.ParameterTypes.Select(p => p.FullName))})";
internal virtual string DebuggerDisplay => this.ToString();

public MethodRef(TypeRef declaringType, int metadataToken, string name, bool isStatic, ImmutableArray<TypeRef> parameterTypes, ImmutableArray<TypeRef> genericMethodArguments)
: base(declaringType, metadataToken, isStatic)
Expand Down Expand Up @@ -104,5 +104,7 @@ protected override bool EqualsByTypeLocalMetadata(MemberRef other)
public override int GetHashCode() => this.DeclaringType.GetHashCode() + this.Name.GetHashCode();

public bool Equals(MethodRef? other) => this.Equals((MemberRef?)other);

public override string ToString() => $"{this.DeclaringType.FullName}.{this.Name}({string.Join(", ", this.ParameterTypes.Select(p => p.FullName))})";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,13 @@ public void MethodInfo_FromMetadataToken()
var methodRef = new MethodRef(TypeRef.Get(this.GetType(), Resolver.DefaultInstance), methodInfo.MetadataToken, methodInfo.Name, methodInfo.IsStatic, ImmutableArray<TypeRef>.Empty, ImmutableArray<TypeRef>.Empty);
Assert.Same(methodInfo, methodRef.MethodBase);
}

[Fact]
public void ToString_Override()
{
MethodInfo methodInfo = this.GetType().GetTypeInfo().GetMethod(nameof(this.ToString_Override))!;
var methodRef = new MethodRef(TypeRef.Get(this.GetType(), Resolver.DefaultInstance), methodInfo.MetadataToken, methodInfo.Name, methodInfo.IsStatic, ImmutableArray<TypeRef>.Empty, ImmutableArray<TypeRef>.Empty);
Assert.Equal("Microsoft.VisualStudio.Composition.Tests.Reflection.MethodRefTests.ToString_Override()", methodRef.ToString());
}
}
}