Skip to content

Commit d84907e

Browse files
authored
fix: Fixed compile failure when compiled against com.unity.nuget.mono-cecil >= 1.11.4 (backport #1920) (#1955)
1 parent ca5b3a8 commit d84907e

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
3030
- Fixed issue during client synchronization if 'ValidateSceneBeforeLoading' returned false it would halt the client synchronization process resulting in a client that was approved but not synchronized or fully connected with the server. (#1883)
3131
- Fixed an issue where UNetTransport.StartServer would return success even if the underlying transport failed to start (#854)
3232
- Passing generic types to RPCs no longer causes a native crash (#1901)
33+
- Fixed a compile failure when compiling against com.unity.nuget.mono-cecil >= 1.11.4 (#1920)
3334
- Fixed an issue where calling `Shutdown` on a `NetworkManager` that was already shut down would cause an immediate shutdown the next time it was started (basically the fix makes `Shutdown` idempotent). (#1877)
3435

3536
## [1.0.0-pre.7] - 2022-04-06

com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,11 @@ private MethodReference GetFastBufferWriterWriteMethod(string name, TypeReferenc
607607
var meetsConstraints = true;
608608
foreach (var constraint in method.GenericParameters[0].Constraints)
609609
{
610+
#if CECIL_CONSTRAINTS_ARE_TYPE_REFERENCES
610611
var resolvedConstraint = constraint.Resolve();
612+
#else
613+
var resolvedConstraint = constraint.ConstraintType.Resolve();
614+
#endif
611615

612616
var resolvedConstraintName = resolvedConstraint.FullNameWithGenericParameters(new[] { method.GenericParameters[0] }, new[] { checkType });
613617
if ((resolvedConstraint.IsInterface && !checkType.HasInterface(resolvedConstraintName)) ||
@@ -737,7 +741,12 @@ private MethodReference GetFastBufferReaderReadMethod(string name, TypeReference
737741
var meetsConstraints = true;
738742
foreach (var constraint in method.GenericParameters[0].Constraints)
739743
{
744+
#if CECIL_CONSTRAINTS_ARE_TYPE_REFERENCES
740745
var resolvedConstraint = constraint.Resolve();
746+
#else
747+
var resolvedConstraint = constraint.ConstraintType.Resolve();
748+
#endif
749+
741750

742751
var resolvedConstraintName = resolvedConstraint.FullNameWithGenericParameters(new[] { method.GenericParameters[0] }, new[] { checkType });
743752

com.unity.netcode.gameobjects/Editor/CodeGen/com.unity.netcode.editor.codegen.asmdef

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"includePlatforms": [
88
"Editor"
99
],
10+
"excludePlatforms": [],
1011
"allowUnsafeCode": true,
1112
"overrideReferences": true,
1213
"precompiledReferences": [
@@ -15,5 +16,14 @@
1516
"Mono.Cecil.Pdb.dll",
1617
"Mono.Cecil.Rocks.dll"
1718
],
18-
"autoReferenced": false
19-
}
19+
"autoReferenced": false,
20+
"defineConstraints": [],
21+
"versionDefines": [
22+
{
23+
"name": "com.unity.nuget.mono-cecil",
24+
"expression": "(0,1.11.4)",
25+
"define": "CECIL_CONSTRAINTS_ARE_TYPE_REFERENCES"
26+
}
27+
],
28+
"noEngineReferences": false
29+
}

0 commit comments

Comments
 (0)