diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 4557a2acce6f..8158ccda00d1 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -293,16 +293,16 @@
https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore
47576478939fdd59b4400ad135f47938af486ab3
-
+
https://github.com/dotnet/razor
0d10fb38d28484fc4189a5441d258d60c3cf2ca3
-
+
https://github.com/dotnet/razor
0d10fb38d28484fc4189a5441d258d60c3cf2ca3
-
+
https://github.com/dotnet/razor
0d10fb38d28484fc4189a5441d258d60c3cf2ca3
diff --git a/eng/Versions.props b/eng/Versions.props
index 9261bf31ac8e..573ba51b6357 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -175,9 +175,9 @@
- 7.0.0-preview.24565.13
- 7.0.0-preview.24565.13
- 7.0.0-preview.24565.13
+ 7.0.0-preview.24574.1
+ 7.0.0-preview.24574.1
+ 7.0.0-preview.24574.1
diff --git a/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs b/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs
index e50d2d345d34..67077b41383e 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs
@@ -17,6 +17,8 @@ namespace Microsoft.DotNet.Workloads.Workload
#endif
internal static class VisualStudioWorkloads
{
+ private static readonly object s_guard = new();
+
private const int REGDB_E_CLASSNOTREG = unchecked((int)0x80040154);
///
@@ -125,44 +127,50 @@ internal static void GetInstalledWorkloads(IWorkloadResolver workloadResolver,
/// A list of Visual Studio instances.
private static List GetVisualStudioInstances()
{
- List vsInstances = new();
-
- try
+ // The underlying COM API has a bug where-by it's not safe for concurrent calls. Until their
+ // bug fix is rolled out use a lock to ensure we don't concurrently access this API.
+ // https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2241752/
+ lock (s_guard)
{
- SetupConfiguration setupConfiguration = new();
- ISetupConfiguration2 setupConfiguration2 = setupConfiguration;
- IEnumSetupInstances setupInstances = setupConfiguration2.EnumInstances();
- ISetupInstance[] instances = new ISetupInstance[1];
- int fetched = 0;
+ List vsInstances = new();
- do
+ try
{
- setupInstances.Next(1, instances, out fetched);
+ SetupConfiguration setupConfiguration = new();
+ ISetupConfiguration2 setupConfiguration2 = setupConfiguration;
+ IEnumSetupInstances setupInstances = setupConfiguration2.EnumInstances();
+ ISetupInstance[] instances = new ISetupInstance[1];
+ int fetched = 0;
- if (fetched > 0)
+ do
{
- ISetupInstance2 instance = (ISetupInstance2)instances[0];
+ setupInstances.Next(1, instances, out fetched);
- // .NET Workloads only shipped in 17.0 and later and we should only look at IDE based SKUs
- // such as community, professional, and enterprise.
- if (Version.TryParse(instance.GetInstallationVersion(), out Version version) &&
- version.Major >= 17 &&
- s_visualStudioProducts.Contains(instance.GetProduct().GetId()))
+ if (fetched > 0)
{
- vsInstances.Add(instances[0]);
+ ISetupInstance2 instance = (ISetupInstance2)instances[0];
+
+ // .NET Workloads only shipped in 17.0 and later and we should only look at IDE based SKUs
+ // such as community, professional, and enterprise.
+ if (Version.TryParse(instance.GetInstallationVersion(), out Version version) &&
+ version.Major >= 17 &&
+ s_visualStudioProducts.Contains(instance.GetProduct().GetId()))
+ {
+ vsInstances.Add(instances[0]);
+ }
}
}
+ while (fetched > 0);
+
+ }
+ catch (COMException e) when (e.ErrorCode == REGDB_E_CLASSNOTREG)
+ {
+ // Query API not registered, good indication there are no VS installations of 15.0 or later.
+ // Other exceptions are passed through since that likely points to a real error.
}
- while (fetched > 0);
+ return vsInstances;
}
- catch (COMException e) when (e.ErrorCode == REGDB_E_CLASSNOTREG)
- {
- // Query API not registered, good indication there are no VS installations of 15.0 or later.
- // Other exceptions are passed through since that likely points to a real error.
- }
-
- return vsInstances;
}
}
}