Search Issue Tracker

Fixed in 2020.2.X

Fixed in 2018.4.X, 2019.4.X, 2020.1.X

Votes

12

Found in

2018.4

2019.3.14f1

2020.2

Issue ID

1251011

Regression

No

System.Net.Socket objects throw ArgumentException in IL2CPP after installing Windows SDK 2004

IL2CPP

-

How to reproduce:
1. Install SDK 10.0.19041.0 ( https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/ )
2. Open the attached "UnityTicket_Sockets.zip" project
3. Build and run a WIndows 10 dev build
4. Push the button marked "Run Test"

Expected Behavior: Socket is created and methods executed without errors
Actual Behavior: Exception appears in the Dev Build Console

Reproducible with: 2018.4.23f1, 2019.4.0f1, 2020.1.0b11, 2020.2.0a13

Note: make sure to install windows-IL2CPP build target on your Unity version. Screenshot "UnityTicket_Sockets_hoW5pbhqxO.png" attached

Comments (3)

  1. SevenPointRed

    Jul 28, 2020 08:21

    2 Months and this breaking bug still isnt fixed in an LTS release.

  2. alexander_unity574

    Jun 26, 2020 13:19

    I have the same bug. So, right now i'm using the old Windows SDK, but at some point, we would have to move to new Windows sdk 10.0.19041.0, and right now, i don't know of how we will do it.

    Right now the better solution is to delete Windows sdk 10.0.19041.0, and have installed on your PC only Windows sdk 10.0.18362.0.

  3. mrmcduck

    Jun 15, 2020 17:40

    Same for me, here's the stack trace:
    ArgumentException: Value does not fall within the expected range.
    at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue) [0x00000] in <00000000000000000000000000000000>:0
    at System.Net.Sockets.Socket.SocketDefaults () [0x00000] in <00000000000000000000000000000000>:0
    at System.Net.Sockets.Socket..ctor (System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) [0x00000] in <00000000000000000000000000000000>:0

    Horrible solution but in case you need a quick fix:
    Go to C:\Program Files (x86)\Windows Kits\10, then do the following for the folders bin, lib & include:
    Rename "10.0.19041.0" folder, copy folder of older version (for me 10.0.16299.0) and rename it to "10.0.19041.0".
    This is a horrible thing to do and may break a lot of other things if you need it for anything else but the IL2CPP unity compiler, but just uninstalling the latest SDK did not work (il2cpp.exe crash -
    although it worked previously without it).

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.