Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed Feb 28, 2025
1 parent 84f1769 commit a85fb2b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/tests/Loader/ExternalAssemblyProbe/ExternalAssemblyProbe.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Xunit;

public unsafe class ExternalAssemblyProbe
{
[Fact]
public static void ExternalAppAssemblies()
{
// In order to get to this point, the runtime must have been able to find the app assemblies
// Check that the TPA is indeed empty - that is, the runtime is not relying on that property.
string tpa = AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES") as string;
Assert.True(string.IsNullOrEmpty(tpa), "TRUSTED_PLATFORM_ASSEMBLIES should be empty");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Needed for CLRTestEnvironmentVariable -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<NativeAotIncompatible>true</NativeAotIncompatible>
<!-- External assembly probe via host-runtime contract is not implemented.
The test uses probing to start at all, so it needs to be disabled in the project, not via an attribute -->
<CLRTestTargetUnsupported Condition="'$(RuntimeFlavor)' != 'coreclr'">true</CLRTestTargetUnsupported>
</PropertyGroup>
<ItemGroup>
<Compile Include="ExternalAssemblyProbe.cs" />

<CLRTestEnvironmentVariable Include="APP_ASSEMBLIES" Value="EXTERNAL" />
</ItemGroup>
</Project>

0 comments on commit a85fb2b

Please sign in to comment.