Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 13ba3f2

Browse files
committed
Find RequestCalloutDisplay on IVsTippingService
Explicitly look for RequestCalloutDisplay on IVsTippingService rather than duck-type the service object.
1 parent 8c4852f commit 13ba3f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/GitHub.Services.Vssdk/Services/TippingService.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ void RequestCalloutDisplay(Guid clientId, Guid calloutId, string title, string m
5252
Assumes.Present(tippingService);
5353
var parameterTypes = new Type[] { typeof(Guid), typeof(Guid), typeof(string), typeof(string),
5454
typeof(bool), typeof(FrameworkElement), typeof(Guid), typeof(uint), typeof(object) };
55-
var method = tippingService.GetType().GetMethod("RequestCalloutDisplay", parameterTypes);
55+
var method = tippingService.GetType().GetInterfaces()
56+
.Where(i => i.Name == "IVsTippingService")
57+
.FirstOrDefault()?.GetMethod("RequestCalloutDisplay", parameterTypes);
5658
var arguments = new object[] { clientId, calloutId, title, message, isPermanentlyDismissible, targetElement,
5759
vsCommandGroupId, vsCommandId, commandOption };
5860
method.Invoke(tippingService, arguments);
@@ -73,7 +75,8 @@ void RequestCalloutDisplay(Guid clientId, Guid calloutId, string title, string m
7375
var parameterTypes = new Type[] { typeof(Guid), typeof(Guid), typeof(string), typeof(string), typeof(bool),
7476
typeof(Microsoft.VisualStudio.OLE.Interop.POINT), typeof(Guid), typeof(uint) };
7577
var tippingServiceType = tippingService.GetType();
76-
var method = tippingServiceType.GetMethod("RequestCalloutDisplay", parameterTypes);
78+
var method = tippingService.GetType().GetInterfaces().Where(i => i.Name == "IVsTippingService")
79+
.FirstOrDefault()?.GetMethod("RequestCalloutDisplay", parameterTypes);
7780
if (method == null)
7881
{
7982
log.Error("Couldn't find method on {Type} with parameters {Parameters}", tippingServiceType, parameterTypes);

0 commit comments

Comments
 (0)