When It Rains, It Pours

Well, on top of Microsoft’s XML/JSON deserialization issues within its own libraries, there appears to be related issues within certain third-party libraries.

As if I wasn’t paranoid enough!

Advertisements

.NET and XML: Mortal Enemies

In the past, I’ve had my issues when dealing with the compatibility between C# and XML, so much so that I’ve been inspired to write prose. At this point, I feel that it’s my duty for posterity to document the various instances where Microsoft drops the proverbial XML ball:

  1. As stated before, DTD validation of XML files (with the C# XmlReader) is broken. And when I say broken, I mean that it performs as well as a thirty-year-old VCR pulled from the ocean and then placed in a vat of hydrochloric acid. Now plug that VCR in. You’re going to get the same results.
  2. If you’re hoping to create a XSD from available XML or classes with the Visual Studio Tool (i.e., XSDT), good luck. For one, it doesn’t allow you to specify any complex rules. Also, if you’re generating a XSD schema from classes, you should know that it doesn’t work with Nullable types or any Dictionary properties, since they couldn’t budget it into their schedule.
  3. “Hey, I have a container that’s set to null. So I’ll tell C# not to mention that tag at all upon serialization, since it’s just wasted space and since I might not want that tag visible in certain cases.” It is possible…but under specific circumstances. If you plan on serializing your class as is and if you plan on not using any C# attributes on your properties, maybe. Otherwise? Nope. C# says “No soup for you!”
  4. If you want to serialize an array of strings, you get a free bonus upon serialization: all of the tags will be prefixed with a namespace (i.e., the namespace for array serialization). If you don’t want that ugly prefix, just create a wrapper container for a string array. Now do this for every literal type you can think of.
  5. Let’s say that you have a XML doc with a string that is a HTTP link. You now want to parse that XML and read that value. Of course, if that link contains a query string, all of those ampersands are already converted into instances of “&“, in order to be compatible with XML standards. “But I want my data to be read incorrectly!” Well, you’re just in luck, friend! Because when you use XmlDocument.Load() to deserialize that XML, that query string will contain “amp;” and not “&“, essentially turning the link into garbage. Huzzah!

These are only a few instances, but there’s more. (Don’t even get me started on deserializing payloads from a ASP.NET web service.) If anyone out there has their own experiences to add, I’d love to hear them.

Ahead of My Time

As I take more responsibility over the web services within our department, I’m trying to be more standard in its development and maintenance, including its documentation. While learning how to correctly implement Swagger pages for our services (and, yes, I know, I’m late to the party), I stumbled upon this particular wonderful little feature: interactive documentation!

A couple of years ago, I wrote a piece how documentation should be more interactive, since that would ultimately result in a more effective tool to teach people about anything (an API, a programming method, etc.). Now, since it was actually introduced years before I wrote that piece, you can say that I’m actually behind my time. I’ll accept either. Even though it’s a more basic version of the idea presented in my post, it’s still cool that there’s some work being done in that direction. Much-belated kudos to the Swagger team!

You Might Be Doing Too Much at Once, Microsoft

WARNING: This post is a commentary. If you’re looking for anything technically insightful, you might be disappointed.

Out of curiosity, I attended an Azure training event a few days ago with a group of colleagues at Microsoft’s Reactor in NYC. Though I’ve played with Azure a few times, I could definitely use more insight. (Since it’s been ages I’ve been to a training event, I also wondered if I was missing out on anything. I’ll admit that the food has gotten better.) Before I start, I commend Microsoft for having made leaps and strides in various respects, particularly with Linux and open source. Also, I should commend the staff who conducted the event. They were very helpful and considerate, and I can only imagine the difficulty in a situation where you are dealing with a room full of disgruntled developers. So, they performed well despite given constraints. Now, the actual event on other hand…that’s a different story. In many ways, it reminded me of my general impression of Microsoft these days: sometimes getting a little too ahead of themselves.

So, the general idea was a good one, introducing people to Azure using a hypothetically fun scenario. In this case, the scenario depicted was one where you help save astronauts on Mars, all through a series of printed-out “classified” tutorials on contemporary topics (IoT, serverless computing, etc.). Okay, decent concept. But the devil is in the details…First, the event space didn’t have enough bandwidth to accommodate the laptops of several dozen people. (As soon as I saw that there were no LAN jacks and that it was WiFi-only, I knew that we were in trouble. It’s common knowledge that between Windows updates and NuGet packages for project builds, you’re gonna need plenty of bandwidth.) Second, the presented materials were sometimes confusing (hyperlinks on printed paper, etc.) and were loosely tied to the general theme. For example, one exercise had us utilizing their face recognition API, which is separate from Azure for some reason. Exactly how this helps stranded astronauts and why we were using pictures of college students, I couldn’t tell you. Finally, the tutorials themselves were simple exercises of copying code and hitting menu options in order to showcase certain technological features.

However, there was no tutorial that gave a general idea of what Azure is really about: being a cloud platform. The basic framework was ignored (spinning up a VM instance, loading a new database, etc.) in order to tout its more niche features. Personally, though, I think that the goal of the marketing team should have been more practical and focused when planning this event. For example, use a theme of a skunkworks team within a larger organization. How could such a team leverage Azure to become innovative? In other words, provide inspiration and ammunition to your base of enterprise users that doesn’t currently use the cloud yet. Though I understand the marketing team’s goal: to appeal to both enterprise AND startup customers for Azure. Obviously, management has envisioned that as the strategy to overtake AWS.

Which, obviously, I think might be a mistake. For example, how many people with Arduinos and Raspberry Pis are looking to create IoT products with .NET Core? True, I’m not an expert, but after spending a few minutes with it, I still can’t see it winning too many hearts and minds. Instead of spreading their resources too thin, it might be beneficial to double-down on their bread and butter, especially since there’s already so much competition in other verticals. After all, there are plenty of enterprise customers to still win over. In fact, I can think of one or two opportunities in niche spaces that are hidden among enterprise users. I know that I don’t have the mile-high vantage point, so I’m not privy to certain details…but since I’m leery of wobbly ladders, I tend to prefer low-hanging fruit. 🙂