Bug 52605 - VS2015 does not show contents of local variables during debug of Xamarin.Form UWP app
Summary: VS2015 does not show contents of local variables during debug of Xamarin.Form...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.3
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 47951 ()
Depends on:
Blocks:
 
Reported: 2017-02-17 17:02 UTC by Rod Sanford
Modified: 2017-07-20 18:03 UTC (History)
14 users (show)

Tags: vs2015 debugger local ac uwp
Is this bug a regression?: ---
Last known good build:


Attachments
AppRepo (1.86 MB, application/x-zip-compressed)
2017-06-20 16:13 UTC, Rui Marinho
Details


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 for Bug 52605 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Rod Sanford 2017-02-17 17:02:42 UTC
Similar to original bug 35858 - VS2015 does not show contents of local variables during debug

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, for instance).

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 - 4.2.2.11-cycle8+00fa5cc
Xamarin.Forms 2.3.3.175
Comment 1 Jose Gallardo 2017-02-17 17:07:14 UTC
Moving to Forms, to get visibility from the Xamarin.Forms team.

Thanks
Comment 3 Luca 2017-03-18 13:22:45 UTC
I have this problem too in my pcl project.
It happens to me when I create a xamarin cross platform pcl project.
Debugging from android, I can see local variables in async methods.
Debugging from UWP i cannot see any local variables in async methods in pcl projects ("The name 'xxx' does not exist in the current context").
Also creating a unit test project, i cannot see any local variables in async methods in pcl projects.

After some tests, I have found whats cause the problem:
if I remove 
[XamlCompilation(XamlCompilationOptions.Compile)]
from all views inside pcl project, I can see local variables.


as workaroung i use this directive:

#if DEBUG
#else
    [XamlCompilation(XamlCompilationOptions.Compile)]
#endif

so when I compile for release, I can still use xamlcompilation, but during debug I can see local variables!
Comment 4 Kalitsov 2017-03-26 17:25:41 UTC
I could confirm the issue. Most of the local variables names are just blank, but they have the proper values set. When i try to use the QuickWatch with a variable, I get a CS0103 The name 'xxx' does not exist in the current context.
The issue affects UWP apps. 
Disabling [XamlCompilation(XamlCompilationOptions.Compile)] fixes the issue.

Visual Studio Version 4.6.01586 Update 3
Xamarin 4.3.0.789
Xamarin.Forms 2.3.3.193
Comment 5 Gerard C 2017-04-07 16:21:53 UTC
Started trying to port my XF Android App to UWP on VS2017 and running into a couple of debugging issues including this one.  

VS 2017 v15.1 (26403.0) Release
Xamarin 4.4.0.34 (3f99c5a)
Xamarin.Forms v2.3.4.224

Created a new solution using the Cross Platform App (Xamarin.Forms or Native) -> Master Detail (UI Technology = Xamarin.Forms), PCL, Host in the cloud.

All I did in the solution was create the following class:

namespace App2
{
    public class AsyncTest
    {

        public async Task HitBreakpoint()
        {
            // Breakpoint does not get hit and is listed as:
            // The breakpoint will not currently be hit. 
            // No symbols have been loaded for this document.
            var foo = 0;
            await Task.FromResult(0);
        }

    }
}

and referenced it in the boilerplate App class as follows:

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace App2
{
    public partial class App : Application
    {
        //MUST use HTTPS, neglecting to do so will result in runtime errors on iOS
        public static bool AzureNeedsSetup => AzureMobileAppUrl == "https://CONFIGURE-THIS-URL.azurewebsites.net";
        public static string AzureMobileAppUrl = "https://App220170406015956.azurewebsites.net";
        public static IDictionary<string, string> LoginParameters => null;

        public App()
        {
            InitializeComponent();

            if (AzureNeedsSetup)
                DependencyService.Register<MockDataStore>();
            else
                DependencyService.Register<AzureDataStore>();

            SetMainPage();
        }


// Made method async
        public async static void SetMainPage()
        {
// Breakpoint here gets hit sometimes
// Other times this breakpoint mysteriously moves to the UWP App.xaml.cs class
// even though I did not set a breakpoint there
            await new AsyncTest().HitBreakpoint();
            etc, etc ...

Spent a couple of days researching but remain unsuccessful.  Resorting to Debug statements for now.  Happy to help if you need more info.
Comment 6 AJZ Tangoe 2017-05-26 13:52:32 UTC
I'm having the same issue with UWP using Visual Studio 2017 (latest as of today).  Just uninstalled and reinstalled VS2017 and the problem was not resolved.  Needless to say, not being able to locals is a big issue in terms of debugging.
Comment 7 Rui Marinho 2017-06-20 16:13:52 UTC
Created attachment 23010 [details]
AppRepo
Comment 8 Rui Marinho 2017-06-20 16:14:43 UTC
I can reproduce the following on 2.3.4 on VS2017: 
All breakpoints work with xamlc on and off..

The only difference i can see is on the locals tab, with xamlc OFF i can see foo and bar as locals, with xamlc ON i can only the bar variable and not the foo one.
Comment 9 Rui Marinho 2017-06-20 18:08:33 UTC
*** Bug 47951 has been marked as a duplicate of this bug. ***
Comment 10 Sandip Ahluwalia 2017-07-17 15:31:14 UTC
I seeing in the same issue when debugging UWP app in a Xamarin Forms solution. I using 

Xamarin.Forms version=2.3.3.193
Visual Studio 2017 version 15.2 (26430.14)

Issue seems to happen when debugging async functions and I had no XamlCompilation attribute defined in any of my views. However, as I was using a Xamarin Forms Prism template solution, then the workaround was to remove XamlCompilation from the AssemblyInfo.cs file.