Bug 60730 - Intellisense for XML in an .AXML file missing some properties/attributes until AXML file reloaded.
Summary: Intellisense for XML in an .AXML file missing some properties/attributes unti...
Status: CONFIRMED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android Designer ()
Version: 4.5.0 (15.2)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-16 20:16 UTC by Jon Goldberger [MSFT]
Modified: 2017-11-17 19:47 UTC (History)
4 users (show)

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

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 60730 on Developer Community 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
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.
Related Links:
Status:
CONFIRMED

Description Jon Goldberger [MSFT] 2017-11-16 20:16:40 UTC
## Description

Intellisense does not pick up certain RelativeLayout.LayoutParams, like android:alignParent* relative layout params, when editing .AXML files in the Designer Source tab. 


## Steps to reproduce

1. Open Visual Studio 2017 

2. Create a new Android Single View app solution

3. Open Main.axml in the Designer and switch to the Source tab

4. Change the LinearLayout to a RelativeLayout. This should make the RelativeLayout.LayoutParams available on child views of the RelativeLayout.

5. Delete the android:orientation="vertical" attribute form the RelativeLayout (no longer applicable)

6. try adding an android:layout_alignParentRight-"true" to the Button element.

Expected result: As I type the above, intellisense should offer me the  android:layout_alignParentRight completion and once typed in, attribute should not be underlined (unresolved by intellisense)

Actual result: android:layout_alignParentRight (nor any layout_alignParentXXXX) attribute is not offered by intellisense and attribute is underlined indicating attribute is not resolved. 

7. delete the android:layout_alignParentRight-"true" attribute

8. Switch to the Design tab and then switch back to the Source tab.

9. again try adding an android:layout_alignParentRight-"true" to the Button element.

Expected result: As I type the above, intellisense should offer me the  android:layout_alignParentRight completion and once typed in, attribute should not be underlined (unresolved by intellisense)

Actual result: As expected.


## Notes
I noted that the android-layout-xml.xsd and schemas.android.com.apk.res.android.xsd files in the obj/Debug/Schemas folder did not have entries for the android:layout_alignParentXXXX attributes initially, but after step 8 above, then they did have those entries.

This problem was reported by a customer who sent in a test project that demonstrated this issue. In that test project (awaiting permission to post it to this bug report) I had a heck of a time trying to get the intellisense to pick up those RelativeLayout.LayoutParams. They have three layouts on their test project, two of which have RelativeLayouts and LinearLayouts in them. All of the RelativeLayout.LayoutParams are underlined as unresolved and intellisense auto-complete does not offer any of those layout params when trying to add them to child views of the RelativeLayout. This test project was also used to demonstrate the issue reported in bug #60706, but I could easily reproduce that bug with a new project. As such the project had three layout folders, "layout-land", "layout-sw600dp-land", and "layout-sw720dp-land". Not having a default "layout" folder seemed to be part of the issue. The only way I could get intellisense/autocomplete to work for the RelativeLayout.LayoutParams in that project was to do the following complex set of steps:

1. Delete the hidden .vs folder which is in the same folder as the Solution (.sln) file. 
2. Go into the Android app project folder and delete the “Apptest.csproj.user” file and the “bin” and “obj” folders.
3. Go back to the solution folder and open the solution.
4. Close all layout files (if any are open).
5. Delete the WO.axml layout file that is in the layout-sw-600dp-land folder (to avoid any rendering issues from having the layout file in three alternate layout folders, i.e. bug #60706)
6. Create a “layout” folder in the Resources folder (I think you should always have this default folder)
7. Copy all of your layouts from the layout-land folder to the layout folder you just created. (for a more normal structure… this may not be necessary but I did it the one time I actually got this to work.)
8. Create a new layout file from template in the layout folder
9. In Designer tab add a button to the layout
10. Go to the source tab and change the LinearLayout to a RelativeLayout
11. Delete the android:orientation in the RelativeLayout
12. Save, Close and re-open the file
13. Add an android:layout_alignParentRight=”true” attribute to the Button. You should have intellisense now in this file, but not in the others.
14. Save the file, but keep it open.
15. Close Visual Studio
16. Delete the “bin” and “obj” folders again.
17. Open the solution again.
18. Close the layout file (it is not open in the designer anyway at this point).
19. At this point I am getting intellisense in all of the files. If you don’t at first, try closing and re-opening the layout files.

However even the above appears not to be stable and issue recurs after closing and reopening the solution, or even when opening one of the original AXML files (with both the Linear and relativeLayouts) so I am unable to find a stable workaround for this project. What is consistent is that the android-layout-xml.xsd and schemas.android.com.apk.res.android.xsd files in the obj/Debug/Schemas folder get updated depending on the last AXML file loaded. IOW when I open the newly created layout file in step 8 above, those files are updated and the issue goes away, but if I then open the WO.axml file then the issue recurs, so it would seem to be some issue as to when those schema files get generated and why it does not generate RelativeLayout.LayoutParams into the schema files even when there is a RelativeLayout in the layout that is opened. 



## Environment

JDK 64 bit 1.8.0_121
Android SDK Tools 25.2.5
Android SDK Platform Tools 26.0.2
Android SDK build Tools 26.0.0

Microsoft Visual Studio Enterprise 2017 
Version 15.4.3
VisualStudio.15.Release/15.4.3+27004.2008
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00369-90253-02232-AA699
Microsoft Architecture Diagrams and Analysis Tools

Visual Basic 2017   00369-90253-02232-AA699
Microsoft Visual Basic 2017

Visual C# 2017   00369-90253-02232-AA699
Microsoft Visual C# 2017

Visual C++ 2017   00369-90253-02232-AA699
Microsoft Visual C++ 2017

Visual F# 4.1   00369-90253-02232-AA699
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.9.00809.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30925.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2012   4.0.20601.0
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2017   5.2.50921.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30915.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.3.0000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Data Lake Tools for Visual Studio   2.3.0000.0
Microsoft Azure Data Lake Tools for Visual Studio

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

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure HDInsight Azure Node   2.2.8000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.3.0000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   1.8
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.3.0000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50719.1

Microsoft Continuous Delivery Tools for Visual Studio   0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   4.7.4-pre (c2d89eb)
Support for debugging Mono processes with Visual Studio.

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

SQL Server Data Tools   15.1.61707.200
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   2.3.5.0
TypeScript tools for Visual Studio

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Universal Windows Apps   15.0.27004.2008
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.

VisualStudio.IoT   1.0
Package with IoT components for Visual Studio

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

WebJobs Tools v1.0.0   15.0.30923.0
WebJobs Tools v1.0.0

Xamarin   4.7.10.38 (34c1b6c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   8.0.2.1 (HEAD/c2a33d8ea)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.3.0.47 (51128b8)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.