The following test will hang the test runner:
[Fact]
public void BlahTest()
{
Blah();
}
public async void Blah()
{
return;
}
This is breaking one of my test cases where I need to return early from an async method.
I am using Xamarin and it happens in both Xamarin Mac and Xamarin iOS projects.
I can understand how this is happening (it's our support for async void test methods that's likely to blame here).
Can I ask how you intend to test a method whose behavior you cannot fully observe?
Even if you're not trying to directly test the method in question, I could see this causing problems when trying to create integration tests that may happen to have an async void method with a return in it. It would still cause the runner to hang even if you don't care about the result of the method.
At the moment, I don't know of a workaround.
We could add an option to the runners which turns off support for async void test methods to stop this issue, but no such support exists today. :frowning:
Closed for age.
Most helpful comment
Even if you're not trying to directly test the method in question, I could see this causing problems when trying to create integration tests that may happen to have an async void method with a return in it. It would still cause the runner to hang even if you don't care about the result of the method.