Robert Westerlund

A developer's blog on code, technology and tools in the Web, .NET and other development areas.

NAVIGATION - SEARCH

TechEd 2009 Keynote - Problem Steps Recorder and BootManager support for booting from VHD

At the TechEd 2009 keynote today, Bill Veghte, VP for the Windows Business, announced that Windows 7 will be released before holidays (Christmas) this year (subscribers will probably get it before that). The same goes for Windows Server 2008 R2, which means that we will see both these systems making great Christmas presents for geeks everywhere.

When Mark Russinovich took over, he presented two things I found very interesting regarding Windows 7; the Problem Steps Recorder and the possibility to boot directly from VHD.

The Problem Steps Recorder will make life easier for geeks everywhere when users (be it customers or friends or family) can record when errors happen instead of having a less-than-computer-savvy (not always the case, of course, but at least most often) person try to explain the steps to reproduce the error.

Giving the BootManager support for booting directly from a VHD really seems like a great thing. I often suggest doing all development within virtual machines since this will isolate environments and keep new projects from messing with the environment of old projects. Being able to boot directly from the different VHDs would mean that the performance loss of running the development environment as a guest OS in Virtual PC or VMWare which in turn is running on a host OS would be gone. The isolated development environment should also be able to benefit from all the real hardware of the computer, instead of relying on the virtualised hardware. There are of course drawbacks to this (e.g. installing drivers to specific hardware makes the VHD more damaged by a move between computers), but I think that eliminating the need to run two OSes (running HyperV or ESX or <insert own favourite here> could of course also be a viable solution, but it would take a whole lot more setting up and managing, I would guess) makes it all worth it.

When it came to the server side, Iain McDonald mentioned (among a lot of other things, of course) a small but still nice feature of Windows Server 2008 R2, the File Classification Infrastructure. Also a nice addition to this is the addition of OCR-technology into Windows Server 2008 R2 which allows it to search even in text within images.

No state machine in WF4

I attended a TechEd pre-conference session today, in which one of the presenters, Zoiner Tejada, said something that surprised me. There will be no state machine workflows in Workflow Foundation in .NET 4.0.

However, we need not despair in its absence. WF in .NET 4.0 contains a hybrid workflow, which lies somewhere between the still existing Sequential Workflow and the late State Machine; the Flowchart.

I had planned on writing a short introduction to the Flowchart, but I found a nice introductory article to the Flowchart workflow and realised that linking to that article might be a better idea since it spares me the job. :)

As a side note, Mr Tejada also hinted that Microsoft might release an out of band release which would contain the State Machine workflow for .NET 4.0, but he was very specific that as of yet, nothing is certain in that regard.

LINQ to XSD

UPDATE 2009-06-05: LINQ to XSD has now been released as open source.

A long time ago in a galaxy far, far away… That’s not really the case, but it’s not far from it. In early 2007 I first read about the LINQ to XSD project which Microsoft (or rather, it’s xml team) was working on. I haven’t heard much news about this project since then, so I decided to write an e-mail to the xml team. It didn’t take long for them to answer my query (they seem to be similar to DLINQ in this manner) in a very short and concise manner. I’m not really sure about how I should interpret the response, however.

My question was (very compressed so you don’t have to read my entire e-mail): “I haven’t seen any news about LINQ to XSD in a long while. Is it a dead project? If it’s dead, could you give it to the community to continue?”

The answer I received from Pawel Kadluczka was:

Hi Robert,

We're currently looking at ways in which we might further the LINQ to XSD technology for its user community. We don't have anything to announce quite yet.

Thanks
Pawel

Well, the happy note here is that the project isn’t dead. The sad part is that I didn’t succeed in prying more information by nagging. :) I guess patience is the key, then. My thanks to Pawel for the e-mail!

What is LINQ to XSD?

I do so love type safety on my data classes. When I load data, be it from a database, a form post or an xml file, I do not want to touch things with Magic Strings. The best part? If I would correct a spelling mistake or change the name of an element, I would get a compile time error instead of run time. Therefore I am very much into OR Mappers and XSD class generators.

However, I have never been very fond of the xsd.exe application which generates .NET (C# or VB.NET) classes from an XSD file. There are several reasons for this, but my main complains is that it is a one way conversion (there is not enough information in the generated classes to be able to recreate the XSD file from them) and that I can’t use the generated classes to validate that the data in the structures actually satisfies the constraints of the XSD file. An example of this would be a string constrained to the length of 20 characters in the XSD. The code generated by xsd.exe does not contain the constraint information and I can thus not (easily) verify whether or not the data in my objects are valid according to the constraints in the XSD file.

On a white horse, riding in the sunset with a glass of milk in it’s hands, ��LINQ to XSD” comes to the rescue. LINQ to XSD, like xsd.exe is a tool which generates classes from an XSD file. LINQ to XSD is (or will be) more integrated into Visual Studio than xsd.exe is. Just set the build action of the XSD file to use LINQ to XSD and it will re-generate the classes for you when you compile your project. This also means that once you have set the build action and compiled your project you will get the wonderful thing called Intellisense. Also, LINQ to XSD (not surprisingly, due to the name) also makes the resulting classes very easy to use efficiently with LINQ to Objects (and further also PLINQ).

An example of using LINQ to XSD and then LINQ to Objects over the generated objects would give something code like the following (Since I cannot install the LINQ to XSD alpha at the moment, I’ll just steal the example the xml team is using in the LINQ to XSD overview document)

(from item in purchaseOrder.Item
select item.Price * item.Quantity).Sum();

which would sum the price of all items in the following XML file.

<purchaseOrder>
  <item>
    <price>12</price>
    <quantity>2</quantity>
  </item>
  <item>
    <price>24</price>
    <quantity>1</quantity>
  </item>
  <item>
    <price>17</price>
    <quantity>2</quantity>
  </item>
</purchaseOrder>

and given that the XSD file would specify the price element and the quantity element as integers, the result of the call would be 82. And all this without any explicit casting in the code that uses the loaded data.