The problem with Windows 8 development is the WinRT’s lack of capabilities

Let’s face it, there are no really great apps for Windows 8 and the number of trashy apps is also very low compared to the Android and iOS ecosystems. Microsoft looks really desperate to bring more apps and developers to the ecosystem. Instead of improving the API and its capabilities, Microsoft just generates desperately looking campaigns to improve the apps count. I sometimes wonder if they ever realize that the number of apps is not important when people cannot find the apps they are used to use on Android or iOS in the Windows Store.

So why are there so few Windows 8 apps? I will tell you my (and only my) opinion and experience. I developed a few Windows 8 apps, some of them fairly complex. I tried to develop a few really great apps but many of those projects never got done. The reason is the API (WinRT).

Let’s start with something (that should be) trivial. Imagine you want to display HTML files with images, CSS, JS in a WebView. It is a common scenario for displaying downloaded manuals, interactive texts, etc. It can be done on Android, iOS and even on Windows Phone by copying the data to isolated storage and pointing the WebView there.

This scenario is impossible in WinRT. You can reference files in Isolated Storage (Local / Roaming folders) using the ms-appdata protocol, but the WebView does not work with it. You can use the NavigateToString method to display one HTML file, but all the images, CSS, JS references must be internet URLs, you cannot reference other local files. The only way around this issue is to inline all the CSS, JS and images (as base64) to the HTML file. Really messy, painful and slow and not really an option if you have JS reading XML files and inserting external images.

There is another workaround pointed out by Javier Sosa in the comments. Instead of saving your files to Local / Roaming folders, save them to the installation folder of your app (Windows.ApplicationModel.Package.Current.InstalledLocation) and use the ms-appx-web protocol. The WebView can for some reason work with ms-appx-web but not with ms-appdata. Saving your data to the installation folder instead of data folders is quite messy in my opinion. Another problem is, that you cannot create folders in Windows.ApplicationModel.Package.Current.InstalledLocation. This means you have to preprocess your HTML,CSS,JS files and make the file structure flat. Turns out this works only in debug, so it is not a viable workaround.

Let us continue with something as basic and common as Zip files. Windows 8 offers absolutely no protection of your locally saved files so a client may want to at least use password protected Zip files. The ZipArchive class in WinRT does not support password protected Zip files. No 3rd party Zip library can be compiled in WinRT because of a missing Security namespace. You are out of luck, there is no workaround and it may be a deal-breaker for a security-conscious client.

Update: SharpCompress now supports WinRT! Get version 0.9+ from Nuget.

Let us assume that you want to create an interactive textbook app like there are a few on iOS. The apps should contain multimedia content like images, video, sounds, Word and Excel documents. You would assume that displaying (or better said previewing) Microsoft Word and Microsoft Excel files on a Microsoft platform would be easy. You should have learned to limit your expectations and always assume the worst by now when dealing with WinRT. You can display Word documents with a component for $199 and Excel sheets with one for $1195. Previewing Microsoft Office documents on iOS is easy and built-in.

Do you need your app to display PDF files? There are a few solutions, mainly in beta and each has some flaws. I will write a separate article about rendering PDF files in WinRT but, again, be prepared to spend at least $900 for something that can be done for free on other platforms. Sure, you can send the PDF file to the default PDF viewer but that is usually not what you want. It takes the user out of your app and more importantly you cannot protected the PDF content from copying, sharing, etc.

Do not forget about the strange behavior of the Windows Store certification process and the bugs.

I am really fed up with telling customers who want an (complex iOS clone) app the magic words “it is not possible in Windows 8″.

  • Some guy

    Wow… What a collection of weird random complaints – some of them are totally valid, but as supporting evidence for your sweeping generalization, I find them lacking… Let me address them… Full disclosure: I work for Microsoft, though I am not on the Windows team. I write this in my name, not in the name of the company. I have my beefs with Windows 8, but I find the dev environment pretty cool (doing development on it, but not as part of my Microsoft job)

    1. I find very few apps that use HTML in the way you present. You are absolutely sure about the various limitations – I dont really have a good counter-point to them except for saying that, at least from what I know and see, you rarely do complete HTML development within a XAML app. I actually find the fact that WebView is such a weird control (it’s top in Z-Order and renders funkily) WAYYYY more annoying and bad.
    2. Why would you want to use a password protected zip file? Why not just zip the file and encrypt the zip stream? Sure.. It’s not as clean, but it’s far from being a block of ANY sort. (This only works if your app is the only manipulator of the files – though I’m hard pressed to think of apps on phones or tablets that produce password protected ZIP files that they expect their users to use outside of the app).
    3. Word/Excel: Nothing really useful to add here. Is this so different from iOS or Android? Is it significantly eaiser to show these files there (the fact that MS owns Word/Excel non-withstanding – as you can see – we didn’t even make these apps metro friendly)
    4. PDF: That’s a shame, but it’s mostly due to how young the ecosystem is. Were there really that many PDF components for iOS 6 months after release?
    5. Not sure what you are talking about…. Why don’t you bind the description to your specially created user control? I am a little baffled by this one – I may not be getting what you are saying…

    • Igor Kulman

      1. I need it, maybe other people need it too but do not complain about it. It worked in Windows Phone so why should it not work in WinRT? Let me give you a sample. Consider an app that shows (among other things) manual for an electronic appliance. The manual is in HTML with images, CSS, JS. The manual can be updated so it is downloaded from the server and checked for updates. Easy on Android, iOS, problematic on WinRT as described in the article.

      2. One client in digital distribution business uses stream encryption + ZIP password protection as a double measure of security (because of contracts with authors). Implementing a custom stream is a problem, ZIP password protection is a no go.

      3. You can find free solutions there.

      4. You do not get it. If you want to compete with iOS you have to compete with iOS as it is now, not with iOS when it started years ago.

      5. I will produce a sample.

      • http://twitter.com/limitedmage limitedmage

        Just use a JavaScript/HTML5 app for this. I think you can just embed your dynamic HTML file in a fragment or frame.

        • Igor Kulman

          Yeah, I found out that the WebView problem may be solved whren using HTML+JS instead of C#+XAML but other things do not work with HTML+JS.

          • Javier

            use “ms-appx-web” in c# + XAML for displaying local content.

          • Igor Kulman

            The ms-appx-web is for referencing files in you package, not for files you download / copy to the Local / Roaming folder.

    • Some iOS developer

      Regarding 4: iOS had PDF rendering built in since version 1.

  • Some guy

    Looking at your profile on SO, I found this:

    http://stackoverflow.com/questions/12600224/using-richtextblock-in-flipview-in-metro-style-app

    There’s no simple solution, but, what you can fairly easily do is bind your data to a UserControl that contains a RichTextblock and fill that text block programatically with your runs. Sure – it’s not as easy to use as binding a vanilla text block, but it’s totally doable.

    The way you describe in your question is a pretty bad hack, but it’s still a shame that it crashes like that. WinRT has a bunch of annoying areas like that.

  • Some guy

    Last comment. :) with regards to iOS – can you easily embed a Numbers document inside an iOS app?

  • http://www.lelala.de Lelala

    Honestly, WinRT looks like the crappy & desperate try of MS to have “something” in the ARM-market – otherwise, without external preassure from competing ARM-devices, they would have never started this mess.
    And in the long run, they will see how bad this decision was/will be for them…

  • RT Dev

    Loading HTML with other files in the way you describe can be done, have you looked at “ms-appx-web” protocol?

    • Igor Kulman

      The ms-appx-web is for referencing files in you package, not for files you download / copy to the Local / Roaming folder.

      • RT Dev

        Oh noes.

        I’m with Some Guy above, WinRT unarguably has its failings, but as a hardened app dev myself I don’t recognise those use cases.

        It seems like you’re deliberately trying to contrive scenarios it can’t handle.

        • Igor Kulman

          All the issues come from real clients’ needs.

          • http://twitter.com/LewisCowles1 LewisCowles1

            Have you considered that some of the features that may benefit from web access (more positive way to look at it than need web access), are also limitations of non-web access? Sure MS development is different from Android and iOS in some areas (it is a separate platform, not a spin-off), so it has certain implications.

            Because MS has C# it is really easy to check if the device is offline or not, and you can even provision for notifying the user that web access is preferential, to offline usage.

            I ask you to consider that for Mobile devices & tablets are not mini-computers and are low-power consumption devices; There are going to be limitations, where some things do perform and scale more gracefully under a client->server architecture, embrace the change, but thanks also for giving some info about what not to do.

  • John Doe

    1) So, because you failed after one day of work to build a custom Stream implementation, WinRT is a poor dev platform? Come on…
    2) The API is a totally new API, you can’t expect to have 10k free and open source libs to cover all your needs right now… Just wait a few for devs to compile their libs for WinRT…

  • Javier

    For your webview issues it’s not impossible. You just don’t know how to do it.

    You can save files to the installed location by accessing “Windows.ApplicationModel.Package.Current.InstalledLocation”

    So you can copy a file there and reference it in your html text as such.

    “”

    I do it all the time and I’ve never had an issue.

    • Javier

      for some reason it stripped my code from the comment.

      Use “ms-appx-web” to access the local content and you’re good to go.

      • Igor Kulman

        The ms-appx-web is for referencing files in you package, not for files you download / copy to the Local / Roaming folder.

  • D. G.

    As a Windows game developer, I perceive some obstacles to porting Windows desktop codebases onto WinRT. To be really honest, I *want* to develop on a Windows 8 phone. But that’s the thing, I want to develop on a Windows 8 phone, not a Windows 8 RT phone. Windows 8 for desktops is a step forwards in my opinion, especially with the improvements to usability, security, and performance. However, what I lament about Windows RT is the loss of control and flexibility. I suppose that what I want is more like “Win32 ported to ARM” (which is apparently how the RT layer operates anyhow).

  • Roark

    I’m at the point where I can start to relate to what you are saying here.

    I spent months developing an app and it sits in their certification queue for days at a time.

    Now, it’s a holiday weekend and once again my app is in their certification queue and no one is going to look at my app before Tuesday.

    It’s a damn shame, but it’s almost like Windows 8 was made to destroy the ‘freedom’ we’ve come to love with the original PC.

    With Win RT so called modern apps, we have the ultimate closed system we have to try to engage in order to get our apps certified.

  • Jitendra Jadav

    Hello,

    I have a Windows 8.1 app which hold some static pages of html and it will store all the pages into LocalFolder now I am able to get window.external.notification(…), but not able to InvokeScriptAsync()..?

    I had tried with many things but no luck. in simple scenario it is working perfectly fine if you have in APPX folder then it will work but if you have your static pages into LocalFolder then not.

    even notification is also not working directly but I have added StreamUriWinRTResolver and it will working.but now I an not able to InvokeScriptAsync(…) ..

    please guide me where I am wrong.?

    Thank you,

    -Jitendra Jadav.

    • igorkulman

      Aprove—
      Sent from Mailbox for iPhone