fix: remove runtime references from codegen [MTT-4088]#2192
fix: remove runtime references from codegen [MTT-4088]#2192ShadauxCat wants to merge 6 commits intodevelopfrom
Conversation
|
Guess this is more of a fix than a chore... |
|
|
||
| internal static class TypeNames | ||
| { | ||
| public const string NetworkManager = "Unity.Netcode.NetworkManager"; |
There was a problem hiding this comment.
rather than hardcoding all string by hand here, we could still reference Netcode.Runtime's types but instead of typeof(XXX) type-based lookup in the ILPP/Cecil code, we could simply produce strings here with nameof(XXX) to keep it consistent with the Netcode.Runtime — also by doing that, we keep Netcode.Runtime reference around and we don't need to have Unity.Netcode.Shared asmdef and/or duplicate xxHash implementation, we could simply revert them back to current state.
| public const string NetworkManager = "Unity.Netcode.NetworkManager"; | ||
| public const string NetworkManager_RpcReceiveHandler = "Unity.Netcode.NetworkManager/RpcReceiveHandler"; | ||
| public const string NetworkBehaviour = "Unity.Netcode.NetworkBehaviour"; | ||
| public const string NetworkBehaviour___RpcExecStage = "Unity.Netcode.NetworkBehaviour/__RpcExecStage"; |
There was a problem hiding this comment.
this could be the bug we're looking for (ILPP failing to make RpcExecStage protected from internal)
There was a problem hiding this comment.
How does adding a few string prevents the change from protected to internal ? (Not arguing it doesn't, just really curious how one leads to the other)
There was a problem hiding this comment.
more specifically, this part: viour/__RpcExecSt
|
superseded by #2199 |
This changes the method by which we look up types in codegen from looking it up based on the actual type to looking them up based on type names. It removes the dependencies on runtime assemblies from the codegen assembly.
This comes from the ILPP team and has a few bits of logic behind it:
The immediate benefit of this is working around the aforementioned crash, which is also being fixed by the ILPP team. This will fix it on all of our supported platforms (whereas the fix by the ILPP will only hit 2020.3, 2021.3, and 2022.x)
The long-term benefit is that this switches us to a mode of following best practices and avoids running into any other such issues in the future. The way we were doing it worked (aside from the crash) but this is the "right way" to do it.
Changelog
Testing and Documentation