Skip to content

Commit

Permalink
Only subscribe to AppDomain.AssemblyResolve once
Browse files Browse the repository at this point in the history
This is a port of dotnet/roslyn#53166. There's a
bigger question here about how to reuse this code better, but this
caused a bunch of confusion while debugging an issue.
  • Loading branch information
jasonmalinowski committed May 5, 2021
1 parent 469b8aa commit ac17711
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/OmniSharp.Host/Services/AnalyzerAssemblyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private Assembly LoadFromPathImpl(string originalPath)
string assemblyDirectory = CreateUniqueDirectoryForAssembly();
string shadowCopyPath = CopyFileAndResources(originalPath, assemblyDirectory);

if (Interlocked.CompareExchange(ref _hookedAssemblyResolve, 0, 1) == 0)
if (Interlocked.CompareExchange(ref _hookedAssemblyResolve, value: 1, comparand: 0) == 0)
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
Expand Down

0 comments on commit ac17711

Please # to comment.