I can't debug IL2CPP build with Rider

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?


This should work properly with IL2CPP. Which player platform are you debugging?

Windows. And it works perfectly fine if I compile in Mono. That's why I thought I might be missing something.

[quote=“Caparrini”, post:3, topic: 852440]
Windows. And it works perfectly fine if I compile in Mono. That’s why I thought I might be missing something.

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?

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.

What assembly is the code in? Is it script code that is in Assembly-CSharp.dll? Or is it in another assembly?

I haven't created any assembly definition for my code, so it must be using the default

[quote=“Caparrini”, post:5, topic: 852440]
It says it doesn’t find the associated module.

Can you elaborate on this message? Where does it show up? Are there any more details?

The message appears when I hold the mouse over the breakpoint. Here you have a full screenshot



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.

I double checked, and it is in the Assembly-CSharp assembly

Ok, thanks. @citizenmatt - do you have any idea what might be happening here?

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

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.

Let me know and I'll test whatever is necessary. i guess It must be something on my side either Rider or OS

Are you using Rider 2021.2?

Yes, that's correct

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?

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.


1 Like

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.