dotnet / dotnet/winforms

`RuntimeInformation.ProcessArchitecture` returns X64 architecture for Arm64 tests

Open
#7,013 5 comments 0 reactions 0 assignees View on GitHub
area-Infrastructure-CI
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### .NET version

7.0

### Did it work in .NET Framework?

No

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

_No response_

### Issue description

Tests are run for x86, x64 and arm64 architectures. Some tests could be flaky on a specific architecture, so we introduced an attribute to skip a test when run on a certain architecture (https://github.com/dotnet/winforms/pull/6599). The attribute uses the `System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture` property to determine the architecture. However, this property returns `Architecture.X64` for arm64 tests, which makes skipping tests for arm64 not working as expected.

For example, while `DataGridViewTests.DataGridView_ColumnHeadersHeight_SetWithHandle_GetReturnsExpected` has following attribute:
```
[ConditionalWinFormsTheory(UnsupportedArchitecture = Architecture.Arm64,
Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/6597")]
```
it is still executed on arm64:
![image](https://user-images.githubusercontent.com/102954094/163205970-c8476ec9-21cf-4dc9-84e4-10c421321fca.png)

### Steps to reproduce

1. Add Arm64 as an unsupported architecture on a unit test.
2. Search for the test in CI pipeline test results.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.