Error building Player: Exception: Error: type `System.Security.Cryptography.Rijndael` doesn't exist

Options
Hi,

I'm trying to use photon chat in Unity 3D Game. While build for the windows phone/ WIndows Universal It shows follwing error.

Error building Player: Exception: Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at Photon.SocketServer.Security.DiffieHellmanCryptoProvider.
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Boolean Photon.SocketServer.Security.DiffieHellmanCryptoProvider::get_IsInitialized().
Error: type `System.Security.Cryptography.RijndaelManaged` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: method `System.Void System.Security.Cryptography.RijndaelManaged::.ctor()` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: type `System.Security.Cryptography.PaddingMode` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: method `System.Void System.Security.Cryptography.SymmetricAlgorithm::set_Padding(System.Security.Cryptography.PaddingMode)` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Void Photon.SocketServer.Security.DiffieHellmanCryptoProvider::DeriveSharedKey(System.Byte[]).
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Byte[] Photon.SocketServer.Security.DiffieHellmanCryptoProvider::Encrypt(System.Byte[],System.Int32,System.Int32).
Error: type `System.Security.Cryptography.Rijndael` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Byte[] Photon.SocketServer.Security.DiffieHellmanCryptoProvider::Decrypt(System.Byte[],System.Int32,System.Int32).
Error: type `System.Net.IPHostEntry` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Net.IPAddress ExitGames.Client.Photon.IPhotonSocket::GetIpAddress(System.String).
Error: type `System.Net.Dns` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Net.IPAddress ExitGames.Client.Photon.IPhotonSocket::GetIpAddress(System.String).
Error: type `System.Net.IPHostEntry` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Net.IPAddress ExitGames.Client.Photon.IPhotonSocket::GetIpAddress(System.String).
Error: method `System.Net.IPHostEntry System.Net.Dns::GetHostEntry(System.String)` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Net.IPAddress ExitGames.Client.Photon.IPhotonSocket::GetIpAddress(System.String).
Error: type `System.Net.IPHostEntry` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Net.IPAddress ExitGames.Client.Photon.IPhotonSocket::GetIpAddress(System.String).
Error: method `System.Net.IPAddress[] System.Net.IPHostEntry::get_AddressList()` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Net.IPAddress ExitGames.Client.Photon.IPhotonSocket::GetIpAddress(System.String).
Error: method `System.Void System.Net.Sockets.Socket::set_ReceiveTimeout(System.Int32)` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Boolean ExitGames.Client.Photon.PingMono::StartPing(System.String).
Error: method `System.Void System.Net.Sockets.Socket::Connect(System.String,System.Int32)` doesn't exist in target framework. It is referenced from Photon3Unity3D.dll at System.Boolean ExitGames.Client.Photon.PingMono::StartPing(System.String).



Anyone found solution for this???

Unity version : Unity 4.6.X

Comments

  • hangar
    hangar
    edited September 2015
    Options
    The problem is code stripping. Usually you have to enable code stripping in player settings, though il2cpp builds are always code stripped. You can either disable code stripping or add this file:

    Make sure to give it the name "link.xml"; you used to have to put it directly in Assets/ but in more recent versions (5.1.3+ maybe) it seems you can put it anywhere.
    <linker>
       <assembly fullname="System">
           <namespace fullname="System.Security.Cryptography" preserve="all" />
       </assembly>
    </linker>
    link.xml is a special file used by the Unity code stripper. This one says "in the DLL System.dll, ignore anything in the System.Security.Cryptography namespace."

    System.Security.Cryptography uses a lot of reflection, which the code stripper doesn't understand, so it strips out all of those classes. You may need to do this for other classes/namespaces, and they might be in different DLLs.

    Looks like they finally have some documentation.