Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Dispose AssemblyInformation in GetAssembliesMetadata (#9974)
Fixes AB#2017198 by releasing the handle to the file by disposing the AssemblyInformation deterministically.
  • Loading branch information
YuliiaKovalova authored Apr 10, 2024
commit a2d3b9567792eb983c806c6a5e8d16089a95080f
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>
<PropertyGroup>
<VersionPrefix>17.10.0</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<VersionPrefix>17.10.1</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<PackageValidationBaselineVersion>17.8.3</PackageValidationBaselineVersion>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
Expand Down
12 changes: 7 additions & 5 deletions src/Tasks/GetAssembliesMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ public override bool Execute()
// During DTB the referenced project may not has been built yet, so we need to check if the assembly already exists.
if (File.Exists(assemblyPath))
{
AssemblyInformation assemblyInformation = new(assemblyPath);
AssemblyAttributes attributes = assemblyInformation.GetAssemblyMetadata();

if (attributes != null)
using (AssemblyInformation assemblyInformation = new(assemblyPath))
{
assembliesMetadata.Add(CreateItemWithMetadata(attributes));
AssemblyAttributes attributes = assemblyInformation.GetAssemblyMetadata();

if (attributes != null)
{
assembliesMetadata.Add(CreateItemWithMetadata(attributes));
}
}
}
}
Expand Down