locked
Windows Phone Signing Error about WebBrowser Control RRS feed

  • Question

  • I'm using Windows Phone 7.5 (second Mango Beta) with the Signin control.  I've dropped the control on the page, registered an application that is set as a mobile app, and set the RedirectUri, ClientID, the initial scopes, the branding, and a few other fields. When I click on the control while the application is running I get the following error from the Sign In control:

    "You cannot call WebBrowser methods until it is in the visual tree."

    I'm assuming that the control is trying to open an instance of the web browser control and tries to do something with it before it is loaded.  (I'm not hosting the web browser control myself).  Is this a bug or is there something that I need to do to prevent this.?

    Stack Trace:

       at Microsoft.Phone.Controls.WebBrowserDisconnected.NavigateCustom(Uri uri, Byte[] postData, String pszHeaders)
       at Microsoft.Phone.Controls.WebBrowser.Navigate(Uri uri, Byte[] postData, String additionalHeaders)
       at Microsoft.Phone.Controls.WebBrowser.Navigate(Uri uri)
       at Microsoft.Live.LoginPage.OnLoaded(Object sender, RoutedEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

     


    Joel Ivory Johnson | http://www.j2i.net | Windows Phone Developer MVP
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Tuesday, September 20, 2011 3:39 AM

Answers

  • Either, way it would be great if you could place a ZIP file of the smallest reproducible version of this problem online somewhere (SkyDrive?) and so we could take a look at it. 

     

    When I started to do this I had a realization on what was causing the problem. In my standalone project things worked fine. In examining the differences I remembered the application in which I was testing this functionality had been posted in the Marketplace and thus I had appropriately reduced the permissions it was requesting in the manifest. Since the SignIn control is using the WebBrowser component it is necessary to include the ID_CAP_WEBBROWSERCOMPONENT permission and ID_CAP_NETWORKING permission  in the manifest (which I had removed since the application wasn't using the browser). After adding those and recompiling the program it worked!

    In retrospect had I been thinking I would have used Marketplace Test Kit so that I knew what permissions were needed. 

    Thanks for the assistance!


    Joel Ivory Johnson | http://www.j2i.net | Windows Phone Developer MVP
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Tuesday, September 20, 2011 6:31 PM

All replies

  • I'm using Windows Phone 7.5 (second Mango Beta) with the Signin control.  I've dropped the control on the page, registered an application that is set as a mobile app, and set the RedirectUri, ClientID, the initial scopes, the branding, and a few other fields. When I click on the control while the application is running I get the following error from the Sign In control:

    "You cannot call WebBrowser methods until it is in the visual tree."

    I'm assuming that the control is trying to open an instance of the web browser control and tries to do something with it before it is loaded.  (I'm not hosting the web browser control myself).  Is this a bug or is there something that I need to do to prevent this.?

    Stack Trace:

       at Microsoft.Phone.Controls.WebBrowserDisconnected.NavigateCustom(Uri uri, Byte[] postData, String pszHeaders)
       at Microsoft.Phone.Controls.WebBrowser.Navigate(Uri uri, Byte[] postData, String additionalHeaders)
       at Microsoft.Phone.Controls.WebBrowser.Navigate(Uri uri)
       at Microsoft.Live.LoginPage.OnLoaded(Object sender, RoutedEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

     


    Joel Ivory Johnson | http://www.j2i.net | Windows Phone Developer MVP
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.

    We have not encountered this problem in our test labs. Does this problem occur when in the emulator as well as on your device or only on your device? Given that you are using a beta tools, this could be a bug in the emulator so are you able to confirm the problem reproduces us released versions of the tools?

    Either, way it would be great if you could place a ZIP file of the smallest reproducible version of this problem online somewhere (SkyDrive?) and so we could take a look at it. 

    Thanks. 


    Tuesday, September 20, 2011 4:52 PM
  • Please install the RC version of the developer tools from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27153
    Shelly Guo - MSFT
    Tuesday, September 20, 2011 5:08 PM
  • Either, way it would be great if you could place a ZIP file of the smallest reproducible version of this problem online somewhere (SkyDrive?) and so we could take a look at it. 

     

    When I started to do this I had a realization on what was causing the problem. In my standalone project things worked fine. In examining the differences I remembered the application in which I was testing this functionality had been posted in the Marketplace and thus I had appropriately reduced the permissions it was requesting in the manifest. Since the SignIn control is using the WebBrowser component it is necessary to include the ID_CAP_WEBBROWSERCOMPONENT permission and ID_CAP_NETWORKING permission  in the manifest (which I had removed since the application wasn't using the browser). After adding those and recompiling the program it worked!

    In retrospect had I been thinking I would have used Marketplace Test Kit so that I knew what permissions were needed. 

    Thanks for the assistance!


    Joel Ivory Johnson | http://www.j2i.net | Windows Phone Developer MVP
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Tuesday, September 20, 2011 6:31 PM
  • Thanks Joel! I will work with our documentation folks to ensure this is captures in our documentation.

    Thanks

    Deepesh


    Wednesday, September 21, 2011 12:51 AM