UWP Reference rewriter: Error: type `System.Net.Sockets.Socket` doesn't exist in target framework

Hello,
I have dll that is built for target framework “.Net Framework 3.5 Client Profile”.
When building in unity for UWP, I got lots of errors that refer to System.Net namespace like

  • Reference rewriter: Error: type System.Net.Sockets.Socket doesn’t exist in target framework. It is referenced from CommonTypes.dll at System.Boolean
  • Reference rewriter: Error: type System.Net.SocketAsyncEventArgs doesn’t exist in target framework. It is referenced from CommonTypes.dll at System.Boolean

Can someone point, why this error occur? As for as I know Socket class(actually all classes that are referenced by this dll) exists in UWP in System.Net namespace.
If I use Socket class in unity scripts - there is no error while building for UWP.
Thanks!

That looks like a bug in Unity. Could you report a bug, and in the description mention that it works if you put the scripts directly into your project, but not if it’s compiled into a DLL?

In the meantime, you have several choices:

  1. Recompile that DLL to target UWP, put it inside your Unity project alongside the .NET 3.5 and configure the UWP DLL to be used when you’re building for UWP.
  2. Put the code as C# files into your project.
  3. Switch to IL2CPP scripting backend.

Bug reported - 947209

  1. Doesn’t look good as it makes app build much more complex . I was looking toward injecting dependency at a start up as actually using only few classes/methods.
  2. Due to some dll dependencies it is hardly an option
  3. Didin’t work for me
  1. Why does it make app build much more complex?
  2. What didn’t work?