Reporter | Django135 (Django135) |
---|---|
Created | Apr 22, 2018 11:31:00 PM |
Updated | Apr 22, 2018 11:36:47 PM |
Subsystem | XAML |
Assignee | Alexander Shvedov (shvedov) |
Priority | Normal |
State | Submitted |
Type | Bug |
Fix version | No Fix versions |
Affected versions | 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
Hello,
If you create a XAML snippet with the following contents:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
ControlTemplate="{StaticResource Test}"
x:Class="RSRP469281Repro.MainPage">
<ContentPage.Resources>
<ControlTemplate x:Key="Test"></ControlTemplate>
</ContentPage.Resources>
</ContentPage>
Something very strange happens... The "x:Key" attribute is highlighted (ie: part of resharper knows that it is referenced), however there is an underline in the {StaticResource Test}
under "Test" saying that Resource 'Test' not found
even though the code compiles and works fine. If you follow the quick actions shortcut and use it to create a resource in the current file it creates a duplicate tag with the same x:Key. If you remove the staticresource reference, the editor shows the "Test" resource as not being used and offers quick action of removing it.
This pattern is used a lot in XAML to create page "inheritance" where the base page defines a control template and applies it to itself so that when a child page is created that inherits from the base page, all of the child's content is rendered into the control template by the ContentPresenter tag, so this bug is a bit annoying.
Attached a screenshot of this wrong behavior. I hope this little bug could be fixed for next release :-)
Thanks a lot for Resharper.