From 6adf982abfde31f4af7300509da9c60b168e8b35 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 16 Nov 2024 13:10:52 +0000 Subject: [PATCH 1/2] Update dependencies from https://github.com/dotnet/razor build 20241115.5 Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal , Microsoft.CodeAnalysis.Razor.Tooling.Internal , Microsoft.NET.Sdk.Razor.SourceGenerators.Transport From Version 7.0.0-preview.24523.2 -> To Version 7.0.0-preview.24565.5 --- eng/Version.Details.xml | 12 ++++++------ eng/Versions.props | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4f04e67b499d..3e295bcb47e2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -293,18 +293,18 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore 47576478939fdd59b4400ad135f47938af486ab3 - + https://github.com/dotnet/razor - 5161ec13b0ed670b69f3fe5b2c57f239ce63c28e + aa2c76f75e60f3f6ae500bbf0eae9eb11af0bd4f - + https://github.com/dotnet/razor - 5161ec13b0ed670b69f3fe5b2c57f239ce63c28e + aa2c76f75e60f3f6ae500bbf0eae9eb11af0bd4f - + https://github.com/dotnet/razor - 5161ec13b0ed670b69f3fe5b2c57f239ce63c28e + aa2c76f75e60f3f6ae500bbf0eae9eb11af0bd4f https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore diff --git a/eng/Versions.props b/eng/Versions.props index b28b422ab861..0cf5a7f16dab 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -179,9 +179,9 @@ - 7.0.0-preview.24523.2 - 7.0.0-preview.24523.2 - 7.0.0-preview.24523.2 + 7.0.0-preview.24565.5 + 7.0.0-preview.24565.5 + 7.0.0-preview.24565.5 From 7fb5f08818a6c3be29573dcf3054dabfb7a40f69 Mon Sep 17 00:00:00 2001 From: Jacques Eloff Date: Tue, 19 Nov 2024 08:46:52 -0800 Subject: [PATCH 2/2] Add COM workaround --- .../list/VisualStudioWorkloads.cs | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs b/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs index fe7415bdac98..d172e76751ba 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/list/VisualStudioWorkloads.cs @@ -20,6 +20,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); /// @@ -158,44 +160,50 @@ internal static void WriteSDKInstallRecordsForVSWorkloads(IInstaller workloadIns /// 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; } } }