【问题标题】:Windows Phone 7-System.ArgumentOutOfRangeExceptionWindows Phone 7-System.ArgumentOutOfRangeException
【发布时间】:2012-10-22 20:38:44
【问题描述】:

每个人。 我正在为 win7 手机开发一个应用程序,但导航有一些问题。我有一张全景图和 两个枢轴控制。当我导航到第一个枢轴时,全景控件是 MainPage 控制并做一些工作,我可以回到 MainPage 然后毫无问题地退出应用程序。 但是,当我在第二个枢轴控件中执行某些工作时,我无法返回 MainPage。 我正在导航 MainPage-->FirstPivot"Back button"-->MainPage-->SecondPivot"Back button"-->MainPage。我可以看到我正在进入 MainPage, 但随后应用程序崩溃了。在输出窗口中,我可以看到这个异常:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurr*emphasized text*ed in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
'taskhost.exe' (Managed): Loaded 'System.SR.dll'
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll

【问题讨论】:

    标签: windows-phone-7


    【解决方案1】:

    您在问题中没有提供足够的细节来回答它,但是,听起来您在维护状态的位置以及可能的墓碑实施方面存在问题。我建议您阅读这篇文章,并根据所描述的技术制定您的解决方案:

    http://www.scottlogic.co.uk/blog/colin/2011/05/a-simple-windows-phone-7-mvvm-tombstoning-example/

    【讨论】:

    • 感谢您的回复,我还需要提供什么信息?当我在右击“返回”按钮后进入 MainPage 时应用程序崩溃:protected override void OnNavigatedTo(NavigationEventArgs e) { //right here base.OnNavigatedTo(e);没有例外
    【解决方案2】:

    当我尝试将两个 UIElement 绑定到两个不同的容器时遇到此错误。

    (实际上 UIElement 是一个 UserControl(部分类)。我有另一个名为相同和部分的类,这引起了误解 :)

    在 silverlight 中,您可以从容器中移除一个元素并将其添加到另一个容器中。

    但你不能将一个 UIElement 添加到两个不同的容器中。

    但是由于 Colin 所说的错误消息不是很清楚,其他原因会导致此错误。 我在您的堆栈中看到以下错误。如果存在,您可以检查部分独立存储的使用情况。

    在 System.Windows.dll 中出现*强调文本* 和 System.IO.IsolatedStorage.IsolatedStorageException'发生了

    希望有帮助

    【讨论】:

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