MissingMethodException: Constructor on type 'ExitGames.Client.Photon.SocketUdpAsync' not found.

Options
again
again
I found a post on the Unity forums but it didn't help me. https://forum.unity.com/threads/photon-unity-networking.101734/page-46#post-4747286

tobiass said: ↑
It's a case where Unity's stripping is over-eager. You can reign it in by modifying the link.xml file in your project to retain the class (or simply all of the Photon dll).
I'm using PUN 1.96 and I was unable to get this method to work. I opened the link.xml file,
added

<assembly fullname="Photon3DotNet">

<type fullname="ExitGames.Client.Photon.SocketTcpAsync" preserve="all"/>

</assembly>
and also tried

<assembly fullname="Photon3DotNet">

<type fullname="ExitGames.Client.Photon.SocketUdpAsync" preserve="all"/>

</assembly>
and

<assembly fullname="Photon3DotNet">

<type fullname="ExitGames.Client.Photon.SocketTcpAsync" preserve="all"/>

</assembly>
and

<assembly fullname="Photon3Unity3D">

<type fullname="ExitGames.Client.Photon.SocketTcpAsync" preserve="all"/>

</assembly>
and

<assembly fullname="Photon3Unity3D">

<type fullname="ExitGames.Client.Photon.SocketUdpAsync" preserve="all"/>

</assembly>
But I still get the exception



MissingMethodException: Constructor on type 'ExitGames.Client.Photon.SocketUdpAsync' not found.

at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder,




Setting the stripping level to "None" is not an option here since, according to unity documentation, "The Disabled option is not available when the IL2CPP scripting backend is selected because of the impact it has on build times." Low stripping does not fix the issue. I MUST use IL2CPP on some platforms since mono isn't allowed (xb1 for example).

At this time I am blocked. Is there any way around this limitation?

Comments

  • again
    Options
    My XML didn't show up in the post and I don't see an edit button. Here are the entries I tried - https://pastebin.com/t666Ksip
  • Tobias
    Options
    Another way to preserve the class is to simply use it. Create a new SocketTcpAsync instance in your code and it will not get stripped.

    Is the class in source or in the dll? If it's in source, this linker instructions won't work.
  • nxtboyIII
    Options
    I'm having this problem too, and I tried adding tags and using it in the game but neither work, and it still gets stripped @Tobias