Skip to content
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

[release/6.0.4xx] [CoreCLR] Avoid having any internal calls in managed code for CoreCLR. Fixes #15343. #15458

Conversation

vs-mobiletools-engineering-service2
Copy link
Collaborator

CoreCLR does not like running into methods declared as internal calls:

[MethodImplAttribute (MethodImplOptions.InternalCall)]

and will fail with an error, even if the method is never executed, just encountered by the JIT:

ECall methods must be packaged into a system module

In the early days of .NET support we solved this by adding an indirection for
CoreCLR, where the internal call was hidden inside a managed call that would
never be executed at runtime. This seems to work fine in most cases, except
when the debugger attached, when I'm guessing the JIT is more aggressive, and
looks further ahead (and fails).

On the other hand, in the early days of .NET support on macOS the managed code
had to work for both Mono and CoreCLR without modification (since the same
implementation assembly would be picked by the build independent on the actual
runtime). This is no longer the case, since we only support CoreCLR on macOS
now, which allows us to put any Mono-specific managed code (such as the
internal call) in !macOS conditions.

Fixes #15343.

Backport of #15358

Fixes dotnet#15343.

CoreCLR does not like running into methods declared as internal calls:

    [MethodImplAttribute (MethodImplOptions.InternalCall)]

and will fail with an error, even if the method is never executed, just encountered by the JIT:

    ECall methods must be packaged into a system module

In the early days of .NET support we solved this by adding an indirection for
CoreCLR, where the internal call was hidden inside a managed call that would
never be executed at runtime. This seems to work fine in most cases, except
when the debugger attached, when I'm guessing the JIT is more aggressive, and
looks further ahead (and fails).

On the other hand, in the early days of .NET support on macOS the managed code
had to work for both Mono and CoreCLR without modification (since the same
implementation assembly would be picked by the build independent on the actual
runtime). This is no longer the case, since we only support CoreCLR on macOS
now, which allows us to put any Mono-specific managed code (such as the
internal call) in !macOS conditions.

Fixes dotnet#15343.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

🔥 [PR Build] Build failed 🔥

Build failed for the job 'Generate API diff'

Pipeline on Agent
Hash:

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1099.Monterey'
Hash: 5a56878c4365015273c0f46037097150c0751146

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌

Failed tests are:

  • monotouch-test

Pipeline on Agent
Hash: 5a56878c4365015273c0f46037097150c0751146

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: 5a56878c4365015273c0f46037097150c0751146

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

❌ [CI Build] Tests failed on VSTS: simulator tests iOS ❌

Tests failed on VSTS: simulator tests iOS.

Test results

1 tests failed, 147 tests passed.

Failed tests

  • monotouch-test/Mac [dotnet]/Debug (static registrar) [dotnet]: Failed (Test run crashed (exit code: 139).
    Test run crashed)

Pipeline on Agent XAMBOT-1037.Monterey'
Merge 5a56878 into 3d97b79

@rolfbjarne
Copy link
Member

Test failure is unrelated (https://github.com/xamarin/maccore/issues/2606).

@rolfbjarne rolfbjarne merged commit 3c5ccbe into dotnet:release/6.0.4xx Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants