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

Commit 58d89f9

Browse files
shanapaladique
authored andcommitted
Make sure the assembly resolver code always runs
Fixes #461
1 parent 5b2c0ba commit 58d89f9

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@
210210
</Compile>
211211
<Compile Include="Base\MenuBase.cs" />
212212
<Compile Include="Menus\CreateGist.cs" />
213-
<Compile Include="..\common\SharedDictionaryManager.cs">
214-
<Link>Helpers\SharedDictionaryManager.cs</Link>
215-
</Compile>
213+
<Compile Include="Helpers\SharedDictionaryManager.cs" />
216214
<Compile Include="Helpers\ActiveDocumentSnapshot.cs" />
217215
<Compile Include="Menus\OpenLink.cs" />
218216
<Compile Include="Menus\LinkMenuBase.cs" />

src/GitHub.VisualStudio/GitHubPackage.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public class GitHubPackage : Package
5353
};
5454

5555
readonly IServiceProvider serviceProvider;
56+
static bool resolverInitialized;
57+
58+
static GitHubPackage()
59+
{
60+
InitializeAssemblyResolver();
61+
}
5662

5763
public GitHubPackage()
5864
{
@@ -64,10 +70,16 @@ public GitHubPackage(IServiceProvider serviceProvider)
6470
this.serviceProvider = serviceProvider;
6571
}
6672

67-
protected override void Initialize()
73+
public static void InitializeAssemblyResolver()
6874
{
75+
if (resolverInitialized)
76+
return;
6977
AppDomain.CurrentDomain.AssemblyResolve += LoadAssemblyFromRunDir;
78+
resolverInitialized = true;
79+
}
7080

81+
protected override void Initialize()
82+
{
7183
base.Initialize();
7284
IncrementLaunchCount();
7385

src/common/SharedDictionaryManager.cs renamed to src/GitHub.VisualStudio/Helpers/SharedDictionaryManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace GitHub.VisualStudio.Helpers
66
{
77
public class SharedDictionaryManager : ResourceDictionary
88
{
9+
static SharedDictionaryManager()
10+
{
11+
GitHubPackage.InitializeAssemblyResolver();
12+
}
13+
914
static readonly Dictionary<Uri, ResourceDictionary> resourceDicts = new Dictionary<Uri, ResourceDictionary>();
1015

1116
Uri sourceUri;

0 commit comments

Comments
 (0)