none
Exception in veapicore.js when using the Bing Maps SDK for Javascript in Windows Store apps RRS feed

  • Question

  • Hi,

    I have a Windows Store application using the Bing Maps SDK for JavaScript (v1.1.20120927.3). I'm experiencing some application crashs caused by an exception raised from the bing map SDK.

    Here is the trace that I've been able to capture using Visual studio :

    SCRIPT1014: Unhandled exception at line 1, column 37015 in ms-appx://<app name>/Bing.Maps.JavaScript//js/veapicore.js
    0x800a03f6 - JavaScript runtime error: Invalid character
    File: veapicore.js, Line: 1, Column: 37015

    Here is what I'm seeing from the error reports on the Windows Store portal:

    ErrorDescription=Invalid character
    ErrorType=4
    ErrorTypeText=Syntax error
    ErrorNumber=800A03F6
    SourceFile=ms-appx:///Bing.Maps.JavaScript//js/veapicore.js
    Line=1
    Character=37015
    DocumentURL=/default.html
    OSProduct=Windows RT
    OSVersion=6.2.9200.0
    OSServicePack=0
    UserAgentString=Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; MSAppHost/1.0)
    StackTraceAvailability=2
    StackTrace=ms-appx:///Bing.Maps.JavaScript//js/veapicore.js:1:37015           parseJSON(string)
               ms-appx:///Bing.Maps.JavaScript//js/veapicore.js:1:13425           onreadystatechange(object)
    StackTraceHash=5d5ee09180eb36f90841530f383f4140

    I'm not 100% sure of what the root cause is but it seems to occurs when I'm connected to networks protected by captive portals (Open wifi networks where you need to authenticate before being able to browse) or on networks with limited connectivity.

    This exception is occuring in an internal callback of the API. Is there a way to prevent it from crashing the whole application ? Can we expect a fix in a future release of the SDK ?

    Thanks.

    Wednesday, March 20, 2013 4:55 PM

Answers

  • I think I have come across this issue before where the app crashes due to not being able to connect to the Internet. What I have done to handle this in the past was catch the error, tell the user that an internet connect is needed and then closed the app. I believe the built in Maps app does the same thing. You can add the following to the default.js file to do this:

    app.addEventListener("error", function (err) {
    	var m = new Windows.UI.Popups.MessageDialog("This application requires an internet connection. The app will now close.", "No Internet");
        m.showAsync();
    	
    	setTimeout(function () {
    		window.MSApp.terminateApp(err);
    	}, 5000);
    
    	return true; // only if error is handled
    });

    Thursday, May 16, 2013 7:44 AM

All replies

  • I think I have come across this issue before where the app crashes due to not being able to connect to the Internet. What I have done to handle this in the past was catch the error, tell the user that an internet connect is needed and then closed the app. I believe the built in Maps app does the same thing. You can add the following to the default.js file to do this:

    app.addEventListener("error", function (err) {
    	var m = new Windows.UI.Popups.MessageDialog("This application requires an internet connection. The app will now close.", "No Internet");
        m.showAsync();
    	
    	setTimeout(function () {
    		window.MSApp.terminateApp(err);
    	}, 5000);
    
    	return true; // only if error is handled
    });

    Thursday, May 16, 2013 7:44 AM
  • Hi,

    Thanks for the reply I will see to implement this protection to avoid crashing the whole application.

    I was expecting that the bing map control can handle some "bad replies" without crashing everything for an incorrect JSON.parse but at least we have a workaround now...

    Thursday, June 27, 2013 8:19 AM
  • I have an HTML/JS UWP app that has been in the store and using the Bing Maps for Javascript v7 component successfully for years. My users have just now started encountering and reporting this same issue. I can reproduce but do not know how to fix this issue.

    The ODS log is:

    Unhandled exception at line 1, column 37487 in ms-appx://63024markseminatore.teslacontrol/Bing.Maps.JavaScript/js/veapicore.js

    0x800a1617 - JavaScript runtime error: JSON.parse Error: Invalid character at



    • Edited by DayKrew Thursday, June 20, 2019 5:56 PM
    Thursday, June 20, 2019 5:55 PM
  • You're bumping an old and unrelated thread that has nothing to do with the issue you're experiencing. The Bing Maps SDK for JavaScript Win8 apps is something different from the V7 HTML SDK.

    In any case, the V7 HTML SDK was deprecated more than a year ago you should really look at moving to a supported SDK.

    If you want to stick with HTML for your application, the V8 SDK is the current release and there are V7 to V8 SDK migration guides available.

    For UWP native applications, the UWP map control is the recommended solution.

    Thursday, June 20, 2019 8:05 PM
    Moderator
  • Sorry if I was unclear, I am using the Bing Maps SDK for JavaScript Win8 apps. My understanding, perhaps incorrect, is this is based off the v7 html sdk.

    Two separate questions based on your response:

    1. Will the V8 SDK work inside a UWP HTML/JS app? I thought it was blocked for security reasons. I am more than happy to migrate if it will work.

    2. Does the UWP map control support HTML/JS? My understanding is this is available only as a .NET XAML control.


    • Edited by DayKrew Friday, June 21, 2019 6:56 PM clarification
    Friday, June 21, 2019 6:53 PM
  • You should really start a new thread for new issues rather than posting replies to unrelated very old issues.

    To answer your questions:

    Yes, the V8 control should work within a web view hosted within a UWP app. The older Win8 JS app model had some security restrictions but that's different than the UWP app model. The Win8 maps SDK included a branched version of the V7 HTML control to work around this, but that SDK is no longer supported.

    The UWP control primarily works with XAML based apps. Using the new XAML islands functionality this also means it can be hosted in desktop WPF or even Win32 apps. Depending on how you develop your app and host the web view within a UWP container, it might be possible for it to work with HTML/JS, but I've never seen this done. 

    Friday, June 21, 2019 8:07 PM
    Moderator