I've had the services below running for a few years to support Programming Windows Store Apps with HTML, CSS, and JavaScript. Hwoever, given that the books themselves are getting a bit out of date, I figured it's time to shut them down. Using the examples in the books, similar services would be easy enough for you to deploy to a host of your own. Let me know if you have questions.

http://programmingwin-js-ams.azure-mobile.net

http://programmingwin8-js-ch13-amspushnotifications.azure-mobile.net

http://programmingwin8-js-ch13-hellotiles.azurewebsites.net

 

 


I just finished publishing a body of content on unit testing for JavaScript in the context of Apache Cordova, including both command-line and Visual Studio interfaces. I had a lot of fun learning about the subject and finding ways to communicate a number of concepts. I also found a direct example of a slight difference between JS runtimes that can bite you, but I'll leave that for the articles themselves.

You can find it all on http://taco.visualstudio.com/, the docs site for the Visual Studio Tools for Apache Cordova, under the "Test" node. Here are the individual topics:

There are two other topics in that node that I'll be revising and/or integrating into the stuff above: Test Apache Cordova apps with Karma and Jasmine and Test Apache Cordova apps with Chutzpah.

I'd love to know what you think, as this material is easily the basis for a video course with Microsoft Virtual Academy as well.

In January I'll start diving into UI testing for mobile–should be fun!


Microsoft's Developer Division just hosted its second Connect(); event, which I suspect many of you have been following on http://www.visualstudio.com/connect2015.

I got to be in the heart of things this year. I've been temporarily managing the Visual Studio Blog while Radhika Tadinada, the PM who owns it, is out on maternity leave until about March enjoying her adorable little baby girl. For Connect();, this meant two things. First was managing the content for the VS blog itself, which included working closely with John Montgomery on posts like his news/announcement rollup. Second was that I coordinated the efforts of all the other blogs that are represented on the header menu on the blog site…and that was quite a few of them!

Anyway, I compiled a list of all the blogs that went out yesterday for Connect(); and wanted to share that here.

.NET
Announcing .NET Core and ASP.NET 5 RC
Entity Framework 7 RC1 Available

App Insights and HockeyApp
Introducing Mobile DevOps with Visual Studio Team Services and HockeyApp
Deep Diagnostics for Web Apps with Application Insights
Azure Diagnostics Integration with Application Insights

Apps for Windows
Vungle SDK for Windows 10 Released
November improvements in Dev Center: submission, promotion and developer agreement
Windows Bridge for iOS: Where we are and where we are headed

Azure and Azure SDK
Azure: The cloud for any app and every developer
Public preview of Azure Service Fabric
Public preview of Azure DevTest Labs
Announcing the Azure SDK 2.8 for .NET

Brian Harry
News from Connect(); 2015

C++
Announcing the VS GDB Debugger extension

OfficeDev
Introducing the Microsoft Graph

Visual Studio
News and Announcements at Connect(); //2015
Node.js Tools 1.1 for Visual Studio Released
Announcing the Intune App SDK

Visual Studio Code
Announcing Visual Studio Code Beta

Web Development
Announcing ASP.NET 5 Release Candidate 1

Visual Studio ALM
Getting Started with DevTest Lab for Azure
MacinCloud Visual Studio Team Services Build and Improvements to iOS Build Support
Announcing Public Preview for Visual Studio Team Services Code Search
Announcing the new Release Management service in Visual Studio Team Services
Subversion integration with Visual Studio Team Services
Announcing Public Preview of Visual Studio Marketplace
Announcing easy to use browser-based exploratory testing for Visual Studio Team Services
Git Credential Manager for Mac and Linux
Test Results in Build

Xamarin (I didn't have anything to do with this one, but it's referenced from the VS blog, so I’m including here)
Introducing Xamarin 4


This blog post is an addendum to the article, Build a Xamarin App with Authentication and Offline Support, to be published in MSDN Magazine, September 2015. I'll update this post with a link once the article is available. Part 1, Cloud-Connected Mobile Apps – Create a Web Service with Azure Web Apps and WebJobs, which discusses the backend of the project, is available now.

To summarize from the article: Xamarin.Forms is a framework that lets you use a single code base to implement apps with UI on multiple target platforms. However, as written in Part 2, "shared code doesn’t much reduce the effort needed to thoroughly test the app on each target platform: that part of your process will take about as long as it would if you wrote each app natively. Also, because Xamarin.Forms is quite new [it first came out in May 2014], you may find platform-specific bugs or other behaviors that you'll need to handle in your code."

That particular statement comes from direct experience! Here are the behaviors we encountered with Altostratus and had to manage in the client app code (http://aka.ms/altostratusproject, in the MobileClient project):

  • The Xamarin.Forms ListView control supports grouping, but not invocation of group headers as is supported on some individual platforms. We would have liked to enable this feature in the app, but chose not to until Xamarin.Forms makes it work.
  • ListView headers appear on iOS 7 but don’t appear on iOS 8. This is a known bug in Xamarin.Forms.
  • On iOS and Windows Phone, the OnAppearing and OnDisappearing events for page navigations happen in the expected order: the originating page receives an OnDisappearing before the target page receives an OnAppearing. There’s a significant Xamarin.Forms bug on Android (and here's a duplicate bug) that causes the target’s OnAppearing to fire first. For this reason it’s necessary in the app's Configuration page to update the page’s overall changed status with every UI activity, rather than just check it once within OnDisappearing. This clearly causes a lot of extra churn.
  • On all platforms, setting the Minimum property of a Slider control (as used on the Configuration page) will throw an exception unless Maximum is already set to a higher value. This makes it difficult to set the values through data binding, because the order in which XAML binding statements are processed is indeterminate. For this reason, these properties are set in code rather than through data binding. See https://bugzilla.xamarin.com/show_bug.cgi?id=21181 and https://bugzilla.xamarin.com/show_bug.cgi?id=23665.
  • Data binding the items in a drop-down listbox is not supported at the time of writing.
  • The Xamarin.Forms WebView control is written to fire a Navigating event when the user attempts to navigate a link within the WebView. In the mobile client, we capture this event to specifically disallow navigation directly within the control and redirect the navigation to the default browser, see the code in Altostratus Extra #3. (The code for this is in the ItemPage constructor in ItemPage.xaml.cs.) However, on iOS and Windows Phone 8.1, but not Android, the Navigating event is also raised when the WebView is initialized from local content. This means that on those platforms we want to ignore the first Navigating event, whereas on Android we want to pay attention to all of them. So we just set a flag (navigateToBrowser) within the ItemPage constructor to control whether we delegate a navigation to the browser.

 

The lesson to be learned here is that when platform technologies always have their bugs, especially new ones but often mature ones as well. If something you think should be happening isn't, or you encounter some other behavior that seems odd and especially those that are inconsistent between operating systems, check into the applicable bug database like bugzilla.xamarin.com, or check on the applicable forums. It'll save you plenty of frustration. :)


Update: with Eric’s comment, we’ve worked out how to make SQLite work properly with Xamarin without playing versioning games. The instructions can be found on http://developer.xamarin.com/guides/cross-platform/xamarin-forms/windows/samples/#sqlite, with thanks to Craig Dunn. The short of it is that you want to add SQLite.net-PCL from NuGet, then separately add a reference to Microsoft Visual C++ 2013 Runtime.

We return you now to the original post…

 

The last few weeks I’ve been making significant revisions to a Xamarin project based on code review feedback. This project is part of a larger effort that we’ll be presenting in a couple MSDN Magazine articles starting in August.

One big chunk of work was cleaning up all my usage of async APIs, and properly structuring tasks+await to do background synchronization between the app’s backend and its local cache for offline use. The caching story will be a main section in Part 2 of the article, but the story of cleaning up the code is something I’ll write about here in a couple of posts.

The first bit of that story is my experience–or struggle–to find the right variant of SQLite to use in the app. As you might have experienced yourself, quite a few SQLite offerings show up when you do a search in Visual Studio’s NuGet package manager. In our project, I started with SQLite.Net-PCL, which looked pretty solid and is what one of the Xamarin samples itself used.

However, I ran into some difficulties (I don’t remember what, exactly) when I started trying to use the async SQLite APIs.
On Xamarin’s recommendation I switched to the most “official” variant, sqlite-net-pcl, which also pulls in SQLitePCL.raw_basic.0.7.1. Keep this version number in mind because it’s important here in a minute.

This combination worked just fine for Android and iOS projects, but generated a warning for Windows Phone: Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Packages affected: SQLitePCL.raw_basic.

This is because SQLitePCL.raw.basic is marked for Windows Phone 8.0 but not 8.1, which is what my Windows Phone project in the solution was targeting.

OK, fine, so I went to the NuGet package manager, saw an update for the 0.8 version of SQLitePCL.raw.basic, and installed that. No more warning but…damn…the app no longer ran on Windows Phone at all! Instead, the first attempt to access the database threw a System.TypeInitializationException, saying “The type initializer for ‘SQLitePCL.raw’ threw an exception.” The inner exception, System.IO.FileNotFoundException, had the message, “The specified module could not be found. (Exception from HRESULT: 0x8007007E).”

What’s confusing in this situation is that SQLitePCL.raw does not appear in the Windows Phone project’s references alongside sqlite-net, as it does in the Android and iOS projects. This is, from what I can see, because the Windows Phone version of sqlite-net does some auto-gen or the raw DLL or has pre-built versions in its own package, so a separate reference isn’t necessary. (If you know better, please comment.)

Still, those DLLs were right there in the package and I couldn’t for the life of me figure out why it couldn’t find them, so I resorted to the tried and true method of trying to repro the failure from scratch with a new project, where the default Windows Phone project targeted 8.0. I then added “SQLite-net PCL” to all the projects in the solution, which brought in the raw 0.7.1 dependency, tossed in a couple APIs calls to create and access the database, and gave it an F5. Cool, everything worked.

Next, I retargeted the Windows Phone project to 8.1 and F5’d again. Everything still worked, but I got the warning about SQLitePCL.raw.basic once again. Apparently it’s OK to ignore that one.

I then updated SQLitePCL.raw to the 0.8 version and boom–got the exception again, so clearly there’s an incompatibility or bug in the 0.8 version with Windows Phone 8.1.

Clearly, then, the solution is to altogether avoid using the 0.8 version with a WP8.1 target, and if you want to suppress the warning, open packages.config in the Windows Phone project and have the SQLitePCL.raw_basic line read as follows:

<package id=”SQLitePCL.raw_basic” version=”0.7.1″ targetFramework=”wp80″ requireReinstallation=”False” />


Many of you have probably seen this already–an article that I wrote (with contributions from my teammate, Mike Jones), for MSDN Magazine.

http://msdn.microsoft.com/en-us/magazine/dn879349.aspx

I expect to be writing for MSDN more because my larger team at Microsoft owns the content calendar now!

 


If you're finding Visual Studio complaining about an expired certificate when building a Cordova project for a Windows target, this is a known issue because the certificate that's checked into the Cordova source tree expired on 11/11/2014. See http://msopentech.com/blog/2014/11/11/cordova-certificate-issue-were-working-on-it/ for details and workarounds.


My associate Brian Rasmussen released this book through Microsoft Press a few months ago: http://www.amazon.com/High-Performance-Windows-Store-Brian-Rasmussen/dp/0735682631/ref=sr_1_1?s=books&ie=UTF8&qid=1414429701&sr=1-1.

Here's the short review I wrote on Amazon:

Performance is something that's easy to talk about but difficult to do. You could say that every app could in some way perform better, but how do you really think about where to make investments? Too often, developers take an ad hoc approach, not really clear on what they're trying to accomplish. This can waste a lot of resources in areas that won't have real impact on the customer experience. In this book Brian brings years of real-world insight to the question of finding what matters, clearly defining your performance goals, and then going through the process to measure the app's present reality, making changes, and evaluating progress. And like another reviewer has said, performance information–even just what tools are available–is scattered around, and having one place to bring it all together is super-valuable. 

At 240 pages it's a concise treatment of the subject and for the price (Amazon has it at $14.13), it only takes one or two good improvements to your app to more than pay for itself!


With my new role as a Content Developer in Microsoft's Developer Division, I'm working now with cross-platform tools like Apache Cordova and Xamarin, and dabbling a little in Unity, and also looking at the Visual Studio ALM tools and how they apply to these project types.

To help myself ramp up on Cordova, I'm in the process of migrating Here My Am!, the app that I build throughout the pages of Programming Windows Store Apps with HTML, CSS, and JavaScript, 2nd Edition, to Cordova. I can already see there will be numerous challenges to overcome, which I'll try to write about as I work through them (preview: the first post or two will be about CSS). 

For all this I'm using the Multi-Device Hybrid Apps Extension (Preview) for Visual Studio 2013 Update 3 (how's that for a name!). One thing that's immediately clear about the extension is that it saves a whole lot of trouble in getting a Cordova environment set up. Normally you have to go get a bunch of downloads from nine different places, some of which have installers and some of which are just ZIP files, and then you have to install them in the right order figure out how to configure each one with the right environment variables. The extension does that for you.

The documentation for the extension is found on http://msdn.microsoft.com/en-us/library/dn771545.aspx; the installer page specifically describes what pieces it downloads and how to do the configuration, manually. My team is, in fact, the one that produces this documentation–more to come!