Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question I can't debug IL2CPP build with Rider

Discussion in 'Code Editors & IDEs' started by Caparrini, Aug 18, 2021.

  1. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    This works fine if I compile the build in Mono, but when using IL2CPP, Rider doesn't hit any breakpoints. I have checked the build as Development Build and Script Debugging. Any idea what I might be missing or doing wrong?

    Thanks
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    This should work properly with IL2CPP. Which player platform are you debugging?
     
  3. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    Windows. And it works perfectly fine if I compile in Mono. That's why I thought I might be missing something.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    Yeah, it should work correctly. Does the debugger attach to the Unity player IL2CPP process? If it attaches, do the breakpoints load? If the load, then is the problem that the debugger does not stop at the break points?
     
  5. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    I guess it attaches since I start the standalone build from Rider itself. But the breakpoints don't load. It says it doesn't find the associated module.
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    What assembly is the code in? Is it script code that is in Assembly-CSharp.dll? Or is it in another assembly?
     
  7. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    I haven't created any assembly definition for my code, so it must be using the default
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    Can you elaborate on this message? Where does it show up? Are there any more details?
     
  9. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    The message appears when I hold the mouse over the breakpoint. Here you have a full screenshot

    upload_2021-8-19_8-41-53.png
     

    Attached Files:

  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    Thanks - can you use the little target icon the upper left to find where this file is located in the Solution explorer? I'm wondering if this in the Assembly-CSharp-Editor assembly.
     
  11. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    I double checked, and it is in the Assembly-CSharp assembly
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    Ok, thanks. @citizenmatt - do you have any idea what might be happening here?
     
  13. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    I retried this on a new empty project with only one script and got the same result. The debug on the Mono build works perfectly, but the IL2CPP gives the same error
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,719
    That is very odd. A new empty project works in our tests here. I'll see if there is any more debugging we can do on your side.
     
  15. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    Let me know and I'll test whatever is necessary. i guess It must be something on my side either Rider or OS
     
  16. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    70
    Are you using Rider 2021.2?
     
  17. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    Yes, that's correct
     
  18. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    70
    That screenshot looks a little weird. Tooltip showing an unresolved breakpoint while also saying "Process Chain Reaction.exe terminated with exit code 0". Could you please try running the Player from terminal or from Unity and attach debugger via Run | Attach to Unity process?
     
  19. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    Debugging using the editor or Mono build has always worked fine. Now using the method of Run | Attach to Unity process, seems to work fine with the IL2CPP build as well. The problem only seems to appear if I use the top-right menu to select Standalone Player on the "Select Run/Debug Configuration", edit the configuration to give it the path of my Player, and click de Debug button. This is a screenshot using that method on an IL2CPP build of an empty project if it is of any use to you.
     

    Attached Files:

    van800 likes this.
  20. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    70
    Thank you! After your explanation, I was to reproduce the issue.
    The cause is that when we supply environment variable MONO_ARGUMENTS and it works only for mono backend and is ignored for IL2CPP backend. I will contact Unity team to find a solution.
     
  21. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    51
    Thanks a lot for your help :)
     
  22. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    234
    Is there an update on the issue ? :)

    I have the same setup than @Caparrini (Rider 2021.2) and cannot break on IL2CPP players (same error than him on the breakpoint).

    No issue with Mono players.
     
  23. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    70
    If you have the same problem with il2cpp backend in standalone player - just use "Run | Attach to Unity" for now.
    But there is another issue under investigation related to IL2CPP https://youtrack.jetbrains.com/issue/RIDER-70101, if it fits your case - comment there to get updates.
     
  24. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    234
    Hello @van800 , I am still having the issue with Rider 2021.3.2.

    I am unable to debug builds made in IL2CPP with Rider, while there is no issue at all breaking with Visual Studio 2019.
    I am currently testing this on Windows IL2CPP builds made with Unity 2021.2.5f1.
    To attach Rider, I use "Run | Attach to Unity process..." then select the player corresponding to my running build :
    upload_2022-1-31_12-16-10.png


    This is the error I'm getting on a basic project :
    upload_2022-1-31_12-12-32.png


    This is the Scripting Backend configuration of the repro project :
    upload_2022-1-31_12-17-25.png


    Rider breaks without issue when the player is built with Mono :
    upload_2022-1-31_12-20-38.png


    I'd be happy to test different configurations and send logs/repro projects if needed

    Should I create a new issue on Youtrack, or bump the following one ?
    https://youtrack.jetbrains.com/issue/RIDER-70101
     
    van800 and Ceyth like this.
  25. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    234
  26. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    532
    same problem here
    Has been anybody able to debug debug with rider and Unity 2021 ? Here I just tried with the latest Rider version and detected the breakpoint but after that, I could not either resume or step over next instruction...this worked perfectly on Unity 2020.3

    I wrote a comment for them to reopen the issue:
    https://youtrack.jetbrains.com/issue/RIDER-70101
     
  27. ahmetyazir

    ahmetyazir

    Joined:
    Mar 23, 2021
    Posts:
    1
    I second you that. I also can't debug with Rider & Unity 2021 versions. I am on a M1 machine by the way. Both Unity & Rider are Apple Silicon versions.
     
  28. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    234
  29. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    234
  30. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    532
    @van800 when I attach rider to the iPhone it stops at the first breakpoint, when I press resume, application frozes,
    is this a known error ?

    Im using Unity 2021.3.10 on a Mac Sillicon M1
     
    CodeFluegel likes this.
  31. CodeFluegel

    CodeFluegel

    Joined:
    Apr 8, 2015
    Posts:
    4
    Same Here, Mac Silicon M1 and Rider 2022.2.4
     
  32. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    532