Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0.1xx] Update dependencies from dotnet/razor #45074

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,16 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore</Uri>
<Sha>47576478939fdd59b4400ad135f47938af486ab3</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Razor.Tooling.Internal" Version="7.0.0-preview.24565.13">
<Dependency Name="Microsoft.CodeAnalysis.Razor.Tooling.Internal" Version="7.0.0-preview.24574.1">
<Uri>https://github.com/dotnet/razor</Uri>
<Sha>0d10fb38d28484fc4189a5441d258d60c3cf2ca3</Sha>
<SourceBuild RepoName="razor" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal" Version="7.0.0-preview.24565.13">
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal" Version="7.0.0-preview.24574.1">
<Uri>https://github.com/dotnet/razor</Uri>
<Sha>0d10fb38d28484fc4189a5441d258d60c3cf2ca3</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.Razor.SourceGenerators.Transport" Version="7.0.0-preview.24565.13">
<Dependency Name="Microsoft.NET.Sdk.Razor.SourceGenerators.Transport" Version="7.0.0-preview.24574.1">
<Uri>https://github.com/dotnet/razor</Uri>
<Sha>0d10fb38d28484fc4189a5441d258d60c3cf2ca3</Sha>
</Dependency>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@
</PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/razor -->
<PropertyGroup>
<MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>7.0.0-preview.24565.13</MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>
<MicrosoftCodeAnalysisRazorToolingInternalVersion>7.0.0-preview.24565.13</MicrosoftCodeAnalysisRazorToolingInternalVersion>
<MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>7.0.0-preview.24565.13</MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>
<MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>7.0.0-preview.24574.1</MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>
<MicrosoftCodeAnalysisRazorToolingInternalVersion>7.0.0-preview.24574.1</MicrosoftCodeAnalysisRazorToolingInternalVersion>
<MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>7.0.0-preview.24574.1</MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/wpf -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/// <summary>
Expand Down Expand Up @@ -125,44 +127,50 @@ internal static void GetInstalledWorkloads(IWorkloadResolver workloadResolver,
/// <returns>A list of Visual Studio instances.</returns>
private static List<ISetupInstance> GetVisualStudioInstances()
{
List<ISetupInstance> 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<ISetupInstance> 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;
}
}
}