Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Unable to discover new string resource (or other xml defined resources) in Intellisense after building #1287
This issue appears to be a regression in d15-6, so I will be adding it to the 15.6 milestone. However, I am not sure if it is related to the managed resource parser changes that have been re-enabled there.
Steps to Reproduce
Newly added string and other xml resources can be discovered via Intellisense immediately after completing a build.
Intellisense does not work for a new string resource after building.
VS 15.6 Preview 4:
Diagnostic build output:
Sorry about that, here's the binlog for the DesignTimeBuild which occurred immediately after an explicit build:
This also affects newly added elements in Layout files as well. For example, if you open a layout file in the designer and either add a new layout element via code or by dragging a widget on to the designer, intellisense seemingly never kicks in until the entire solution is reloaded. This seems somewhat nasty.
Additionally, new compilation issues will surface if you attempt to reference a resource that does not exist. Not only will you receive an error for the element that does not exist, but new errors will be reported for the previously added and referenced resources which do exist.
Here's a slightly modified version of the steps in the description which demonstrate this last point:
<string name="test">test</string> <string name="test2">test2</string>
var res = Resource.String.test; var res2 = Resource.String.test2;
var res3 = Resource.String.doesnotexist;
Finally if I apply the following diff to my Xamarin.Android.Common.targets file, these issues go away in 15.6. This indicates to me that all of these negative behaviors are managed resource parser related.
+ <AndroidUseManagedDesignTimeResourceGenerator Condition=" '$(AndroidUseManagedDesignTimeResourceGenerator)' == '' " >False</AndroidUseManagedDesignTimeResourceGenerator>
added a commit
Feb 16, 2018
How are we going to do that?! Create a
Or is this a sign that we should once again take a stab at fixing Bug #5870, have the IDE emit
Reviving the Generator branch should do the trick. I will rebase it tomorrow and give it a test. The code I have should work out of the box with VS, just not with VSForMac.…
On 21 February 2018 at 18:13, Jonathan Pryor ***@***.***> wrote: @dellis1972 <https://github.com/dellis1972> wrote: Looks like we need to run a target ourselves to update the design time resource designer file before intellisense will pick it up. How are we going to do *that*?! Create a FileSystemWatcher on everything in the project dir and execute the target on file changes? (Please don't do this.) Or is this a sign that we should once again take a stab at fixing Bug #5870 <https://bugzilla.xamarin.com/show_bug.cgi?id=5870>, have the IDE emit %(AndroidResource.Generator) metadata, and use the target specified in %(AndroidResource.Generator) *also* trigger a DesignTimeBuild update? Related: https://mhut.ch/journal/2015/06/30/build_time_code_ generation_msbuild Related: https://trello.com/c/W5Mgou72/4-resourcedesignercs Related: https://trello.com/c/ypQrdAQb/179-migration-to-automatic- resourcedesignercs-generation — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1287 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAxeeerfCx6Egibm2qOXyKO3bf3h-0dRks5tXFzHgaJpZM4R-5cc> .
now that I think about it. Generator won't help us here because we need to run it for both a normal build and a design time build since we don't use the same file anymore... It will help us know when a file changed in the targets though.. I'll need to figure out what to do then
ok.. I change the following code
And that fixes the design time build issue. What happens is we run
Now the problem is I don't think the the
If we did the "running the target ourselves" thing. The IDE addin would need to deal with that, not sure if they have code to handle that already (@joj might know). It would need to monitor
At the moment its looking like any fix is either going to be pain because we need IDE support to either add the
Note I also tried adding the