diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs index afbf30a0ba4fa1..a244619b6b53c1 100644 --- a/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs +++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs @@ -89,6 +89,12 @@ protected TestApp UpdateAppConfigForTest(TestApp app, TestSetup setup, bool copy return app; } + // The fallback RID is a compile-time define for the host. On Windows, it is always win10 and on + // other platforms, it matches the build RID (non-portable for source-builds, portable otherwise) + private static string FallbackRid = OperatingSystem.IsWindows() + ? $"win10-{RepoDirectoriesProvider.Default.BuildArchitecture}" + : RepoDirectoriesProvider.Default.BuildRID; + protected const string UnknownRid = "unknown-rid"; private const string LinuxAssembly = "linux/LinuxAssembly.dll"; @@ -168,6 +174,18 @@ public void RidSpecificAssembly_CurrentRid(string rid, bool hasRuntimeFallbacks, excludedPath); } + [Fact] + public void RidSpecificAssembly_FallbackRid() + { + // When there is no RID graph and the host is configured to use the RID graph, it should still be able to + // resolve an exact match to the fallback RID + string assetPath = $"{FallbackRid}/{FallbackRid}Asset"; + RunTest( + p => p.WithAssemblyGroup(FallbackRid, g => g.WithAsset(assetPath)), + new TestSetup() { Rid = null, HasRidGraph = false, UseRidGraph = true }, + new ResolvedPaths() { IncludedAssemblyPaths = assetPath }); + } + [Theory] [InlineData(true)] [InlineData(false)] @@ -255,6 +273,18 @@ public void RidSpecificNativeLibrary_CurrentRid(string rid, bool hasRuntimeFallb excludedPath); } + [Fact] + public void RidSpecificNativeLibrary_FallbackRid() + { + // When there is no RID graph and the host is configured to use the RID graph, it should still be able to + // resolve an exact match to the fallback RID + string assetPath = $"{FallbackRid}/{FallbackRid}Asset"; + RunTest( + p => p.WithNativeLibraryGroup(FallbackRid, g => g.WithAsset(assetPath)), + new TestSetup() { Rid = null, HasRidGraph = false, UseRidGraph = true }, + new ResolvedPaths() { IncludedNativeLibraryPaths = $"{FallbackRid}/" }); + } + [Theory] [InlineData(true)] [InlineData(false)]