Asked by:
New Exception in Bing Maps control for Javascript

Question
-
I have an HTML/JS UWP app that has been in the Windows Store for more than 2 years. I have successfully used the Bing Maps SDK for Javascript for all that time. Now, however a percentage of my users are experiencing the following exception which crashes the app.
Unhandled exception at line 1, column 37487 in ms-appx://<app PFN>/Bing.Maps.JavaScript//js/veapicore.js 0x800a1617 - JavaScript runtime error: JSON.parse Error: Invalid character at
This seems to be intermittent and sometimes (but not always) is resolved by resetting or reinstalling the app. I understand that the SDK in question is retired. However I do not wish to completely rewrite my app in C# so I can use the XAML control. Looking (and hoping) for a reasonable mitigation for my users.
All replies
-
Hi DayKrew,
The Virtual Earth API core file you are hitting is actually a component from the V7 version of the Bing Maps control that is no longer supported. Here is a link to the migration guide to move from V7 to V8 that was published in 2016. https://social.technet.microsoft.com/wiki/contents/articles/34563.bing-maps-v7-to-v8-migration-guide.aspx
I can't tell you what code call is causing the error but my suspicion is that it might be the same as https://social.msdn.microsoft.com/Forums/en-US/f7704617-dffa-403b-a238-a90c596bb734/exception-in-veapicorejs-when-using-the-bing-maps-sdk-for-javascript-in-windows-store-apps?forum=bingmapswindows8 so maybe you can trap for it like the previous poster has done.
As Duncan mentioned, the full solution is to move to the newest control. It is also very easy to use and has a ton of samples available. You can start at https://www.microsoft.com/en-us/maps/v8-control for the marketing side of things and dig into deeper details from there.
Sincerely,
IoTGirl
- Edited by IoTGirlMicrosoft employee, Moderator Monday, July 1, 2019 4:44 PM
-
Thank you, but unfortunately "it is also very easy to use" appears not to be true if your app is written in HTML/JS as mine is. But I've been told that the V8 control does not support UWP HTML/JS apps. And that the new map control would require me to re-write my app as a CS/XAML app.
I would love to find out I am mis-informed. Re-writing my entire app is not cost effective.
-
Hi DayKrew,
Can you please provide documentation for this statement? "I've been told that the V8 control does not support UWP HTML/JS apps". Duncan is a Lead Developer in Bing Maps so I would take his suggestion in your previous post as golden. You don't provide any specifics so I can only assume you have not tried or followed the documentation provided.
Arguably, for a UWP App you could be better served by the UWP Map control but you chose to host a web control instead. Web controls do have to expand to support new web requirements so by choosing that control you will need to update your code accordingly.
Sincerely,
IoTGirl
-
-
Documentation on how to use the Bing Maps V8 control in UWP can be found here: https://docs.microsoft.com/en-us/bingmaps/v8-web-control/articles/cross-platform-bing-maps-v8-apps#uwp-apps-javascript