【问题标题】:Exception - "Value does not fall within the expected range.inPage.xaml"异常 - “值不在预期范围内。inPage.xaml”
【发布时间】:2015-04-09 18:53:54
【问题描述】:

我在 Windows Phone 8 上使用 MVVMCross 和异步 Sqlite.net 创建应用程序。有时,当您转到某个页面时,我会遇到异常:

System.ArgumentException: Value does not fall within the expected range.inPage.xaml'.
at System.Windows.Navigation.PageResourceContentLoader.EndLoad(IAsyncResult asyncResult)
at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)
at System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)
at System.Windows.Navigation.PageResourceContentLoader.<>c__DisplayClass4.<BeginLoad>b__0(Object args)

如何确定问题的根源?

【问题讨论】:

  • 页面资源内容加载器,我相信,负责加载资源字典。您的资源字典之一似乎有错误或错误值。
  • 这个错误很少发生。

标签: silverlight exception windows-phone-8 asynchronous mvvmcross


【解决方案1】:

也有这些错误。通常它是一个无法转换的VisualState 值。 我从my answer here复制了示例

<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="True"/>

<DiscreteObjectKeyFrame KeyTime="0:0:0">
    <DiscreteObjectKeyFrame.Value>
        <System:Boolean>True</System:Boolean>
    </DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>

因此,当您说它并非每次都发生时,它可能仅在您巧合地将鼠标悬停在某个区域上并且问题位于鼠标悬停状态定义中的某个位置时才会发生。

【讨论】:

    【解决方案2】:

    问题出在我的 xaml 中。我使用了这个用户控件:

      <UserControl>
           <controls:Pivot >
            <controls:PivotItem >
                <UserControl2/>
            </controls:PivotItem>
            <controls:PivotItem >
                <UserControl2/>
            </controls:PivotItem>
        </controls:Pivot>
    <UserControl>
    

    我删除了 Pivot,错误消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多