Skip to content

Commit

Permalink
Merge pull request #7415 from rainersigwald/revert-alc-looseness
Browse files Browse the repository at this point in the history
  • Loading branch information
baronfel authored Feb 24, 2022
2 parents ae57d10 + 7d901eb commit 61e9e28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
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.1.0</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<VersionPrefix>17.1.1</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<DotNetUseShippingVersions>true</DotNetUseShippingVersions>
Expand Down
6 changes: 4 additions & 2 deletions src/Shared/CoreCLRAssemblyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ private Assembly TryResolveAssemblyFromPaths(AssemblyLoadContext context, Assemb
}

AssemblyName candidateAssemblyName = AssemblyLoadContext.GetAssemblyName(candidatePath);
if (candidateAssemblyName.Version >= assemblyName.Version)
if (candidateAssemblyName.Version != assemblyName.Version)
{
return LoadAndCache(context, candidatePath);
continue;
}

return LoadAndCache(context, candidatePath);
}
}

Expand Down
24 changes: 13 additions & 11 deletions src/Shared/MSBuildLoadContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,22 @@ public MSBuildLoadContext(string assemblyPath)
// bare search directory if that fails.
: new[] { assemblyName.CultureName, string.Empty })
{
var candidatePath = Path.Combine(_directory,
cultureSubfolder,
$"{assemblyName.Name}.dll");
var candidatePath = Path.Combine(_directory,
cultureSubfolder,
$"{assemblyName.Name}.dll");

if (!FileSystems.Default.FileExists(candidatePath))
{
continue;
}
if (!FileSystems.Default.FileExists(candidatePath))
{
continue;
}

AssemblyName candidateAssemblyName = AssemblyLoadContext.GetAssemblyName(candidatePath);
if (candidateAssemblyName.Version != assemblyName.Version)
{
continue;
}

AssemblyName candidateAssemblyName = AssemblyLoadContext.GetAssemblyName(candidatePath);
if (candidateAssemblyName.Version >= assemblyName.Version)
{
return LoadFromAssemblyPath(candidatePath);
}
}

// If the Assembly is provided via a file path, the following rules are used to load the assembly:
Expand Down

0 comments on commit 61e9e28

Please sign in to comment.