locked
MobileBroadbandAccount.CreateFromNetworkAccountId() throws exception unexpectedly

    Question

  • I work on a team that develops a Metro-style mobile broadband application, and today one of our users started seeing behavior we haven't ever seen before.

    Basically, the MobileBroadbandAccount.AvailableNetworkAccountIds property returns (as we'd expect) a single account ID; but when we call MobileBroadbandAccount.CreateFromNetworkAccountId() with that ID, a System.Exception is thrown, and the app crashes. As recently as last night (3/31), our app was working exactly as expected with the SIM card in the device. It's only today (4/1) that the problem started occurring. According to the user, there is no change in the device (i.e. same SIM card is in place), no system updates, and no new apps installed between yesterday and today.

    The exception itself has no useful message or other info (other than stack trace). Per the documentation for AvailableNetworkAccountIds, if there were an issue with the app not having access to the mobile broadband device, then AvailableNetworkAccountIds should simply return an empty list (or worst-case, the CreateFromNetworkAccountId() should throw a more useful exception).

    Obviously we will need to add more exception handling, but we have been developing this app for nearly a year, and it has been live since Windows 8 was released, and this is the first and only time we've seen this behavior, so I think there is something new/unusual going on. Would greatly appreciate any help or insights. I've included the details of the crash event from Event Viewer below.

    Thanks,
    Andy


    App <app ID> terminated itself by calling terminateApp API. App details are as follows:
    Display Name:<app name>,
    AppUserModelId: <AppUserModelId>
    Package Identity:<package ID>
    PID:<5932>.
    The API was called from the context of the following HTML document: </default.html>.
    Error object passed to terminateApp carried the following details
    Description:<{"exception":null,"error":{"description":"System.Exception\r\n at Windows.Networking.NetworkOperators.MobileBroadbandAccount.CreateFromNetworkAccountId(String networkAccountId)\r\n <snip>","number":-2147483638,"stack":"WinRTError: System.Exception\r\n at Windows.Networking.NetworkOperators.MobileBroadbandAccount.CreateFromNetworkAccountId(String networkAccountId)\r\n <snip>\r\n at Pages_ready (ms-appx://microsoft.winjs.1.0/js/base.js:4511:30)\n at notifySuccess (ms-appx://microsoft.winjs.1.0/js/base.js:1404:22)\n at enter (ms-appx://microsoft.winjs.1.0/js/base.js:1091:22)\n at _run (ms-appx://microsoft.winjs.1.0/js/base.js:1307:18)\n at _completed (ms-appx://microsoft.winjs.1.0/js/base.js:1275:14)\n at notifySuccess (ms-appx://microsoft.winjs.1.0/js/base.js:1404:22)\n at enter (ms-appx://microsoft.winjs.1.0/js/base.js:1091:22)\n at _run (ms-appx://microsoft.winjs.1.0/js/base.js:1307:18)\n at _completed (ms-appx://microsoft.winjs.1.0/js/base.js:1275:14)"},"promise":{"_value":{"description":"System.Exception\r\n at Windows.Networking.NetworkOperators.MobileBroadbandAccount.CreateFromNetworkAccountId(String networkAccountId)\r\n <snip>","number":-2147483638,"stack":"WinRTError: System.Exception\r\n at Windows.Networking.NetworkOperators.MobileBroadbandAccount.CreateFromNetworkAccountId(String networkAccountId)\r\n <snip>\n at Pages_ready (ms-appx://microsoft.winjs.1.0/js/base.js:4511:30)\n at notifySuccess (ms-appx://microsoft.winjs.1.0/js/base.js:1404:22)\n at enter (ms-appx://microsoft.winjs.1.0/js/base.js:1091:22)\n at _run (ms-appx://microsoft.winjs.1.0/js/base.js:1307:18)\n at _completed (ms-appx://microsoft.winjs.1.0/js/base.js:1275:14)\n at notifySuccess (ms-appx://microsoft.winjs.1.0/js/base.js:1404:22)\n at enter (ms-appx://microsoft.winjs.1.0/js/base.js:1091:22)\n at _run (ms-appx://microsoft.winjs.1.0/js/base.js:1307:18)\n at _completed (ms-appx://microsoft.winjs.1.0/js/base.js:1275:14)"},"_isException":false,"_errorId":3},"id":3}>, and Stack Trace:- WinRTError: System.Exception
    at Windows.Networking.NetworkOperators.MobileBroadbandAccount.CreateFromNetworkAccountId(String networkAccountId)
    <snip>
    at Pages_ready (ms-appx://microsoft.winjs.1.0/js/base.js:4511:30)
    at notifySuccess (ms-appx://microsoft.winjs.1.0/js/base.js:1404:22)
    at enter (ms-appx://microsoft.winjs.1.0/js/base.js:1091:22)
    at _run (ms-appx://microsoft.winjs.1.0/js/base.js:1307:18)
    at _completed (ms-appx://microsoft.winjs.1.0/js/base.js:1275:14)
    at notifySuccess (ms-appx://microsoft.winjs.1.0/js/base.js:1404:22)
    at enter (ms-appx://microsoft.winjs.1.0/js/base.js:1091:22)
    at _run (ms-appx://microsoft.winjs.1.0/js/base.js:1307:18)
    at _completed (ms-appx://microsoft.winjs.1.0/js/base.js:1275:14)
    .

    Monday, April 01, 2013 10:09 PM

Answers

  • Hi there,

    So can you repro this issue on your side?

    Sometimes, when removing and re-inserting the SIM card, the app will fail, so you need to re-configure the metadata:

    1. run CMD with administrator privilege, type in bcdedit –set testsigning on , enter, make it successful
    2. Delete keys in registry, if they do not exist, skip this step, locate to  Computer\HKEY_LOCAL_MACHINE\SOFTWARE->Microsoft->WwanSvc->MobileBroadbandAccounts, delete Accounts and NetworkInterfaceBindings under MobileBroadbandAccounts
    3. delete multiloc folder in C:\ProgramData\Microsoft\Windows\DeviceMetadataCache\dmrccache, if it does not exist, skip this step.
    4. copy metadata to C:\ProgramData\Microsoft\Windows\DeviceMetadataStore\en-US
    5. wait for a short time, you will see  a folder named multiloc is generated in C:\ProgramData\Microsoft\Windows\DeviceMetadataCache\dmrccache
              and in folder multiloc, a folder same name with metadata is generated, open SoftwareInfo.xml in folder Software, make sure Identity Name,   Publisher ,Applciation Id are same with the on in metadata; if they are not, repeat step 1 to 5
     

    Regards,

    Jenny 


    • Edited by JennyLi-MSFT Friday, April 05, 2013 8:19 AM
    • Marked as answer by Aaron Xue Monday, May 06, 2013 9:06 AM
    Friday, April 05, 2013 8:18 AM

All replies

  • Hi,

    Thanks for your posting. I'll try to involve more experts in this case.


    Aaron
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 03, 2013 7:58 AM
  • Hi there,

    So can you repro this issue on your side?

    Sometimes, when removing and re-inserting the SIM card, the app will fail, so you need to re-configure the metadata:

    1. run CMD with administrator privilege, type in bcdedit –set testsigning on , enter, make it successful
    2. Delete keys in registry, if they do not exist, skip this step, locate to  Computer\HKEY_LOCAL_MACHINE\SOFTWARE->Microsoft->WwanSvc->MobileBroadbandAccounts, delete Accounts and NetworkInterfaceBindings under MobileBroadbandAccounts
    3. delete multiloc folder in C:\ProgramData\Microsoft\Windows\DeviceMetadataCache\dmrccache, if it does not exist, skip this step.
    4. copy metadata to C:\ProgramData\Microsoft\Windows\DeviceMetadataStore\en-US
    5. wait for a short time, you will see  a folder named multiloc is generated in C:\ProgramData\Microsoft\Windows\DeviceMetadataCache\dmrccache
              and in folder multiloc, a folder same name with metadata is generated, open SoftwareInfo.xml in folder Software, make sure Identity Name,   Publisher ,Applciation Id are same with the on in metadata; if they are not, repeat step 1 to 5
     

    Regards,

    Jenny 


    • Edited by JennyLi-MSFT Friday, April 05, 2013 8:19 AM
    • Marked as answer by Aaron Xue Monday, May 06, 2013 9:06 AM
    Friday, April 05, 2013 8:18 AM