Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private Assembly ResolveNullAssembly(AssemblyLoadContext sender, AssemblyName as
// Does not apply to Mono AOT scenarios as it is expected the name of the .aotdata file matches
// the true name of the assembly and not the physical file name.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT), nameof(PlatformDetection.HasAssemblyFiles))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))]
public void LoadInDefaultContext()
{
// This will attempt to load an assembly, by path, in the Default Load context via the Resolving event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@
CopyToOutputDirectory="PreserveNewest"
TargetPath="System.Runtime.Loader.Noop.Assembly_test.dll" />
</ItemGroup>

<Target Name="_PreserveNoopAssemblyFromTrimming" AfterTargets="ConfigureTrimming" Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true'">
<ItemGroup>
<ResolvedFileToPublish TrimMode="copy" Condition="'%(FileName)%(Extension)' == 'System.Runtime.Loader.Noop.Assembly_test.dll'" />
Comment thread
kotlarmilos marked this conversation as resolved.
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<assembly fullname="LoaderLinkTest.Dynamic" />
<assembly fullname="ReferencedClassLib" />
<assembly fullname="ReferencedClassLibNeutralIsSatellite" />
<assembly fullname="System.Runtime.Loader.Test.Assembly" />
<assembly fullname="System.Runtime.Loader.Test.Assembly2" />
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
OutputItemType="content"
CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

<Target Name="_PreserveNoopAssemblyFromTrimming" AfterTargets="ConfigureTrimming" Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true'">
<ItemGroup>
<ResolvedFileToPublish TrimMode="copy" Condition="'%(FileName)%(Extension)' == 'System.Runtime.Loader.Noop.Assembly.dll'" />
Comment thread
kotlarmilos marked this conversation as resolved.
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ protected override Assembly Load(AssemblyName assemblyName)

if (asmStream == null)
{
// On platforms where assemblies are deployed as files alongside the app
// (e.g., Apple mobile CoreCLR) rather than embedded resources, fall back
// to loading from the app directory.
Comment thread
kotlarmilos marked this conversation as resolved.
Comment thread
kotlarmilos marked this conversation as resolved.
string basePath = Path.Combine(AppContext.BaseDirectory, assembly);
if (File.Exists(basePath))
Comment thread
kotlarmilos marked this conversation as resolved.
{
if (LoadBy == LoadBy.Path)
{
var tempPath = Directory.CreateTempSubdirectory().FullName;
string path = Path.Combine(tempPath, assembly);
File.Copy(basePath, path);
return LoadFromAssemblyPath(path);
Comment thread
kotlarmilos marked this conversation as resolved.
Comment thread
kotlarmilos marked this conversation as resolved.
}
else if (LoadBy == LoadBy.Stream)
{
using (FileStream stream = File.OpenRead(basePath))
{
return LoadFromStream(stream);
}
}
}

return null;
}

Expand Down
1 change: 0 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@

<!-- https://github.com/dotnet/runtime/issues/124344 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Composition\tests\System.Composition.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime.Loader\tests\System.Runtime.Loader.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Diagnostics.StackTrace\tests\System.Diagnostics.StackTrace.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Xml\tests\System.Private.Xml.Tests.csproj" />

Expand Down
Loading