ConditionalFact attributes are not working when tests are run inside VS 2022 - instead these tests are simply always run.
This was discovered here on the winforms repo, where tests that shouldn't be running were reported as failing.
Its unclear whether this is a VS 2022 issue or if the implementation of ConditionalFact needs to be updated to work under VS 2022
Example repro:
public class MachineSpecificTests
{
public static bool Is32Bit => IntPtr.Size == 4;
public static bool Is64Bit => IntPtr.Size == 8;
[ConditionalFact(nameof(Is32Bit))]
public void TestIntPtrSize32()
{
Assert.Equal(4, IntPtr.Size);
}
[ConditionalFact(nameof(Is64Bit))]
public void TestIntPtrSize64()
{
Assert.Equal(8, IntPtr.Size);
}
}
(The actual tests WinForms uses are here: https://github.com/dotnet/winforms/blob/main/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/PARAMTests.cs)
ConditionalFactattributes are not working when tests are run inside VS 2022 - instead these tests are simply always run.This was discovered here on the winforms repo, where tests that shouldn't be running were reported as failing.
Its unclear whether this is a VS 2022 issue or if the implementation of
ConditionalFactneeds to be updated to work under VS 2022Example repro:
(The actual tests WinForms uses are here: https://github.com/dotnet/winforms/blob/main/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/PARAMTests.cs)