Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Unity Test player builds dont support debugging - 2020.1.2f1

Discussion in 'Testing & Automation' started by garrett_b, May 20, 2021.

  1. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24
    Test player builds don't seem to support debugging nor the attachment of the debugger in the first place.

    However, regular non-test player builds can have their process attached to/debugged just fine.

    Here is a short video I created that outlines how to reproduce this issue:


    My company heavily uses the Unity Test Framework. We often find that our PlayMode tests can pass when run in-editor, but will fail when run in the standalone test player builds. For this reason, we really need the ability to properly debug test player builds.
     
    Last edited: May 20, 2021
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,670
  3. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24
    Thanks for the reply, Superpig

    Unfortunately, enabling the AllowDebugging build option resulted in il2cpp build failures. I also tried mixing in additional build options that seemed relevant, such as the Development flag.

    Attached are the two errors I encountered. Any ideas what might be going wrong?

    Thanks again!
     

    Attached Files:

  4. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,670
    Looks to me like this is the important bit in that first log file:

    Code (csharp):
    1.  
    2. il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException:
    3. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\link.exe
    4. /out:"C:\Users\garre\Documents\Repos\vnext\Library\il2cpp_cache\linkresult_2042BCC54CCBC1CC93D27440D14F06D0\GameAssembly.dll"
    5. /ignore:4206 /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE
    6. /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF
    7. /HIGHENTROPYVA /DLL /IGNORE:4104 /NODEFAULTLIB:uuid.lib
    8. "kernel32.lib" "user32.lib" "advapi32.lib" "ole32.lib" "oleaut32.lib" "Shell32.lib"
    9. "Crypt32.lib" "psapi.lib" "version.lib" "MsWSock.lib" "ws2_32.lib" "Iphlpapi.lib"
    10. "Dbghelp.lib"
    11. "C:\Program Files\Unity\Hub\Editor\2020.1.2f1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\Variations\win64_development_il2cpp\baselib.dll.lib"
    12. /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\lib\x64"
    13. /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64"
    14. /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64"
    15. /SUBSYSTEM:WINDOWS @"C:\Users\garre\AppData\Local\Temp\tmpB934.tmp"
    16.  
    17. 9B8A3069390690B30C7EC18046C45CF7.obj : fatal error LNK1136: invalid or corrupt file
    The linker is choking on that object file for some reason. I don't even see it as an input on the command line - my guess is it is specified inside "C:\Users\garre\AppData\Local\Temp\tmpB934.tmp" - but I think the most likely explanation is that somehow that file is corrupt (and cached for reuse between builds), and you should track it down and delete it so that the pipeline is forced to compile it again.
     
  5. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24
    I was able to fix this IL2CPP error by deleting the Library folder, and doing a fresh standalone test player build/run. However, I still found that the test player is not recognized by the Rider debugger, despite my adding the "AllowDebugger" flag in the TestPlayerBuildModifier:

    Code (CSharp):
    1. playerOptions.options |= BuildOptions.AllowDebugging;
    The test player however, does prompt me to attach a debugger, it just isn't recognized/displayed as an attachable process when I actually attempt to attach to it with the latest version of Rider (2021.1.2).

    Attached is an image of a test player prompting me to attach a debugger, yet rider's Attach To Unity Process dialogue only showing the Editor process as being attachable.
     

    Attached Files:

    Last edited: May 24, 2021
  6. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,670
    That's pretty weird - as far as I know it should work. You might want to reach out to the JetBrains team on this one.
     
  7. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73
    garrett_b likes this.
  8. G_Wojo

    G_Wojo

    Unity Technologies

    Joined:
    Feb 8, 2017
    Posts:
    44
    Hi, you are right about player not being visible in available list. Issue is that we opening broadcasting only when we are in listening code and not when we are connecting from player to editor (this is behaviour we see in the test framework). In my knowledge debugger port is open it is just not announced in network and because of that not visible in the player list. I think as workaround you should be able to connect to it using IP address.

    This is of course temporary solution as we are working on improving this behaviour.
     
    garrett_b likes this.
  9. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24
    Yep! Connecting directly via IP address and port solves the problem for me. I was able to attach to unity process in rider, and then connect manually by IP. Thanks for your help.

    For future persons reading this, the IP and port of a test player are logged to the test player's log file
     
  10. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24