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

Commit

Permalink
Make sure the assembly resolver code always runs
Browse files Browse the repository at this point in the history
Fixes #461
  • Loading branch information
shana committed Jul 29, 2016
1 parent b74a115 commit 319d4a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/GitHub.VisualStudio/GitHub.VisualStudio.csproj
Expand Up @@ -210,9 +210,7 @@
</Compile>
<Compile Include="Base\MenuBase.cs" />
<Compile Include="Menus\CreateGist.cs" />
<Compile Include="..\common\SharedDictionaryManager.cs">
<Link>Helpers\SharedDictionaryManager.cs</Link>
</Compile>
<Compile Include="Helpers\SharedDictionaryManager.cs" />
<Compile Include="Helpers\ActiveDocumentSnapshot.cs" />
<Compile Include="Menus\OpenLink.cs" />
<Compile Include="Menus\LinkMenuBase.cs" />
Expand Down
14 changes: 13 additions & 1 deletion src/GitHub.VisualStudio/GitHubPackage.cs
Expand Up @@ -53,6 +53,12 @@ public class GitHubPackage : Package
};

readonly IServiceProvider serviceProvider;
static bool resolverInitialized;

static GitHubPackage()
{
InitializeAssemblyResolver();
}

public GitHubPackage()
{
Expand All @@ -64,10 +70,16 @@ public GitHubPackage(IServiceProvider serviceProvider)
this.serviceProvider = serviceProvider;
}

protected override void Initialize()
public static void InitializeAssemblyResolver()
{
if (resolverInitialized)
return;
AppDomain.CurrentDomain.AssemblyResolve += LoadAssemblyFromRunDir;
resolverInitialized = true;
}

protected override void Initialize()
{
base.Initialize();
IncrementLaunchCount();

Expand Down
Expand Up @@ -6,6 +6,11 @@ namespace GitHub.VisualStudio.Helpers
{
public class SharedDictionaryManager : ResourceDictionary
{
static SharedDictionaryManager()
{
GitHubPackage.InitializeAssemblyResolver();
}

static readonly Dictionary<Uri, ResourceDictionary> resourceDicts = new Dictionary<Uri, ResourceDictionary>();

Uri sourceUri;
Expand Down

0 comments on commit 319d4a3

Please sign in to comment.