Skip to content

Commit aa9d767

Browse files
committed
use built-in registration check
1 parent b837087 commit aa9d767

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Microsoft.ComponentDetection.Detectors/nuget/NuGetMSBuildBinaryLogComponentDetector.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public class NuGetMSBuildBinaryLogComponentDetector : FileComponentDetector
3939
};
4040

4141
private static readonly object MSBuildRegistrationGate = new();
42-
private static bool isMSBuildRegistered;
4342

4443
public NuGetMSBuildBinaryLogComponentDetector(
4544
IObservableDirectoryWalkerFactory walkerFactory,
@@ -166,12 +165,11 @@ internal static void EnsureMSBuildIsRegistered()
166165
{
167166
lock (MSBuildRegistrationGate)
168167
{
169-
if (!isMSBuildRegistered)
168+
if (!MSBuildLocator.IsRegistered)
170169
{
171170
// this must happen once per process, and never again
172171
var defaultInstance = MSBuildLocator.QueryVisualStudioInstances().First();
173172
MSBuildLocator.RegisterInstance(defaultInstance);
174-
isMSBuildRegistered = true;
175173
}
176174
}
177175
}

0 commit comments

Comments
 (0)