1

I'm using Visual Studio 2019 (Professional Edition, Version 16.8.4).

While I'm debugging a specific C# project, the local variables don't appear under the Locals window, also they don't display in the Immediate Window, same if I hover over them in the code view.

  • I've been reading the following question1, question2
  • My code is compiled in Debug Mode
  • I've turned on the Use Managed Compatibility Mode
  • I've disabled JIT debugging for Managed Code
  • UPDATE: I have reset my C# settings in Tools => Import & Export Settings

But still, the local variables (hrt,t,T) don't show up.

Same issue for my teammates on different machines.

Nothing show on the Locals and Immediate windows

enter image description here

Same for the Watch and Autos Windows :

enter image description here

Any suggestions ?

webpat
  • 1,889
  • 16
  • 21
  • Locals window show only local variables in current stack frame. So please try to use Autos Window or Watch window. Besides, try to reset all vs settings under Tools-->Import and Export settings-->Reset all settings. Since we cannot reproduce the issue in our side(miss the complete code). And you could try to share a reproducible sample with us to troubleshoot the issue more quickly. – Mr Qian Jan 25 '21 at 09:01
  • Thx @PerryQian-MSFT for your reply, I'll try to set a simple code to reproduce the issue. I cannot send you the code since It's proprietary and It uses the Bloomberg API. – webpat Jan 25 '21 at 10:15
  • Please check [CS0103 error](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0103). Perhaps you have to define those local variables on the global environment rather than the code block. Try to define those local variable at the top of your file. – Mr Qian Jan 26 '21 at 09:30
  • Indeed, moving the variables outside the local scope result in seeing them back in the debugging windows ! The only local variable missing is the one in the foreach : `foreach (DateTime dt in input.Frame.RowKeys)` What I can not understand is why the code is compiling with no errors, and only the debugger requires the variables to be declared in the global scope. Also, if i make a sample project with just the code snippet, I can not reproduce the error. – webpat Jan 26 '21 at 20:33
  • Does the input.Frame.RowKeys come from BloomBerg? Since the Bloomberg API is third party api, we can’t do some tests with it. Not sure if it is related to this api, we suggest you create a console app with `foreach (DateTime dt in input.Frame.RowKeys)`, then debug to check if local variable could be recognized. – Mr Qian Jan 29 '21 at 09:27
  • Frame.RowKeys is coming from Deedle library which is open source. I made a console app and I can not reproduce the error. The variable are all visibles. – webpat Feb 01 '21 at 15:01

0 Answers0