Windows Phone Debug Tools Rode Into Sunset
Organizing and commenting code for my Sawppy Rover ESP32 control project had two sides: the server-side code running on the ESP32 and the client-side code running in a web browser. The MIT license text and general comments went well, but when I tried to improve error handling, I ran into a serious problem with the old Internet Explorer browser built into Windows Phone 8.1: I have no debugging tools.
My only indication was that the page failed to load and all I saw was a blank screen. There were no error messages displayed onscreen, and unlike desktop browsers I couldn't even look at what's been printed to console.log()
. Just a blank nothing. I backtracked through my code changes and eventually traced it down to a bit of error handling code I added to the JavaScript file.
try {
// Do potentially problematic thing
} catch {
// Use alternate approach instead
}
This worked in desktop browsers, this was also accepted in my modern Android phone's Chrome browser, but it was treated as an error in Internet Explorer. Even though I didn't care about the specific error thrown, IE didn't permit omitting the specifier. The following syntax was required:
try {
// Do potentially problematic thing
} catch(err) {
// Use alternate approach instead
}
This code change was not, in itself, a big deal. But it took an hour of trial-and-error to find the location of the error (no feedback = no line number!) and figure out what the browser would tolerate. During this time I was operating blind with only a binary "blank screen or not" as my feedback mechanism. I need better tools if I am to tackle more challenging JavaScript programming on Windows Phone IE.
Unfortunately, almost all of the debugging resources for Windows Phone platform have disappeared. Microsoft's own Visual Studio IDE -- formerly the home of Windows Phone app development -- don't even mention the platform at all in its "Mobile Development" feature page. A promising resource titled Diagnosing Mobile Website Issues on Windows Phone 8.1 with Visual Studio (published in 2014) said to best tool to use is the Windows Phone emulator because it was easier. Avoiding all the hoops one must jump through to put a physical Windows Phone device in developer mode for debugging. Today it's not just a matter of "easier" since the latter is outright impossible: the Windows Phone developer portal has been shut down and I can no longer put any of my devices into developer mode.
But perhaps they're both equally impossible, as the Windows Phone emulator is no longer an option for installation in Visual Studio 2019. A search for related pages led me to Mobile Apps & Sites with ASP.NET (published in 2011) whose section had a promising link "Simulate Popular Mobile Devices for Testing". But that link is no longer valid, clicking it merely redirects back to the Mobile Apps & Sites with ASP.NET page. Many search boxes later, I eventually found what claims to be the Windows Phone emulator as a standalone download. I did not try to download or install it because at that point I was no longer interested.
I aborted my intention to organize my browser JavaScript code. Right now everything sits as peers at top-level and globally accessible. I had intended to reorganize the code into three classes: One handles drawing, one handles user input (pointer events), and the third handles server communications (websocket). However It looks like Internet Explorer never supported the official JavaScript class
mechanism. I can probably hack up something similar, JavaScript is flexible like that. People have been hacking up class
-like constructs in JS long before the official keyword was adopted. But to do that I need debugging tools for when I run into inevitable problems. Doing it without even the ability to see syntax errors or console.log()
is masochistic self-punishment and I am not interested in inflicting that upon myself. No debug tool, no reorganization. I will add comments but the code structure will stay as-is.
This frustrating debugging session sapped my enthusiasm for working on Sawppy rover ESP32 control code. But before I go work on something else for a change of pace, I wanted to get a basic voltage monitoring system up and running.
[Code for this project is publicly available on GitHub]