-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Disable bad address writing interop tests with interpreter #122308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable bad address writing interop tests with interpreter #122308
Conversation
This change disables all libraries interop tests that try to check that access to non-null invalid address throws access violation or null reference exception when executed using the interpreter. I've introduced a new `PlatformDetection.SupportsDirtyAccessViolations` for this purpose that is set for coreclr interpreter and for Mono and WASM too. So I have also removed the pre-existing attribute on these tests that was disabling them on Mono.
|
Tagging subscribers to this area: @dotnet/interop-contrib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR disables interop tests that verify access violations are thrown for invalid memory addresses when running under interpreters (CoreCLR interpreter, Mono, or WebAssembly). The change introduces a new PlatformDetection.SupportsDirtyAccessViolations property and replaces [SkipOnMono] attributes with runtime conditional checks.
- Adds detection for CoreCLR interpreter mode via environment variables (
DOTNET_InterpreterandDOTNET_InterpMode) - Introduces
SupportsDirtyAccessViolationsplatform detection property that returnsfalsefor Mono, CoreCLR interpreter, and WASM - Updates test methods to conditionally execute second assertion (with offset parameter) based on the new property
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs | Adds IsCoreClrInterpreter detection logic and SupportsDirtyAccessViolations property to identify platforms that properly throw access violations for invalid memory accesses |
| src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReadWrite/IntPtrTests.cs | Removes [SkipOnMono] attributes and wraps offset-based zero pointer tests in runtime condition checks |
| src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReadWrite/Int64Tests.cs | Removes [SkipOnMono] attributes and wraps offset-based zero pointer tests in runtime condition checks; removes trailing blank lines |
| src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReadWrite/Int32Tests.cs | Removes [SkipOnMono] attributes and wraps offset-based zero pointer tests in runtime condition checks; removes trailing blank lines |
| src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReadWrite/Int16Tests.cs | Removes [SkipOnMono] attributes and wraps offset-based zero pointer tests in runtime condition checks; removes trailing blank lines |
| src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReadWrite/ByteTests.cs | Removes [SkipOnMono] attributes and wraps offset-based zero pointer tests in runtime condition checks; removes trailing blank lines |
This change disables all libraries interop tests that try to check that access to non-null invalid address throws access violation or null reference exception when executed using the interpreter.
I've introduced a new
PlatformDetection.SupportsDirtyAccessViolationsfor this purpose that is set for coreclr interpreter and for Mono and WASM too. So I have also removed the pre-existing attribute on these tests that was disabling them on Mono.