Search Unity

Bug Can't debug code in packages in IL2CPP builds

Discussion in 'Code Editors & IDEs' started by hugeandy, Apr 8, 2022.

  1. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Hi all,

    We are having problems with debugging our IL2CPP builds. We are able to debug the main project code which resides in a single assembly (generated from a single assembly definition asset in Assets/Scripts). We can also debug certain other assemblies which are created from other assembly definition assets (like plugins).

    However, we can't debug code which resides in our own custom packages, which is very frustrating. We can see that the modules for these are not loaded in the VS modules window, and we cannot load them no matter what we try.

    We have tried adding the
    XXX_BackUpThisFolder_ButDontShipItWithYourGame\Managed
    folder to the symbols search paths in VS but this doesn't work. We can see the DLLs and PDBs in this folder.

    These are development builds made with the BuildOptions.Development and BuildOptions.AllowDebugging. On standalone builds UnityEditor.WindowsStandalone.UserBuildSettings.copyPDBFiles is true.

    This is happening on Standalone builds and GameCore Xbox One/Series and Unity 2020.3.23f1.
    The builds are made on remote TeamCity machines
    Rider and VS integration packages are up to date.
    VS2019 16.11.11.
    Rider 2021.3.4 (and I have tried the latest available EAP version)

    Another point is that we cannot debug *at all* with Rider.

    We're going crazy!

    Any suggestions?

    Cheers!
     
    Last edited: Apr 8, 2022
  2. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    I have made a reproduction of this issue in a new project.

    Steps:
    Create a new project and create a new package.
    Add two new scripts, one in the Assets folder, and another in the new package.
    In the packages script, create a dummy method which prints or does arbitrary.
    In the Assets script, call this new method from Update
    Set up the Assets script on a new gameobject in a scene and make a build.
    Close the project, and move it to a new directroy (this step represents being build on a remote machine where paths don't match)
    Run the build attach to it in VS.
    Notice that you can place a breakpoint on code in the Assets script, but not the packages script.