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.4xx] Update dependencies from dotnet/razor #45088

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="9.0.0-preview.24565.7">
<Dependency Name="Microsoft.CodeAnalysis.Razor.Tooling.Internal" Version="9.0.0-preview.24574.4">
<Uri>https://github.com/dotnet/razor</Uri>
<Sha>b4ba32397a657a228890b10fd6cd84c9fa7035a8</Sha>
<SourceBuild RepoName="razor" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal" Version="9.0.0-preview.24565.7">
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal" Version="9.0.0-preview.24574.4">
<Uri>https://github.com/dotnet/razor</Uri>
<Sha>b4ba32397a657a228890b10fd6cd84c9fa7035a8</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.Razor.SourceGenerators.Transport" Version="9.0.0-preview.24565.7">
<Dependency Name="Microsoft.NET.Sdk.Razor.SourceGenerators.Transport" Version="9.0.0-preview.24574.4">
<Uri>https://github.com/dotnet/razor</Uri>
<Sha>b4ba32397a657a228890b10fd6cd84c9fa7035a8</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 @@ -179,9 +179,9 @@
</PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/razor -->
<PropertyGroup>
<MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>9.0.0-preview.24565.7</MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>
<MicrosoftCodeAnalysisRazorToolingInternalVersion>9.0.0-preview.24565.7</MicrosoftCodeAnalysisRazorToolingInternalVersion>
<MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>9.0.0-preview.24565.7</MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>
<MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>9.0.0-preview.24574.4</MicrosoftAspNetCoreMvcRazorExtensionsToolingInternalPackageVersion>
<MicrosoftCodeAnalysisRazorToolingInternalVersion>9.0.0-preview.24574.4</MicrosoftCodeAnalysisRazorToolingInternalVersion>
<MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>9.0.0-preview.24574.4</MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/wpf -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/// <summary>
Expand Down Expand Up @@ -164,44 +166,50 @@ internal static IEnumerable<WorkloadId> WriteSDKInstallRecordsForVSWorkloads(IIn
/// <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;
}
}
}