Skip to content

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

Merged
rolfbjarne merged 2 commits intodotnet:release/6.0.3xxfrom
vs-mobiletools-engineering-service2:backport-pr-15358-to-release/6.0.3xx
Jul 14, 2022
Merged

[release/6.0.3xx] [CoreCLR] Avoid having any internal calls in managed code for CoreCLR. Fixes #15343.#15457
rolfbjarne merged 2 commits intodotnet:release/6.0.3xxfrom
vs-mobiletools-engineering-service2:backport-pr-15358-to-release/6.0.3xx

Conversation

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
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

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

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

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1101.Monterey'
Hash: aa068a93a21a49ca384c1f9ce032dc25af8dcfeb

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
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: aa068a93a21a49ca384c1f9ce032dc25af8dcfeb

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

📋 [PR Build] API Diff 📋

API Current PR diff

✅ API Diff (from PR only) (no change)

View API diff
View dotnet API diff
View dotnet legacy API diff
View dotnet iOS-MacCatalayst API diff

API diff

✅ API Diff from stable

View API diff
View dotnet API diff
View dotnet legacy API diff
View dotnet iOS-MacCatalayst API diff

Generator diff

Generator Diff (no change)

Pipeline on Agent XAMBOT-1096.Monterey'
Hash: aa068a93a21a49ca384c1f9ce032dc25af8dcfeb

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

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

Failed tests are:

  • xammac_tests
  • monotouch-test

Pipeline on Agent
Hash: aa068a93a21a49ca384c1f9ce032dc25af8dcfeb

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

✅ [CI Build] Tests passed on VSTS: simulator tests iOS. ✅

Tests passed on VSTS: simulator tests iOS.

🎉 All 148 tests passed 🎉

Pipeline on Agent XAMBOT-1042.Monterey'
Merge aa068a9 into 478b59e

@rolfbjarne rolfbjarne merged commit 6f1fd63 into dotnet:release/6.0.3xx 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.

3 participants