Repository navigation
fix: resolve core library types in IL post-processing under .NET reference assemblies - #4188
Draft
BrianUnity wants to merge 1 commit into
Draft
BrianUnity wants to merge 1 commit into
BrianUnity wants to merge 1 commit into
Conversation
…rence assemblies PostProcessorReflectionImporter mapped System.Private.CoreLib types only to a referenced mscorlib or netstandard. Assemblies compiled against .NET reference assemblies (net10) reference neither, so imported types such as Guid stayed scoped to System.Private.CoreLib and Resolve() returned null. When the module references neither, scope the type to the referenced assembly that defines or forwards it.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
When NGO's assemblies are compiled against .NET reference assemblies (for example when targeting .NET 10), the CodeGen post-processor cannot resolve core library types it imports through
typeof().PostProcessorReflectionImportermapsSystem.Private.CoreLibtypes to the module'smscorlibornetstandardreference. A module compiled against the .NET reference pack has neither: the pack splits the core library acrossSystem.Runtime,System.Collectionsand other assemblies. The imported type stays scoped toSystem.Private.CoreLib, andResolve()returns null.The fix: when the module references neither
mscorlibnornetstandard, scope aSystem.Private.CoreLibtype to the referenced assembly that defines or forwards it, with a per-type cache. Mapping everything toSystem.Runtimeis not enough, becauseList<T>, for example, lives inSystem.Collections. Modules that referencemscorlibornetstandardtake the old path, so existing builds are unchanged.Entities and Multiplayer Tools have the same importer and get the same fix.
Jira ticket
None.
Changelog
com.unity.netcode.gameobjects
GuidandList<T>, in assemblies compiled against .NET reference assemblies, for example when targeting .NET 10.Documentation
Testing & QA (How your changes can be verified during release Playtest)
Tested with a Unity editor that compiles packages for .NET 10, on a project with NGO's EditMode tests, Entities and Multiplayer Tools (all three with this fix):
BasicBuildTest, which is unrelated).Builds that target netstandard take the unchanged code path.
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?If any boxes above are checked the QA team will be automatically added as a PR reviewer.
Up-port
Not needed: this PR targets develop-3.x.x.
Backports
Not planned. .NET 10 targeting only applies to the newest editors, which use NGO 3.x. The importer on develop-2.0.0 differs only in its namespace, so the same change can go there if NGO 2.x needs it.