Skip to content

Conversation

@janvorli
Copy link
Member

@janvorli janvorli commented Dec 8, 2025

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.

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.
@janvorli janvorli added this to the 11.0.0 milestone Dec 8, 2025
@janvorli janvorli requested a review from jkotas December 8, 2025 20:42
@janvorli janvorli self-assigned this Dec 8, 2025
Copilot AI review requested due to automatic review settings December 8, 2025 20:42
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a 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_Interpreter and DOTNET_InterpMode)
  • Introduces SupportsDirtyAccessViolations platform detection property that returns false for 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants