Why does the following test hang indefinitely when I run it, but when I debug it, it works perfectly?
[Fact]
public async Task WhyDoesThis_Test_AlwaysHang()
{
var foo = Console.IsInputRedirected ? await Console.In.ReadToEndAsync() : string.Empty;
foo.Should().BeEmpty();
}
The actual test executes a library method, but I simplified it for the question as both behave similarly. I am using Rider's default test runner and .NET 8.
The console input is clearly not redirected, so I would expect the test to work without issue, or at least hang in both debug and run modes.