Skip to content

Conversation

@MiroBrodlovaUnityGit
Copy link

@MiroBrodlovaUnityGit MiroBrodlovaUnityGit commented Nov 25, 2025

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 Mono to using CoreCLR.
  • With this we need to replace all Mono API calls with CoreCLR-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 Mono API calls across all Unity supported packages with CoreCLR-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!

…blies()

- LinkFileGenerator.cs: Add conditional compilation (line 43)
- Added using UnityEngine.Assemblies with conditional directive
- Maintains backward compatibility with older Unity versions
@unity-cla-assistant
Copy link

unity-cla-assistant commented Nov 25, 2025

CLA assistant check
All committers have signed the CLA.

…ible APIs

Add conditional compilation to replace AppDomain.CurrentDomain.GetAssemblies()
with CurrentAssemblies.GetLoadedAssemblies() in:
- InputManager.cs
- InputParameterEditor.cs
- CoreTests_Controls.cs
- InputTestFixture.cs

Maintains backward compatibility with Unity versions prior to 6000.5.
@MiroBrodlovaUnityGit MiroBrodlovaUnityGit marked this pull request as ready for review December 2, 2025 14:21
@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Dec 2, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

SCP-1555 - Fully compliant

Compliant requirements:

  • Replaced AppDomain.CurrentDomain.GetAssemblies() with CurrentAssemblies.GetLoadedAssemblies() in InputManager.cs, LinkFileGenerator.cs, InputParameterEditor.cs, and test files.
  • Implemented conditional compilation (#if UNITY_6000_5_OR_NEWER) to ensure the package remains compatible with older Unity versions while using the new API on newer versions.
⏱️ 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
  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Dec 2, 2025

PR Code Suggestions ✨

No code suggestions found for the PR.

@codecov-github-com
Copy link

codecov-github-com bot commented Dec 2, 2025

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 ⚠️
@@             Coverage Diff             @@
##           develop    #2289      +/-   ##
===========================================
- Coverage    77.95%   77.07%   -0.89%     
===========================================
  Files          477      477              
  Lines        97416    90097    -7319     
===========================================
- Hits         75943    69442    -6501     
+ Misses       21473    20655     -818     
Flag Coverage Δ
inputsystem_MacOS_2022.3 5.54% <ø> (-0.01%) ⬇️
inputsystem_MacOS_2022.3_project 75.49% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.0 5.32% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.0_project 77.41% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.2 5.32% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.2_project 77.41% <ø> (+<0.01%) ⬆️
inputsystem_MacOS_6000.3 5.32% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.3_project 77.40% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.4 5.33% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.4_project 77.41% <ø> (-0.01%) ⬇️
inputsystem_MacOS_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.5_project 77.41% <80.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_2022.3 5.54% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_2022.3_project 75.29% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0 5.32% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.21% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.2 5.32% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.2_project 77.21% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3 5.32% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.21% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4 5.33% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4_project 77.22% <ø> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.5_project 77.22% <80.00%> (-0.01%) ⬇️
inputsystem_Windows_2022.3 5.54% <ø> (-0.01%) ⬇️
inputsystem_Windows_2022.3_project 75.62% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.0 5.32% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.0_project 77.53% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.2 5.32% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.2_project 77.53% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.3 5.32% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.3_project 77.53% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.4 5.33% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.4_project 77.54% <ø> (-0.01%) ⬇️
inputsystem_Windows_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.5_project 77.54% <80.00%> (-0.01%) ⬇️

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%) ⬇️
...tsystem/InputSystem/Editor/InputParameterEditor.cs 16.77% <100.00%> (+0.18%) ⬆️
.../com.unity.inputsystem/InputSystem/InputManager.cs 90.57% <100.00%> (-1.21%) ⬇️
....inputsystem/Tests/TestFixture/InputTestFixture.cs 78.57% <100.00%> (+2.28%) ⬆️
...utSystem/Editor/BuildPipeline/LinkFileGenerator.cs 0.00% <0.00%> (ø)

... and 51 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MiroBrodlovaUnityGit MiroBrodlovaUnityGit changed the title Migrate Mono APIs to CoreCLR-compatible APIs FIX: Migrate Mono APIs to CoreCLR-compatible APIs Dec 4, 2025
@MiroBrodlovaUnityGit
Copy link
Author

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! :)

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. Looks good.

@ekcoh
Copy link
Collaborator

ekcoh commented Dec 5, 2025

@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.

@jfreire-unity
Copy link
Collaborator

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

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tried running a couple of samples on 22.3 (mono player/playmode) and latest trunk (mono only player/playmode), did not notice any issues. I wasn't able to build the coreclr version editor on trunk though, kept erroring out. If there's a specific way I need to do it or I need a specific revision then let me know on slack and I'll check that one as well

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants