WPF Beta 2 Bug: Image.Source cannot handle mapped drive path

I’m basically going to explode if I don’t get this out soon; I’ve been sitting on this since the weekend. I’d prefer to enter this in the MSDN product feedback center and then link to it from my blog, but, alas, the Beta 2 version is not entered in the Version field of the bug report. I’ve contacted the team through their blog, so while I wait for them to enter it, I’ll blog it here

I expected to find some rough edges in WPF, but nothing quite so rough as this.

Take the following XAML:

<Window x:Class=MusicViewer.Window2

    xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation

    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

    Title=MusicViewer Height=300 Width=300

    >

    <Grid>

       <Image Source=E:\Music\Anthrax\folder.jpg />

    </Grid>

</Window>

The analog to this in Windows Forms would be a Form, 300 x 300, with Text set to MusicViewer containing a TableLayoutPanel, itself containing a PictureBox.

The one thing I have to tell you that you cannot get from the code is that E: is a mapped network drive.

Run this code and you get an uncaught exception of type YourXamlISRetardedException, which is essentially meaningless, because there are so many nested exceptions and you have to dig through to get to the real one. The real exception is an ArgumentException stating in its message that only the file URI is supported.

In fact, it’s a little more clear what’s going on if you expand the XAML above into the following:

<Window x:Class=MusicViewer.Window2

    xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation

    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

    Title=MusicViewer Height=300 Width=300

    >

    <Grid>

       <Image >

          <Image.Source>

             <BitmapImage>

                <BitmapImage.UriSource>E:\Music\Anthrax\folder.jpg</BitmapImage.UriSource>

             </BitmapImage>

          </Image.Source>

       </Image>

    </Grid>

</Window>

This is probably a more accurate representation to explain the problem. The UriSource property will create a Uri for me with the data provided. Note how succinct XAML can be with the first example. Very sexy.

Anyway, as I pointed out, E: is a mapped network drive. You can also write out the file uri for that jpg as a UNC path; something like \\server\share\music\anthrax\folder.jpg. Pass this format to the UriSource and everything works as expected; I can see the image.

Of course, I can’t discount that it might be me. I’ve tried against two machines with mapped drives and they both fail at the same place. Still, I’m confident it’s not me. I find it very hard to believe, and discouraging if it’s true, that this wasn’t included in a test plan somewhere before a Beta 2 release.

,

Beta 2 CRAY-ZEE

 This week, Microsoft released a whole slew of Beta 2 versions of their upcoming releases for Windows, Office, IE and WinFX. I’ve decided to take the plunge with one of my machines: I’ve installed all the betas except Vista. I’ve also decided to spend my spare programming cycles hitting the curve. The curve is doing a pretty good job of hitting me back, something I’ll post more on.

Herewith some quick (real quick) observations on some of the new beta stuff:

Office 2007

This one is game changing. I’ve been reading Jensen Harris’ blog on the new UI for as long as he’s been blogging. It’s a very good blog; Jensen really tells a great story about the new UI, the effort and deep thinking that went in to its design, and it totally shows. I’ve not done anything crazy in the big three (Word, Excel and PowerPoint) that got the makeover, just basically starting and revving the engine stuff. They all seem really solid, especially when compared to the other betas I’ve downloaded. The Ribbon is sweet and fun and sparkly, but I think the thing that will make this version last years is the time they took in making it easy for schlubs like me to make nice looking documents. The editing experience in Word is amazing. (I’m posting this from Word 2007, BTW)

Outlook 2007

I’m not brave enough to let my email get taken over by a beta, and I’m glad I didn’t. Outlook 07 seems kinda flaky. I’m not a big Outlook user – I use it for email mostly – so I don’t really know how to put it through its paces. One of the big changes is the support for RSS. I decided to use Outlook as my blog reader, since the machine on which I’m doing this isn’t my main machine, and hence doesn’t have my favourite RSS reader. Um, no. Tried it, but it isn’t up to the task. The experience shouldn’t be like email, sorry. One of the biggest things missing is the fact that when I get behind on the blog reading, I can right-click on the top level folder and mark all as read. Outlook won’t let me.

IE 7

Sorry, Firefox is still better. The IE team is doing a great job on rendering issues for CSS and that’s appreciated by the young, inexperienced web designer standards zealot in me, but as a user, IE just doesn’t do it for me. They didn’t get tabs right, IMO. And clicking links from Google Deskbar opens new browser windows, not tabs. Once I switched to Firefox, I got used to having all my browsing in one window, so my taskbar isn’t so cluttered. IE 7 brings me back to having a ton of windows open, some with multiple tabs, some without. I realize this is a beta, and I’ll be willing to try again when they RTM, but they haven’t convinced me yet.

WinFX

This one is tough to gauge, because I haven’t gotten over the curve yet, but I’ve run into some really rough edges on the WPF APIs. They deserve separate posts, so I won’t go into them here. But I can see that WPF is something really great. I haven’t played much with WCF – I just can’t get excited about Web Services – or WinWF (lame name!), but Workflow looks really promising and I may get into it later. Right now I’m focusing on WPF. The only thing I can definitively say is that Cider, the VS extensions for WPF, really, really suck. I wish there was a way to say “Just open in XAML mode, thank you” but I haven’t found it.

Hopefully this post works. 😉

…Um, it didn’t. Word couldn’t contact my blog for some reason (the reasons they gave weren’t true). Oh well, I know that it’s a late feature, so I’m holding judgement on the blogging feature.

ReSharper 2.0 syntax highlighting problem isn’t a problem

I posted yesterday about ReSharper 2.0 shipping.

All through the beta I was having trouble with the syntax highlighting, both in VS 2003 and 2005. I thought it was a beta problem and it would be fixed by the production release.

It wasn’t.

Turns out it’s not a bug, the feature is just off by default. To turn on the glorious highlighting to which you are accustomed in ReSharper 1.5, go to ReSharper->Options… Select the Highlighting section, and check Color identifiers. Et voila!

I found this out in their forum. The guys at JetBrains were very quick to respond to the problems. Thanks to them for the tip.

Now playing: Hoobastank – Born To Lead

ReSharper 2.0 is here!

Super awesome: my favourite Visual Studio Add-in has just been upgraded.

I’ve been waiting a while for this release. The beta, which I’ve been using for the past few weeks, was showing a little roughness. Hopefully, they got rid of that. I’ve been pining for a few refactorings that they have in this release: push member up/pull member down. The error highlighting is still awesome, although they are a little aggressive on the warnings – I prefer prefixing member variables with ‘this’, for example – but they make it super easy to turn off the warning: Alt-Enter, disable warning. Too easy!

Even though there is some overlap with the features of VS 2005, I have to say they went beyond what MS provides, especially with code snippets – Resharper’s are context-aware and will put in what it thinks you want, usually they’re right; and now you can export them!

Some other features I love:

  • the code navigation is awesome – you never have to leave the keyboard. 
  • the code generation is really smart and it goes just as far as it needs to make you smile – for example, when implementing an interface with a property, Resharper will ask if you want to generate a member variable for the property too. Yes, please!
  • the refactorings kick the default Visual Studio refactorings all over the room, so much so that they took over the Refactor menu when you right click.
  • every feature has a keyboard shortcut. It’s totally worthwhile occupying a few brain cells with the short cuts, because they save you so much time.
  • the new preview documentation feature – hit Ctrl-Q over comments and get a preview of what they look like in a tooltip window.

To top it all off, the upgrade from 1.x is free! Go get it now.

Now playing: System Of A Down – Chop Suey