Bug 35858 - VS2015 does not show contents of local variables during debug (RC3)
Summary: VS2015 does not show contents of local variables during debug (RC3)
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: Normal blocker
Target Milestone: 4.0.1 (C6SR1)
Assignee: Bugzilla
Depends on:
Reported: 2015-11-13 22:36 UTC by philip
Modified: 2017-02-17 16:55 UTC (History)
16 users (show)

Is this bug a regression?: ---
Last known good build:

Locals fixed (174.09 KB, image/png)
2015-11-30 19:01 UTC, Joaquin Jares

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description philip 2015-11-13 22:36:14 UTC
# Steps to reproduce

1. Set breakpoint in some function.
2. Run application
3. When VS debugger breaks, "unknown identifier" is shown when hovering over locals.  Also the "Locals" view shows "?" for all local variable names (even though it shows correct value and type).

# Expected behavior

Debugger to show content of locals

# Actual behavior

does not show locals correctly

# Supplemental info (logs, images, videos)

# Test environment (full version information)
RC3, VS2015, 1.5.2...-pre1, Win10
Comment 1 Shruti 2015-11-16 07:55:27 UTC
I have checked this issue and not able to reproduce it. Steps followed to reproduce this issue are mentioned below:

1. Create an android project.
2. Created 3 functions and call them in MainActivity method.
3. Debug the project.

I am able to see the correct value of all local variables when hovering over  local variables within the method while debugging.

And as per my understanding, unknown identifier is shown when user hovering over the locals which is out of scope of local methods so this is correct behavior.

Please confirm me that you are also doing the same process which I mentioned in above step and If I missed anything then It would be great if you describe in more detail or share any video.

Screencast: http://screencast.com/t/xTygh7hR

Environment Info:
Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Xamarin (f860fe4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (3efa14c)
Visual Studio plugin to enable development for Xamarin.Android.
Comment 2 philip 2015-11-16 09:45:02 UTC
It appears that this happens inside async methods such as 

		Device.BeginInvokeOnMainThread(async (){ ... } ...

There was a previous problem with not hitting breakpoint which has been fixed.  But now there is this problem remaining.
Comment 3 PJ 2015-11-16 12:41:48 UTC
Thanks for the report Philip. Oleg is going to take a look and confirm the issue. Given our internal timeline this is not making C6 baseline, moving to C6SR1 while the investigation continues.
Comment 4 philip 2015-11-16 14:50:58 UTC
This is a major bug so I hope you are not considering a stable release without fixing it
Comment 5 Oleg Demchenko 2015-11-16 15:25:49 UTC
Hi Philip, I tried to reproduce this debugger issue on both Android and iOS platforms but with no luck. It would be great if you will take a look at code snippets below and let us know if work/doesn't work for you.


Both snippets work at my end and I can see content of local variables defined inside anonymous async methods.

Also it would be great if you will add full informatin about your development environment.
Comment 6 philip 2015-11-16 15:28:26 UTC
This is happening in a PCL project in my case.  Sorry I should have mentioned that.  Perhaps that is why you can't duplicated it?

There was another bug which caused breakpoints in PCL project async methods to not work and I wonder if this is related.
Comment 7 Oleg Demchenko 2015-11-16 15:58:43 UTC
This is quite important information but even inside PCL I can't make it *not* work. Could you please provide us with sample code.

Yes  there was a bug that break point was not hit in PCL from iOS. But as I understood now it happens for Android app and only in async methods.
Comment 8 philip 2015-11-16 16:06:17 UTC
Since it appears to be difficult to reproduce, it will probably be time consuming to create a sample that shows this bug (since I cannot send you my proprietary app).  I won't have time to do that now.  So I will just have to cross my fingers and see if the problem goes away with the next release :(
Comment 9 Cody Beyer (MSFT) 2015-11-16 22:25:03 UTC
### Description

The following sample app demonstrates an issue where can not inspect the values of variables upon hitting a breakpoint in an async block

### Sample


### Screenshots

Variable Value VS 2015 Xamarin RC3: https://db.tt/f4uBaLpF

Local value VS 2015 Xamarin RC3: https://db.tt/3qyCBMS1

Variable Value XS RC3 Mac: https://db.tt/dPSwcVIT

### Steps to Reproduce

1. Download sample and open on VS2015
2. Ensure breakpoint set at line 23 of Page1.xaml.cs
3. Deploy to Android
4. Click "Hey"
5. View tooltip value of "myMessage" within Async block
6. Observe value of myMessage in Locals pad

### Expected Results

The variable details should be fully present, in both the tooltip and locals

### Actual Results

Tooltip reports Unknown Identifier, Locals reports "?"

### Versions

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Professional

Visual Basic 2015   00322-40000-00000-AA453
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA453
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA453
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-40000-00000-AA453
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA453
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23309.00 d14oob
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (4a80730)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (81fb408)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (2edcbef)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 10 Cody Beyer (MSFT) 2015-11-16 22:45:53 UTC
It should be noted, that I was also able to reproduce this bug running Cycle 5 Service Release 5. More research may be needed to fully analyze the regression status.
Comment 11 philip 2015-11-24 07:57:00 UTC
This still happens in Stable Release: XamarinVS 4.0, Xamarin 4 Feature Release [Cycle 6]

This is a major defect so can it be upgraded to high priority?  Not being able to debug properly with a stable release is pretty sad.
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 13:38:11 UTC
It seems like either:

(a) Cody's tentative regression assessment in Comment 10 is inaccurate for some users.


(b) This is a regression introduced in Cycle 5 Service Release 5 (Stable on November 10) (that has carried over into Xamarin 4).

This ambiguity of regression status is one reason other confirmed regressions have been investigated.

I will add this bug to the list of items for which I am performing additional house-keeping for Cycle 6 Service Release 1. I will attempt to eliminate the ambiguity between (a) and (b).
Comment 13 Joaquin Jares 2015-11-30 19:01:29 UTC
Created attachment 14042 [details]
Locals fixed
Comment 14 Joaquin Jares 2015-11-30 19:03:58 UTC
Locals are now working. I'm still working on the variable values.
Comment 15 Joaquin Jares 2015-11-30 19:24:22 UTC
I tried reproing in XS in Windows with Cody's solution and it has the same behavior (which would potentially point to Runtime). Can Brendan or Cody confirm? Talking with XS/Runtime meanwhile to figure it out.
Comment 16 Joaquin Jares 2015-12-01 19:42:12 UTC
Root cause for variable inspection is an incompatibility between mono debug and Roslyn I have corrected in mono. I will upgrade our debugger to use that and then mark as fixed.
Comment 17 xamarin-release-manager 2015-12-01 20:39:50 UTC
Fixed in version (master)

Author: Daniel Cazzulino
Commit: 685c4c7b1f38cf639b4926810611ce6a8e6313c3 (xamarin/XamarinVS)
Comment 18 Arpit Jha 2015-12-11 06:38:53 UTC
Reproduce Status : Reproduced

I have checked this issue with Xamarin.VisualStudio_4.0.0.1698_33468dc2f71de2300bd5b5187ecda60537412e71.msi and able to reproduce this issue with the help of attached project  in comment https://bugzilla.xamarin.com/show_bug.cgi?id=35858#c9

Observation: Tooltip displays Unknown Identifier for variable in async method

Screencast : http://www.screencast.com/t/d9vw9TLWS

Verify Status : Verified

I have checked the same with latest XVS master  Xamarin.VisualStudio_99.0.0.839_ab599dd68730cbc73e77ab84da7bd6e4c6a4e331.msi and observed  that now tool tip display the actual value of that variable in async method.

Screencast : http://www.screencast.com/t/DJbigg5t

Environment Info: https://gist.github.com/saurabh360/98cb93e716bea0d6118f

As per bug milestone,  I ll check it once when fixed merge in C6SR1 and will close the issue
Comment 19 Parmendra Kumar 2015-12-17 15:03:08 UTC
I have checked this issue with C6SR1 and its working fine.

Screencast: http://www.screencast.com/t/At0xrrKtt

Environment info: https://gist.github.com/Parmendrak/4f6e0a87be2ca2ed306b
Comment 20 Rod Sanford 2017-02-17 16:49:43 UTC
I have 're-found' this issue with latest Xamarin.Forms and Visual Studio 2015 Update 3.

Seems to only affect UWP apps (I am able to evaluate and debug all locals properly in iOS).

Most locals are just showing a blank name in the locals window, but with proper values.  When trying to QuickWatch the variable, I get a CS0103 The name 'xxx' does not exist in the current context.  Watch window reflects the same error as QuickWatch.

Xamarin -
Comment 21 Brendan Zagaeski (Xamarin Team, assistant) 2017-02-17 16:55:44 UTC
This exact bug report has been marked as verified for over 1 year and can be considered closed at this time.  For any appearances of similar issues in versions higher than Cycle 6 SR 1 (XamarinVS, please file new bug reports and be sure to include as many details [1] as possible.  Thanks in advance!

[1] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/