ConditionalFact does not work from within VS
- Dominant language
- C#
- Stars
- 729
- Forks
- 397
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 149
Description
- [ ] This issue is blocking
- [x] This issue is causing unreasonable pain
`ConditionalFact` attributes are not working when tests are run inside VS 2022 - instead these tests are simply always run.
This was discovered [here](https://github.com/dotnet/winforms/discussions/5716) 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:
```csharp
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)
Contributor guide
Assessment
This issue has not been assessed yet.