Skip to content

FishNet ILPP crash due to copied parameter/custom-attribute metadata not being imported #1023

Description

@MarkZeroK

Environment:

  • Unity: 6000.3.10f1
  • FishNet: 4.6.22

Discord link: https://discord.com/channels/424284635074134018/1034477094731784302/1480963733466648586

Observed behavior:
FishNet ILPP crashes during compilation while processing Assembly-CSharp.dll. Cecil throws:
System.ArgumentException: Member 'System.Void System.ParamArrayAttribute::.ctor()' is declared in another module and needs to be imported

Expected behavior:
FishNet ILPP should complete normally.

Steps to repeat:
Did not find a simple way to repeat this. It just one day started happening in my project after adding a C# event to one class. Tried to create a simple project and make it happen there but could not get it to repeat. Other users seem to have had the same or similar issue but it seems to have thus far been dismissed as a Unity bug, see https://github.com/FirstGearGames/FishNet/issues?q=ILPP

Root cause:
Compilation fails in FishNet ILPP during generated method/parameter copying. FishNet codegen appears to reuse Cecil ParameterDefinition, CustomAttribute, and some generic parameter metadata directly instead of cloning/importing it into the destination module. If a copied parameter carries ParamArrayAttribute, Cecil fails while writing metadata.

Fix:
I was able to create if not a complete fix (not tested very well yet), at least a workaround. I patched FishNet locally to clone/import parameter definitions, custom attributes, and generic parameter metadata instead of reusing Cecil objects. After that, my project compiled successfully and everything seems to work when testing it.

I have added the patch diff of my changes to FishNet as an attachment to this issue.

FishNet ILPostProcessor error fix.patch

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolved Pending ReleaseIssue is resolved and will be available on the noted version.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions