4

I've run across an annoying error in my Windows Phone 8.1 Runtime app. The error occurs where I defined my CommandBar on my page. That bar has been there almost since the creation of the app, but now the designer decided to make it an error. It reports the error as "Value does not fall within the expected range". Here is the code:

<Page.BottomAppBar>
    <!-- ERROR STARTS HERE --><CommandBar x:Name="ButtonBar" Background="{StaticResource StrikeDistanceThemeBrush}" Foreground="{StaticResource StrikeDistanceForegroundBrush}" BorderBrush="White">
        <CommandBar.SecondaryCommands>
            <AppBarButton x:Name="SettingsButton" Label="settings" Click="SettingsButton_Click"/>
            <AppBarButton x:Name="AboutButton" Label="about" Click="AboutButton_Click"/>
            <AppBarButton x:Name="AppsButton" Label="more apps"/>
            <AppBarButton x:Name="RateButton" Label="rate+review"/>
        </CommandBar.SecondaryCommands>
        <AppBarButton x:Name="CalculateButton" Label="calculate" Click="CalculateButton_Click" Icon="Calculator"/>
        <AppBarButton x:Name="ClearAllButton" Icon="Clear" Label="clear all" Click="ClearAllButton_Click"/>
        <AppBarButton x:Name="HelpButton" Icon="Help" Label="help"/>
    </CommandBar><!-- ERROR ENDS HERE -->
</Page.BottomAppBar>

Also, the CommandBar does appear while debugging the app, except elements that typically get nudged up (such as my AdDuplex control) don't get moved. So far, these things haven't resolved the problem:

  • Visual Studio restart
  • Computer restart
  • Creating a new CommandBar

Thanks for your help!

Greg Whatley
  • 1,020
  • 1
  • 13
  • 32
  • It could be a number of reasons. I would recreate the command bar from scratch, slowly adding each button one at a time until you can narrow down what exactly is causing the error. – Decade Moon Oct 25 '14 at 12:20
  • I have, it starts immediately after ` .. `. – Greg Whatley Oct 25 '14 at 14:56
  • Ok, so you're saying that all that is required to reproduce the error is to have *exactly this XAML only*: ``? – Decade Moon Oct 26 '14 at 04:14
  • You're exactly right. – Greg Whatley Oct 26 '14 at 11:42
  • That's really weird. I've had similar cryptic XAML designer errors in the past but I don't remember what solved them. Does the designer not show at all, except for an error message? Is there a stack trace? Have you looked [here](https://social.msdn.microsoft.com/Forums/windows/en-US/8fe36d87-c432-47e7-9303-9b4e8707ae9e/value-does-not-fall-within-the-expected-range-design-view-settings-file-error?forum=winformsdesigner)? Try deleting *.suo, *.settings and other files that are recreatable by VS, then restart VS (backup solution first). – Decade Moon Oct 26 '14 at 12:05
  • I'm not sure why, but there aren't any files with .suo, .settings, or any of the extensions listed in the thread you linked. To answer your other questions, the designer loads correctly (except for the error message), and there is no stack trace. – Greg Whatley Oct 26 '14 at 12:37
  • I've got the same error with an app I am currently working on. I have no idea yet why that error occours. – Daniel Steiner Oct 30 '14 at 17:53

1 Answers1

0

Dunno if this will help you or if you've already tried, but you can delete the Visual Studio shadow cache. I use this trick whenever I've tried everything else with no success.

The shadow cache is located here:

%LOCALAPPDATA%\Microsoft\VisualStudio\12.0[this number will change depending on your Visual Studio version]\Designer\ShadowCache

Close Visual Studio, delete everything from this folder then restart Visual Studio. I created a handy little batch file that I can execute to save time.

Hope this helps.

John Murphy
  • 905
  • 1
  • 10
  • 26