Intellisense generates spurious "Index was outside the bounds of the array" in XAML bindings

  • Thread starter Thread starter Gaerlin
  • Start date Start date
G

Gaerlin

Guest
VS Community 2017 v15.7.6 (latest patch), .NET Framework 4.7

Out of the blue (tied to no change that I can determine), Intellisense has started to display numerous "Index was outside the bounds of the array" errors for all of the bound properties in a particular XAML Window. The errors seem to be false positives since everything still compiles and runs just fine, and also the same exact XAML code didn't display errors up until a few weeks ago.

Here's a sample of the XAML for which Intellisense is displaying errors:


<Window x:Class="Gaersoft.xxx.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Gaersoft.xxx"
mc:Ignorable="d"
Title="xxx"
Icon="Resources/xxx-300px.png"
Left="{Binding Source={x:Static local:App.Settings}, Path=MainWindowLeft, Mode=TwoWay}"
Top="{Binding Source={x:Static local:App.Settings}, Path=MainWindowTop, Mode=TwoWay}"
Height="{Binding Source={x:Static local:App.Settings}, Path=MainWindowHeight, Mode=TwoWay}"
Width="{Binding Source={x:Static local:App.Settings}, Path=MainWindowWidth, Mode=TwoWay}"
WindowState="{Binding Source={x:Static local:App.Settings}, Path=MainWindowMaximized, Mode=TwoWay, Converter={StaticResource boolToWindowState}}"
>

</Window>




The bindings for the "Left", "Top", Height", "Width" and "WindowState" properties are all squiggly underlined with the Intellisense error "Index was outside the bounds of the array". FYI local:App.Settings is a static property that points to Properties.Settings.Default.

I'm thinking this is just a bug/issue with Intellisense and not really indicative of any problems with my XAML. Also I realize I can get rid of the errors through suppression. However I'd just like to know why the errors started appearing and if in fact there is a problem with the XAML that I'm not realizing.

Thanks

Continue reading...
 
Back
Top