locked
FrameSessionStateKeyProperty RRS feed

  • Question

  • Hello everyone!

    I am trying to register the root Frame in App.xaml.cs file like this :

    HelloWorld.Common.SuspensionManager.RegisterFrame(rootFrame, "appFrame");

    if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context and navigate to the first page
                    rootFrame = new Frame();
                    HelloWorld.Common.SuspensionManager.RegisterFrame(rootFrame, "appFrame");
                ...

    but when i debug the SuapensioManager.cs file throw an exception in this line of code :

     public static void RegisterFrame(Frame frame, String sessionStateKey)
            {
                if (frame.GetValue(FrameSessionStateKeyProperty) != null)
                {
                    throw new InvalidOperationException("Frames can only be registered to one session state key");
                }

     What i am doing wrong here ? 

    Thanks in advance!

    Monday, April 28, 2014 11:23 AM

Answers

  • what exception you get? this one? "Frames can only be registered to one session "

    then you are registering the frame multiple times


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Monday, April 28, 2014 12:22 PM
  • From the error you report it must be registered twice. Put a break point on RegisterFrame and you should be able to see where the unexpected registration comes from in the debugger
    Monday, April 28, 2014 1:54 PM
    Moderator

All replies

  • what exception you get? this one? "Frames can only be registered to one session "

    then you are registering the frame multiple times


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Monday, April 28, 2014 12:22 PM
  • Yes, this one , but i register it only once just like the code above
    Monday, April 28, 2014 1:49 PM
  • From the error you report it must be registered twice. Put a break point on RegisterFrame and you should be able to see where the unexpected registration comes from in the debugger
    Monday, April 28, 2014 1:54 PM
    Moderator
  • I found the error finally! It was registered twice as you said... Thank you for your help!!
    Monday, April 28, 2014 7:58 PM