locked
App crashes when adding a SettingsFlyout event handler RRS feed

  • Question

  • That's the HTML file for my SettingsFlyout:

    <!DOCTYPE HTML>
    <html>
    <head>
        <title>User settings</title>
        <link rel="stylesheet" href="/css/default.css" />
        <script src="/js/user_settings.js"></script>
    </head>
    <body>
    
        <script>
    
            function beforeShowHandler(event) {
            }
        </script>
    
        <!-- BEGINTEMPLATE: Template code for an empty Settings Flyout. -->
        <!-- Each settings flyout should be defined in its own HTML file. -->
        <!-- Set the width to 'narrow' for a narrow settings flyout. -->
        <!-- Set the background color for the header to the background color defined for your
                 app tile in the manifest. -->
        <div id="userSettingsDiv" data-win-control="WinJS.UI.SettingsFlyout" aria-label="App defaults settings flyout"
            data-win-options="{width:'wide',onbeforeshow:beforeShowHandler}">
            <div class="win-header" style="background-color: #dbf9ff">
                <button type="button" onclick="WinJS.UI.SettingsFlyout.show()" class="win-backbutton"></button>
    
                <div class="win-label">User account</div>
            </div>
            <div class="win-content">
                Your API user key:
                <input type="text" readonly="readonly" id="txtApiUserKey" />
                <br />
                <button id="btnRequestUserKey">Request new one</button>
    
                <div id="divRequestUserKey">
                    <hr />
                    Username:
                    <input type="text" size="20" id="txtUsername" />
                    Password:
                    <input type="password" size="20" id="txtPassword" />
    
                </div>
    
            </div>
        </div>
        <!-- ENDTEMPLATE -->
    
        
    </body>
    </html>

    If I remove the event handler, the app won't crash anymore:

    <div id="userSettingsDiv" data-win-control="WinJS.UI.SettingsFlyout" aria-label="App defaults settings flyout"
            data-win-options="{width:'wide'}">

    The debug output:

    'WWAHost.exe': Loaded 'C:\Windows\System32\WWAHost.exe', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file.
    SHIMVIEW: ShimInfo(Complete)
    'WWAHost.exe': Loaded 'C:\Windows\System32\combase.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\WinTypes.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\SHCore.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\BCP47Langs.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\iertutil.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\mshtml.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\urlmon.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\twinapi.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\rometadata.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\dui70.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\bcryptprimitives.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file.
    The thread 'Win64 Thread' (0xd60) has exited with code 0 (0x0).
    'WWAHost.exe': Loaded 'C:\Windows\System32\MrmCoreR.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\cryptsp.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\rsaenh.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\actxprxy.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\Windows.UI.Immersive.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\Windows.UI.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\ninput.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\UIAutomationCore.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.8400.0_none_182afe5a34b633d1\comctl32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Unloaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.8400.0_none_182afe5a34b633d1\comctl32.dll'
    'WWAHost.exe': Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.8400.0_none_182afe5a34b633d1\comctl32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Unloaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.8400.0_none_182afe5a34b633d1\comctl32.dll'
    'WWAHost.exe': Loaded 'C:\Windows\System32\secur32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\msimtf.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\dcomp.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\d2d1.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\DWrite.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\dxgi.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\dxgidebug.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\d3d11.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\d3d10warp.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\oleacc.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\WwaApi.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Program Files\Common Files\microsoft shared\VS7Debug\pdm.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Program Files\Common Files\microsoft shared\VS7Debug\msdbg2.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\wininet.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\jscript9.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'ImageAtBase0x36b0000', Loading disabled by Include/Exclude setting.
    'WWAHost.exe': Loaded 'ImageAtBase0x36d0000', Loading disabled by Include/Exclude setting.
    'WWAHost.exe': Loaded 'ImageAtBase0x29a0000', Loading disabled by Include/Exclude setting.
    'WWAHost.exe': Loaded 'C:\Windows\System32\Windows.Storage.ApplicationData.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'ImageAtBase0x38f0000', Loading disabled by Include/Exclude setting.
    'WWAHost.exe': Loaded 'C:\Windows\System32\bcrypt.dll', Cannot find or open the PDB file.
    'WWAHost.exe': Loaded 'C:\Windows\System32\sxs.dll', Cannot find or open the PDB file.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cb6a0.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cba60.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cc120.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cc7f0.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cce70.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cd510.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cdb90.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7ce260.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7ce8e0.
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: Microsoft C++ exception: Js::JavascriptExceptionObject * __ptr64 at memory location 0x000000837f7cef50.
    'WWAHost.exe': Loaded 'C:\Windows\System32\msls31.dll', Cannot find or open the PDB file.
    The thread 'Win64 Thread' (0x12a8) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x34) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x11bc) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0xb7c) has exited with code 0 (0x0).
    First-chance exception at 0x000007ffd0a8decc in WWAHost.exe: 0x40080201: WinRT originate error.
    'WWAHost.exe': Unloaded 'C:\Windows\System32\WwaApi.dll'
    The thread 'Win64 Thread' (0x1b04) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x1604) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x7e0) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x1884) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0xcc4) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x1248) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x1af4) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0xa54) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x19a4) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x1a08) has exited with code 0 (0x0).
    DXGI WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Producer at 0x000000837EAA5388, Refcount: 5. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: 	Live Object at 0x000000837EAA86F0, Refcount: 4. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live                         Object :      1 [ STATE_CREATION WARNING #0: ]
    The thread 'Win64 Thread' (0x1b08) has exited with code -1073741749 (0xc000004b).
    The thread 'Win64 Thread' (0x1be0) has exited with code 0 (0x0).
    The thread 'Win64 Thread' (0x1820) has exited with code 0 (0x0).
    The program '[3508] WWAHost.exe: Native' has exited with code 0 (0x0).
    

     Thanks in advance!

    Thursday, June 14, 2012 12:18 PM

Answers

All replies

  • Do not use inline script for Metro style apps.  Put your handler in your JS file.  Be aware of scoping issues as well, if it is in an anonymous function you should expose it using WinJS.Namespace.Define...

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, June 14, 2012 1:45 PM
    Moderator
  • Thanks for your answer. But my app still crashes with this JS (included via <script>):

    (function () {
        "use strict";
    
    
        function onBeforeShow(event) {
            console.log("Hello World!");
        }
    
        WinJS.Namespace.define("UserSettingsUI", { beforeShowHandler: onBeforeShow });
    
    })();
    
    // My DIV
    
    <div id="userSettingsDiv" data-win-control="WinJS.UI.SettingsFlyout" aria-label="App defaults settings flyout"
            data-win-options="{width:'wide',onbeforeshow:UserSettingsUI.beforeShowHandler}">

    PS: The ApplicationSettings example also uses inline scripts so I thought this is the way to go.

    Thursday, June 14, 2012 2:01 PM
  • Thanks PCF,

    Thanks for the repro code.  I will give this a go locally and see what is going on.

    You should always separate your code from the HTML.  If you do not you cannot take advantage of ByteCode cacheing:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh849088.aspx

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, June 14, 2012 2:04 PM
    Moderator
  • Hi PCF,

    Got it...  The key was looking at the Output window when the exception was thrown.

    Add this to your code:

     onBeforeShow.supportedForProcessing = true;

    Ref: http://msdn.microsoft.com/en-us/library/windows/apps/Hh967820.aspx

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, June 14, 2012 2:15 PM
    Moderator
  • @jpsanders - I ran into a similar issue today, so my question is "why" do I need to say that my function / event handler is supported for processing?

    The sample app that I downloaded "App Settings Sample" does not set supportedForProcessing = true on the handlers defined in that sample, so I am curious what is likely different about my application, thus requiring me to set this option to true?

    The code that I want to execute in the onbeforeshow event handler is located in my own JS module... so my data-win-options of my SettingsFlyout look similar to this:

    data-win-options="{width:'wide', onbeforeshow:BDS.Plugins.TemplatePlugin.loadSettings(), onbeforehide:BDS.Plugins.TemplatePlugin.saveSettings()}"


    Monday, July 2, 2012 8:47 PM
  • Hi Dog,

    Most of the samples don't declare strict processing: http://msdn.microsoft.com/en-us/library/windows/apps/Hh987021.aspx (which is why you would need to add this).

    The templates and your code should!

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 3, 2012 1:36 PM
    Moderator