FIX: Migrate Mono APIs to CoreCLR-compatible APIs
Purpose of this PR
This PR replaces all instances of analyzer-highlighted Mono API calls with CoreCLR-compatible API calls in com.unity.collections, and is part of Epic SCP-1555.
JIRA: https://jira.unity3d.com/browse/SCP-1555
Further Context
- Unity is steadily moving away from
Monoto usingCoreCLR. - With this we need to replace all
MonoAPI calls withCoreCLR-compatible ones. (here's the list of APIs being replaced, and here's the list of packages that will get updated). - Epic SCP-1555 tracks the work of replacing all
MonoAPI calls across all Unity supported packages withCoreCLR-compatible ones. - For more information, or if you have any questions, please visit #code-reload-safe-api-packages-migration and we'll be happy to help. 🙂
Note: More PRs dealing with SCP-1555 may come in the future. In some cases we cannot replace all Mono API calls with CoreCLR API calls yet, as some CoreCLR APIs are still being worked on/are not yet public. In these cases we suppress warnings for those particular APIs for now.
Release Notes
None
Functional Testing status
Running the default job-suite that is run on new PRs. Please do share if there's some steps I've missed that I must do to properly setup the PR and run your CI jobs!
Performance Testing Status
Haven't run any additional performance-tests as this PR should just replace Mono API with equivalent CoreCLR API
Overall Product Risks
Low risk as it just changes Mono API to equivalent CoreCLR API
Comments to Reviewers
If there are any jobs/tests we should run to make sure there are no ripple effects do share and we will kick them off! :) And, if you know of any locations we may have missed updating or any details that we should know about, please do share!
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
|
🎫 Ticket compliance analysis ✅ SCP-1555 - Fully compliant Compliant requirements:
|
| ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪ The PR consists of a repetitive and mechanical replacement of a specific API call with a conditional alternative across multiple files, without introducing complex logic. |
| 🏅 Score: 95 The changes are clean, effectively address the ticket requirements, and correctly use preprocessor directives to maintain backward compatibility. |
| 🧪 PR contains tests |
| 🔒 No security concerns identified |
| ⚡ No major issues detected |
|
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent
PR Code Suggestions ✨
No code suggestions found for the PR.
Codecov Report
Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...utSystem/Editor/BuildPipeline/LinkFileGenerator.cs | 0.00% | 1 Missing :warning: |
@@ Coverage Diff @@
## develop #2289 +/- ##
===========================================
- Coverage 77.95% 77.06% -0.89%
===========================================
Files 477 476 -1
Lines 97419 90115 -7304
===========================================
- Hits 75943 69451 -6492
+ Misses 21476 20664 -812
| Flag | Coverage Δ | |
|---|---|---|
| inputsystem_MacOS_2022.3 | 5.54% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_2022.3_project | 75.47% <ø> (-0.03%) |
:arrow_down: |
| inputsystem_MacOS_6000.0 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.0_project | 77.36% <ø> (-0.06%) |
:arrow_down: |
| inputsystem_MacOS_6000.2 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.2_project | 77.36% <ø> (-0.06%) |
:arrow_down: |
| inputsystem_MacOS_6000.3 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.3_project | 77.36% <ø> (-0.06%) |
:arrow_down: |
| inputsystem_MacOS_6000.4 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.4_project | 77.36% <ø> (+<0.01%) |
:arrow_up: |
| inputsystem_MacOS_6000.5 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.5_project | 77.36% <80.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_2022.3 | 5.54% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_2022.3_project | 75.26% <ø> (-0.03%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.0 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.0_project | 77.17% <ø> (-0.05%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.2 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.2_project | 77.16% <ø> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.3 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.3_project | 77.16% <ø> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.4 | 5.33% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.4_project | 77.17% <ø> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.5 | 5.33% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.5_project | 77.17% <80.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Windows_2022.3 | 5.54% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_2022.3_project | 75.60% <ø> (-0.03%) |
:arrow_down: |
| inputsystem_Windows_6000.0 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.0_project | 77.49% <ø> (-0.05%) |
:arrow_down: |
| inputsystem_Windows_6000.2 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.2_project | 77.49% <ø> (-0.05%) |
:arrow_down: |
| inputsystem_Windows_6000.3 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.3_project | 77.49% <ø> (-0.05%) |
:arrow_down: |
| inputsystem_Windows_6000.4 | 5.32% <ø> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.4_project | 77.49% <ø> (-0.05%) |
:arrow_down: |
| inputsystem_Windows_6000.5 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.5_project | 77.49% <80.00%> (-0.05%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| Assets/Tests/InputSystem/CoreTests_Controls.cs | 99.39% <100.00%> (-0.42%) |
:arrow_down: |
| ...tsystem/InputSystem/Editor/InputParameterEditor.cs | 16.77% <100.00%> (+0.18%) |
:arrow_up: |
| .../com.unity.inputsystem/InputSystem/InputManager.cs | 90.57% <100.00%> (-1.21%) |
:arrow_down: |
| ....inputsystem/Tests/TestFixture/InputTestFixture.cs | 78.57% <100.00%> (+2.28%) |
:arrow_up: |
| ...utSystem/Editor/BuildPipeline/LinkFileGenerator.cs | 0.00% <0.00%> (ø) |
... and 55 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Just double checking if there's anything I should do/run/add for this to become merge:able? :)
I also see several jobs failing, but my suspicion it's not related to these changes maybe? I checked the history of some of the failing jobs on other branches and seems they were failing on other branches too not too long ago? But maybe I'm misunderstanding!
Appreciate any input and help! :)
@MiroBrodlovaUnityGit I think CI failure was unrelated, I started a rerun. Also @jfreire-unity added our QA @Pauliusd01 to the PR in case he would like to check something. Otherwise I think this can land, so feel free to merge @Pauliusd01 once you have approved.
There was some CI issues that were fixed and I updated this PR with latest develop branch changes.
Also, I just want to make sure if @Pauliusd01 spots something we didn't. Otherwise looks good to be merged
Thanks all for your help on this/reviewing and checking it so thoroughly! :)
I wasn't able to build the coreclr version editor on trunk though, kept erroring out.
Hoping this turned out OK! Let me know if there's anything I should/could do :)