locked
Metro Developper Preview apps stops on terminateAppHandler on Release Preview RRS feed

  • Question

  • I've got an issue migrating a very simple JavaScript Grid app from VS 11/Windows 8 Developper Preview to VS 2012/Windows 8 Release Preview.

    Here the steps to reproduce issue:

    1. Create a Metro Grid app using VS 11 Grid template javascript (no need to change anything),
    2. Build it on Windows 8 Developper Preview,
    3. Run it, it works
    4. Take the same project and open it in VS 2012 on Windows 8 Release Preview,
    5. Upgrade reference as explain here: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/52b928a8-b47c-4754-871f-20c31278ea3d
    6. Upgrade all WinJS reference in HTML pages from "//Microsoft.WinJS.0.6" to "//Microsoft.WinJS.1.0.RC"
    7. Run it, it stops on terminateAppHandler in base.js

    Every app derivated from the VS 11 Grid template had the same issue. Of course, a work around is to rewrite from scratch a new app using VS 2012 template but it required rewrite lot of source code :-(

    Any way to solve this issue ?

                     

    Saturday, June 2, 2012 9:15 AM

Answers

  • In the terminateAppHandler, the 'data' argument should contain the exception information for what caused your app to fall into that handler.  The other way to diagnose these types of errors is to enable the debugger to break on first-chance exceptions.  To turn this on, go to Debug | Exceptions and check the 'Thrown' box next to JavaScript Runtime Exceptions.  If you do this and then F5 again you will get an exception dialog at the point of the error, instead of having it fall through to the global app handler.

    In the case of moving a CP app to RP, you are mostly likely hitting the breaking change that removed 'getForCurrentView'.  Replace this line:

    appView.getForCurrentView().onviewstatechanged = this._viewstatechanged.bind(this);

    with:

    window.onresize = this._viewstatechanged.bind(this);

    Personally, I found it easier to create new projects with the base template my app most closely matched, and then ported only my code over to it from the CP-based project.  However, if you don't want to start from the newer templates, which have changed quite a bit since CP, you should make sure you read through the breaking changes list linked to at http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/d573295e-926f-4a03-a158-19d4b53521f8. 

    Hope that helps!

    ~Gearard


    This posting is provided "AS IS" with no warranties, and confers no rights.


    Monday, June 4, 2012 3:33 AM

All replies

  • In the terminateAppHandler, the 'data' argument should contain the exception information for what caused your app to fall into that handler.  The other way to diagnose these types of errors is to enable the debugger to break on first-chance exceptions.  To turn this on, go to Debug | Exceptions and check the 'Thrown' box next to JavaScript Runtime Exceptions.  If you do this and then F5 again you will get an exception dialog at the point of the error, instead of having it fall through to the global app handler.

    In the case of moving a CP app to RP, you are mostly likely hitting the breaking change that removed 'getForCurrentView'.  Replace this line:

    appView.getForCurrentView().onviewstatechanged = this._viewstatechanged.bind(this);

    with:

    window.onresize = this._viewstatechanged.bind(this);

    Personally, I found it easier to create new projects with the base template my app most closely matched, and then ported only my code over to it from the CP-based project.  However, if you don't want to start from the newer templates, which have changed quite a bit since CP, you should make sure you read through the breaking changes list linked to at http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/d573295e-926f-4a03-a158-19d4b53521f8. 

    Hope that helps!

    ~Gearard


    This posting is provided "AS IS" with no warranties, and confers no rights.


    Monday, June 4, 2012 3:33 AM
  • For any reasonable complex app developed on CP/DP creating a new project based on the new templates is not an option though. The new global error handling change is a serious PITA. In my case it had nothing to do with view state changes.
    Monday, June 4, 2012 8:50 AM
  • Great: both advices works !

    Thanks a lot.

    Monday, June 4, 2012 3:36 PM