This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
src/System.Private.CoreLib/shared/System/Runtime/Loader Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -114,17 +114,15 @@ public bool Equals(ref ReadOnlySpan<char> entryName)
114114 if ( parentAssembly == null )
115115 return null ;
116116
117- AssemblyLoadContext ? parentAlc = GetLoadContext ( parentAssembly ) ;
118-
119- if ( parentAlc == null )
120- return null ;
117+ // ResolveSatelliteAssembly should always be called on the ALC which loaded parentAssembly
118+ Debug . Assert ( this == GetLoadContext ( parentAssembly ) ) ;
121119
122120 string parentDirectory = Path . GetDirectoryName ( parentAssembly . Location ) ! ;
123121
124122 string assemblyPath = $ "{ parentDirectory } /{ cultureName } /{ assemblyName . Name } .dll";
125123 if ( Internal . IO . File . InternalExists ( assemblyPath ) )
126124 {
127- return parentAlc . LoadFromAssemblyPath ( assemblyPath ) ;
125+ return LoadFromAssemblyPath ( assemblyPath ) ;
128126 }
129127 else if ( Path . IsCaseSensitive )
130128 {
@@ -134,7 +132,7 @@ public bool Equals(ref ReadOnlySpan<char> entryName)
134132 {
135133 assemblyPath = $ "{ parentDirectory } /{ caseInsensitiveCultureName } /{ assemblyName . Name } .dll";
136134 if ( Internal . IO . File . InternalExists ( assemblyPath ) )
137- return parentAlc . LoadFromAssemblyPath ( assemblyPath ) ;
135+ return LoadFromAssemblyPath ( assemblyPath ) ;
138136 }
139137 }
140138 return null ;
Original file line number Diff line number Diff line change @@ -27,17 +27,15 @@ public partial class AssemblyLoadContext
2727 if ( parentAssembly == null )
2828 return null ;
2929
30- AssemblyLoadContext ? parentAlc = GetLoadContext ( parentAssembly ) ;
31-
32- if ( parentAlc == null )
33- return null ;
30+ // ResolveSatelliteAssembly should always be called on the ALC which loaded parentAssembly
31+ Debug . Assert ( this == GetLoadContext ( parentAssembly ) ) ;
3432
3533 string parentDirectory = Path . GetDirectoryName ( parentAssembly . Location ) ! ;
3634
37- string assemblyPath = Path . Combine ( parentDirectory , dir , $ "{ assemblyName . Name } .dll") ;
35+ string assemblyPath = Path . Combine ( parentDirectory , cultureName , $ "{ assemblyName . Name } .dll") ;
3836 if ( Internal . IO . File . InternalExists ( assemblyPath ) )
3937 {
40- return parentAlc . LoadFromAssemblyPath ( assemblyPath ) ;
38+ return LoadFromAssemblyPath ( assemblyPath ) ;
4139 }
4240
4341 return null ;
You can’t perform that action at this time.
0 commit comments