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

Commit f66afaf

Browse files
committed
Use package without MEF dependency for GitHubPane
The package that hosts GitHubPane mustn't initialize MEF (even on a background thread).
1 parent ca0a273 commit f66afaf

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

src/GitHub.Exports/Settings/Guids.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static class Guids
1313
public const string CodeContainerProviderId = "6CE146CB-EF57-4F2C-A93F-5BA685317660";
1414
public const string InlineReviewsPackageId = "248325BE-4A2D-4111-B122-E7D59BF73A35";
1515
public const string PullRequestStatusPackageId = "5121BEC6-1088-4553-8453-0DDC7C8E2238";
16+
public const string GitHubPanePackageId = "0A40459D-6B6D-4110-B6CE-EC83C0BC6A09";
1617
public const string TeamExplorerWelcomeMessage = "C529627F-8AA6-4FDB-82EB-4BFB7DB753C3";
1718
public const string LoginManagerId = "7BA2071A-790A-4F95-BE4A-0EEAA5928AAF";
1819

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@
315315
<Compile Include="Commands\ShowGitHubPaneCommand.cs" />
316316
<Compile Include="Commands\OpenPullRequestsCommand.cs" />
317317
<Compile Include="GitContextPackage.cs" />
318+
<Compile Include="GitHubPanePackage.cs" />
318319
<Compile Include="IServiceProviderPackage.cs" />
319320
<Compile Include="Helpers\ActiveDocumentSnapshot.cs" />
320321
<Compile Include="Commands\AddConnectionCommand.cs" />

src/GitHub.VisualStudio/GitHubPackage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ namespace GitHub.VisualStudio
2828
[Guid(Guids.guidGitHubPkgString)]
2929
[ProvideMenuResource("Menus.ctmenu", 1)]
3030
[ProvideAutoLoad(Guids.UIContext_Git, PackageAutoLoadFlags.BackgroundLoad)]
31-
[ProvideToolWindow(typeof(GitHubPane), Orientation = ToolWindowOrientation.Right, Style = VsDockStyle.Tabbed, Window = EnvDTE.Constants.vsWindowKindSolutionExplorer)]
3231
[ProvideOptionPage(typeof(OptionsPage), "GitHub for Visual Studio", "General", 0, 0, supportsAutomation: true)]
3332
public class GitHubPackage : AsyncMenuPackage
3433
{
@@ -137,7 +136,7 @@ public async Task<IGitHubPaneViewModel> ShowGitHubPane()
137136
}
138137

139138
var gitHubPane = (GitHubPane)pane;
140-
var viewModel = (IGitHubPaneViewModel)((FrameworkElement)gitHubPane.View).DataContext;
139+
var viewModel = (IGitHubPaneViewModel)(gitHubPane.View).DataContext;
141140
await viewModel.InitializeAsync(pane);
142141
return viewModel;
143142
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using GitHub.VisualStudio.UI;
4+
using Microsoft.VisualStudio.Shell;
5+
6+
namespace GitHub.VisualStudio
7+
{
8+
/// <summary>
9+
/// This is the host package for the <see cref="GitHubPane"/> tool window.
10+
/// </summary>
11+
/// <remarks>
12+
/// This package mustn't use MEF.
13+
/// See: https://github.com/github/VisualStudio/issues/1550
14+
/// </remarks>
15+
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
16+
[Guid(Guids.GitHubPanePackageId)]
17+
[ProvideToolWindow(typeof(GitHubPane), Orientation = ToolWindowOrientation.Right,
18+
Style = VsDockStyle.Tabbed, Window = EnvDTE.Constants.vsWindowKindSolutionExplorer)]
19+
public sealed class GitHubPanePackage : AsyncPackage
20+
{
21+
}
22+
}

0 commit comments

Comments
 (0)