Some variables do not exist in the current context in Rider Debugger mode


I am trying to inspect the values of local variables. This feature works for some variables. For those that it doesn't, Rider brings up an error:

The name `variable_name` does not exists in the current context.

And image example of code and debugger watch error:

This is decompiled code, but even here it works for some local variables. What could be the fix for this?

I already check Settings->Build, Execution, Deployment->Disable JIT optimization on module load (.NET/.NET Core only), but as it says, it only works for .NET/.NET Core modules.



Could you please clarify what runtime are you using? Would it be possible to provide me with a sample so we could check it on our side? Is there any chance that you have attached a debugger to an already running process? So far it looks like possibly variable was inlined. The debugger does not always suppress all optimizations. 


I've had the same problem. It seems like Rider allows you to run the "Release" run configuration in "debug" mode. I had to change to the "Debug x64" run configuration, and then press "debug". This made all symbols available again for debugging.


When I refer to project B in project A, I make changes to project B and use it in project A, but when I build it, it says `Example.cs(81, 39): [CS0103] The name 'test' does not exist in the current context` and I have to I have to restart rider to recognize


Hi there,
Can anybody share a simple solution? I tried to reproduce it, but no luck. Also, if there are any specific configuration you did, please let me know.


Thank you in advance.



I had that issue debugging tests and Alon Dolev's solution was spot on. I was running the test in Release config instead of Debug (for some reason it was set to release!). Switching to debug solved the solution.


Please sign in to leave a comment.