Bug 60881 - Android design-time intellisense prevents designer from working with support libraries other custom controls
Summary: Android design-time intellisense prevents designer from working with support ...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: unspecified
Hardware: PC Mac OS
: --- critical
Target Milestone: 15.6
Assignee: Daniel Cazzulino
Depends on:
Reported: 2017-11-27 22:11 UTC by Jérémie Laval
Modified: 2018-01-17 07:51 UTC (History)
10 users (show)

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

IDE and Designer logs for Bug 60881 (12.12 KB, application/x-zip-compressed)
2017-12-05 14:39 UTC, Gaurav Ganorkar

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 or GitHub 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 Jérémie Laval 2017-11-27 22:11:19 UTC
Design-time build generates a Resource.designer.cs file that doesn't have valid IDs because it's meant to be only useful for intellisense.

The problem is the Android Designer reads that file expecting to have valid IDs so that rendering of custom controls and notably support libraries components can work. Because the Android Designer reads from the same Roslyn context than intellisense, the design-time version of Resource.designer.cs is used and thus no custom controls/support libraries stuff can be instantiated resulting in an error message on the design surface.

What makes this especially bad is that as long as the project references the appcompat support libraries, the designer automatically tries to render *any* layout using support constructs and because of that ID problem they will *all* fail to render.
Comment 1 dean.ellis 2017-11-28 10:47:08 UTC
This is by design.. we never intended for the designative Resource.designer.cs file to contain valid ID's. Not entirely sure how to work around this one.
Comment 2 Jérémie Laval 2017-11-28 13:40:17 UTC
Yeah, if we keep it like this we need to see if/how we can instead retrieve a Roslyn context for the non design-time build so that we can retrieve the proper Resource.designer.cs

@Kzu: any idea how to do that?
Comment 3 Peter Collins 2017-11-28 15:09:48 UTC
Alternatively, could we not just copy over the full Resource.designer.cs (with the correct IDs) to the new design time cache location every time it's updated (on full build, etc)? Presumably this would fix custom control rendering as well, once Bug #60880 is resolved.
Comment 6 dean.ellis 2017-11-30 11:31:01 UTC
Looking at the build output we are hitting a problem were the .dll is causing new Java code to be generated and compiled, this also results in a new AndroidManifest.xml and .dex file. As a result the .apk is redeployed. 

I will look at fixing this. But I'm not sure we can do this for 15.6 so we might need to bump it.
Comment 7 dean.ellis 2017-11-30 11:31:44 UTC
Ignore comment 6.. wrong bug :(
Comment 8 Daniel Cazzulino 2017-11-30 19:13:01 UTC
I can suggest importing the `Microsoft.VisualStudio.LanguageServices.VisualStudioWorkspace` directly (via MEF)?
Comment 14 Gaurav Ganorkar 2017-12-07 12:43:55 UTC
I have checked this issue on the build d15svc build  - 27130.2002.d15svc
The issue is FIXED and have been Verified on the below config

Microsoft Visual Studio Enterprise 2017 d15svc
Version 15.5.0 Preview 6.0 [27130.2002.d15svc]
Microsoft .NET Framework
Version 4.7.02053

Installed Version: Enterprise

Xamarin (6575bd113)
Xamarin Designer   4.8.183 (2577c82ea)
Xamarin.Android SDK (HEAD/9cfa7836b)
Xamarin.iOS and Xamarin.Mac SDK (6857dfc)

Full Build info - 

Screencast link-

After changing the Theme to ""Theme.AppCompat" , the designer renders correctly. Hence marking this defect as Verified FIXED
Comment 15 Luis Aguilera 2018-01-16 23:37:36 UTC
@gaurav, please re-test this with 15.6 builds... in d15svc (aka 15.5.3 and 15.5.5) the Android DTB feature is disabled, hence this problem does not occur. In 15.6 however, the feature has been re-enabled, and we need to make sure that this is fixed correctly therein.
Comment 16 Gaurav Ganorkar 2018-01-17 07:51:11 UTC
Hello Luis,

I have verified this issue again on 15.6 Preview 2 builds and Issue seems to be Fixed there too. Verified on Below builds 

Microsoft Visual Studio Enterprise 2017 d15.6stg
Version 15.6.0 Preview 3.0 [27308.9000.merge]
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Enterprise

Xamarin (7bd7821d7)
Xamarin Designer   4.10.40 (1f43fcf56)
Xamarin.Android SDK (HEAD/af4c56a1a)
Xamarin.iOS and Xamarin.Mac SDK (eaff169)

Full Build info-

Screencast link-