Search Unity

Socket ctor throws "ArgumentException: Value does not fall within the expected range"

Discussion in 'Scripting' started by Yacuzo, Jun 4, 2020.

  1. Yacuzo

    Yacuzo

    Joined:
    Sep 22, 2016
    Posts:
    27
    Hi,

    I have been fighting this for two days.

    I made a small repro, with the attached 'SocketMaker.cs' as the only code:

    You can see the exception in the attached playerlog.txt. I also attached the editor log from my last build attempt.

    .NET 4.x / .Net Standard makes no difference. Building via a built solution makes no difference. I reverted a VS update (back to 16.5.5), then removed both unity and VS, restarted and installed them both again. Still no luck. I made sure to delete /Library, /Obj and clean the build folder between each thing I tried.

    It only happens with IL2CPP, so I tried with a link.xml targeting System.Net.Sockets, no luck.

    If I build it on my machine and send to other devs, the build is also broken at their end, meaning it is compile time issues, not runtime issues. If they build the same project and send it to me, then all is well. How is it possible that I have this persistent build issue only on my machine after reinstalls?

    I have run out of options. What on earth is going on here? Anything else I can try?
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    This certainly seems weird... once you reach this point, about the only thing I can suggest is stuff you've already tried. I wonder if maybe you also need to reboot after reinstalling VS? Microsoft code is awfully intrusive in a lot of ways, and I see their intrusiveness go horribly wrong fairly often, so maybe some orphaned compiler process was hanging onto an old DLL that was mounted from the previous install??
     
  3. Yacuzo

    Yacuzo

    Joined:
    Sep 22, 2016
    Posts:
    27
    I think this happened after I installed the new 10.0.19xxx Windows SDK. I removed it but now I seem to have problems with IL2CPP still trying to include things from the 19xxx SDK.

    Can a mod move this to the Windows forums?
     
  4. Yacuzo

    Yacuzo

    Joined:
    Sep 22, 2016
    Posts:
    27
    I chose 'Create a visual studio solution' and retargeted that to the .8xxx Windows SDK and now it works fine again. It seems il2cpp sockets may have issues with the .9xxx SDK.