Skip to content

AppDomain System.Runtime.Extensions.Tests Fails with not Provided Filename Error when TestReadyToRun is Enabled #96727

Open
@ivdiazsa

Description

@ivdiazsa

Description

When building and running System.Runtime.Extensions.Tests with TestReadyToRun=true, the test run will crash and fail with an error about a filename that was not provided.

Reproduction Steps

  1. Clone the repo and build the clr and libs subsets. Make sure you specify TestReadyToRun, so that some necessary pretest components get built.
git clone https://github.com/dotnet/runtime
cd runtime
./build.sh --subset clr+libs --configuration Release -p:TestReadyToRun=true
  1. If PR Add ActiveIssue Annotations to Failing TestReadyToRun Tests and Reenable the Executables #96721 has been merged when investigating this issue, then first reenable the test by removing its ActiveIssue annotation in src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/AppDomainTests.cs:
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasHostExecutable))]
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "The dotnet sdk will not be available on these platforms")]
// Comment this one out --> [ActiveIssue("https://github.com/dotnet/runtime/issues/96727", typeof(PlatformDetection), nameof(PlatformDetection.IsReadyToRunCompiled))]
public void TargetFrameworkTest()
{
    const int ExpectedExitCode = 0;
    const string AppName = "TargetFrameworkNameTestApp.dll";
    var psi = new ProcessStartInfo();
    psi.FileName = RemoteExecutor.HostRunner;
    psi.Arguments = $"{AppName} {ExpectedExitCode}";

    using (Process p = Process.Start(psi))
    {
        p.WaitForExit();
        Assert.Equal(ExpectedExitCode, p.ExitCode);
    }
}
  1. Build and run the test
cd src/libraries/System.Threading.Thread/tests
/path/to/runtime/dotnet.sh build -c Release -t:Test -p:TestReadyToRun=true

Expected behavior

All tests pass, except the skipped ones.

Actual behavior

Test fails with the following error, making the whole run fail:

========================= Begin custom configuration settings ==============================
export __TestArchitecture=x64
export __IsXUnitLogCheckerSupported=1
========================== End custom configuration settings ===============================
----- start Tue Jan 9 03:18:18 PM PST 2024 =============== To repro directly: =====================================================
pushd /path/to/runtime/artifacts/bin/System.Runtime.Extensions.Tests/Release/net9.0-unix/publish
chmod +rwx System.Runtime.Extensions.Tests ^&^& ./System.Runtime.Extensions.Tests -notrait category=OuterLoop -notrait category=failing -xml testResults.xml 
popd
===========================================================================================================
/path/to/runtime/artifacts/bin/System.Runtime.Extensions.Tests/Release/net9.0-unix/publish /path/to/runtime/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests
Running assembly:System.Runtime.Extensions.Tests, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
[SKIP] System.Tests.AppDomainTests.SetThreadPrincipal
[SKIP] System.Tests.AppDomainTests.AssemblyLoad
[SKIP] System.Tests.AppDomainTests.AssemblyResolveInvalidAssemblyName
[SKIP] System.Tests.AppDomainTests.AssemblyResolve_IsNotCalledForCoreLibResources
[SKIP] System.Tests.AppDomainTests.ResourceResolve
[FAIL] System.Tests.AppDomainTests.TargetFrameworkTest
System.InvalidOperationException : Cannot start process because a file name has not been provided.
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at System.Tests.AppDomainTests.TargetFrameworkTest() in /path/to/runtime/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/AppDomainTests.cs:line 58
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Regression?

No

Known Workarounds

Keep the test disabled so that the other tests in the run can be executed unaffected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions