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

Commit 01abce3

Browse files
committed
Locate IVsTippingService using COM Guid
Use the COM Guid rather than simple name to locate interface.
1 parent 5ff428f commit 01abce3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class TippingService : ITippingService
2323

2424
// This is the only supported ClientId
2525
public static readonly Guid ClientId = new Guid("D5D3B674-05BB-4942-B8EC-C3D13B5BD6EE");
26+
public static readonly Guid IVsTippingServiceGuid = new Guid("756F1DC9-47FA-42C5-9C06-252B54148EB8");
2627

2728
readonly IServiceProvider serviceProvider;
2829

@@ -75,7 +76,7 @@ void RequestCalloutDisplay(Guid clientId, Guid calloutId, string title, string m
7576
var parameterTypes = new Type[] { typeof(Guid), typeof(Guid), typeof(string), typeof(string), typeof(bool),
7677
typeof(Microsoft.VisualStudio.OLE.Interop.POINT), typeof(Guid), typeof(uint) };
7778
var tippingServiceType = tippingService.GetType();
78-
var method = tippingService.GetType().GetInterfaces().Where(i => i.Name == "IVsTippingService")
79+
var method = tippingService.GetType().GetInterfaces().Where(i => i.GUID == IVsTippingServiceGuid)
7980
.FirstOrDefault()?.GetMethod("RequestCalloutDisplay", parameterTypes);
8081
if (method == null)
8182
{

test/GitHub.Services.Vssdk.UnitTests/TippingServiceTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Runtime.InteropServices;
23
using NUnit.Framework;
34
using GitHub.Services.Vssdk.Services;
45
using NSubstitute;
@@ -49,6 +50,7 @@ public void Check_Arguments_Passed_To_RequestCalloutDisplay()
4950
default, commandGroupId, commandId);
5051
}
5152

53+
[Guid("756F1DC9-47FA-42C5-9C06-252B54148EB8")]
5254
public interface IVsTippingService
5355
{
5456
void RequestCalloutDisplay(Guid clientId, Guid calloutId, string title, string message, bool isPermanentlyDismissible,

0 commit comments

Comments
 (0)