Category Archives: .net

When will Blend, Microsoft’s Visual Studio design tool, be done? Not for a while says Soma Somasegar

During the Visual Studio 2012 launch last week I took the opportunity to ask Developer division Corp VP Soma Somasegar when Blend, Microsoft’s design tool for Visual Studio 2012, will be finished. A tricky question to answer, since there are multiple versions, as explained here:

  • Blend for Windows Store apps (HTML or XAML) is fully released and available as part of Visual Studio 2012

    image

  • Blend for WPF and Silverlight is in preview. For production you are meant to use the old Blend 4, unless you are targeting Silverlight 5 where you have no choice but to use the preview version.
  • Blend for Windows Phone is part of the Windows Phone SDK 7.1

The SketchFlow prototyping tool is also part of the preview Blend.

So when will Blend for Visual Studio 2012 be done? Somasegar refers to HBlend, which is the HTML version, and XBlend, which is for XAML.

“We shipped HBlend, and we shipped a preview of XBlend. It will take several months to finish. We also want to continue adding to HBlend. So I can’t tell you that Blend is ever going to be done [laughs],” he told me.

That said, the full Blend for Visual Studio 2012 will come out of preview sometime. Will it coincide with the first update for Visual Studio, announced for later this year?

“It is going to be later than the update, but I don’t have a specific timeframe,” he said.

Personally I have mixed (ha!) feelings about Blend. On the one hand, it is obvious that the simple designer in the Visual Studio IDE is insufficient, and that the rich Blend tool is needed, for those who can make sense of its intricate user interface. On the other hand, the designer aspect of Microsoft’s tooling seems to me messy, with too many versions of Blend and overlap between Blend and Visual Studio which gives developers a difficult choice: do I work with Blend, or stay within the simpler but more limited IDE tools?

Visual Studio 2012 launch: focus on Modern Apps

Microsoft is holding a launch event in Seattle for Visual Studio 2012, attended by selected Microsoft-platform developers as well as press from around the world.

image

Corporate VP Soma Somasegar kicked off the keynote, saying that Visual Studio 2012 has already been downloaded 600,000 times since its release to the web around one month ago – a take-up, he said, which exceeds previous versions.

image

But what is Visual Studio 2012 all about? It’s for Modern Apps, said Somasegar, though you would be wrong to imagine that this means a Windows 8 formerly-known-as-Metro app. Rather, a Modern App implies continuous services and multiple client devices, connected over both public and private networks. In other words, think mobile as well as desktop, public and private cloud, and bring your own device as well as corporate desktops.

Fair enough, but it is all a bit vague and still leaves us wondering what exactly apps for the Windows Runtime are called at Microsoft. Visual Studio calls them Windows Store apps, which does not make complete sense when you consider that you can deploy the apps without going through the Store, and that the Store can include desktop apps although these are links rather than direct downloads.

Visual Studio 2012 is a vast and impressive product though. Developers were shown various new features, including asynchronous development for maintaining a responsive user interface, pixel-level debugging in DirectX, after the fact debugging using Intellitrace, and new HTML and CSS support in the editor, with error highlighting that adapts to the specified version of HTML.

There was a quick demonstration of developing for Kinect, in which we saw an avatar mimic the movements of VP Jason Zander.

image

Technical Fellow Brian Harry spent some time showing off application lifecycle features in Team Foundation Server, including improved Scrum support and an emphasis on agile concepts like whole team development (the development team is not just developers).

There were a couple of announcements, including news of an update in preparation for Visual Studio 2012 which will include new features. There will be a preview later this month and delivery by the end of 2012.

Visual Studio Express for the desktop has now shipped and is available for download. This supports development in C#, Visual Basic and C++, so there is now a free C++ compiler available for Windows desktop development in the Visual Studio 2012 family.

I spoke to a couple of the invited developers after the morning event. Visual Studio 2012 looks good, they told me, but then again what choice is there for Windows platform development? That said, they had expected a stronger push for Windows 8 development, especially on the Metro-style side. Why did Microsoft not spend more time evangelising Windows 8 app development and the Windows Store? Of course there is a lot to cover but given how critical app momentum is to the success of the new Windows, it struck me as a valid point.

SharpDX: Managed DirectX for Metro from the community

One of the disappointments in Microsoft’s new Windows Runtime platform is lack of support for XNA, a gaming/fast graphics API which wraps DirectX and is supported on Windows, Windows Phone and on Xbox 360.

Developer Alexandre Mutel has stepped up to fill the gap with the open source SharpDX, which also provides access to the DirectX API from C#, supports both desktop and Windows Runtime development. One of the first games to use SharpDX, ARMED, has already arrived in the Windows Store.

image

In addition, Mutel says “it will certainly be possible to use ShardDX from Windows Phone 8”.

SharpDX was made possible by a custom tool called SharpGen which generates the .NET API automatically from the DirectX SDK.

The puzzle is why Microsoft did not make more effort to support XNA in Windows 8, or failing that to provide an alternative for .NET developers.

If you want to use SharpDX, be prepared for considerable effort learning the API, as there is little documentation so far. Still, it will likely be easier than learning C++, which is the official solution for DirectX on the Windows Runtime.

Windows Server 2012: a great upgrade

Remember how everyone hated Windows Vista but admins loved Server 2008? The awkward truth: they were built on the same core code. History may be about to repeat with Windows 8 and Server 2012, which also share code.

That said, I actually like Windows 8; but it is controversial because of its dual personality and the demands it places on existing Windows users to learn new ways to navigate the user interface. Server 8 has the Start screen too, but it boots to the desktop and most tools are available through the new Server Manager in any case, so I doubt it will cause much concern.

image

That is, if you install the GUI at all. Microsoft is a convert to the “No GUI on a server” idea and you are meant to install Server Core, which has no GUI, where possible, and run Server Manager on a Windows 8 client. There is also an intriguing intermediate option called the Minimal Server Interface, which has the GUI infrastructure but no Explorer shell or Internet Explorer. It sounds odd, but I quite like it; it is a bit like one of those stripped down Linux desktops where nothing gets in the way of the apps.

The Windows Server Evaluation Guide [pdf] does a good job of covering what’s new but runs to 177 pages, posing a challenge for those of us asked to review the new operating system in the usual 1500 words or fewer. I have had a go at this elsewhere. I will say though that from my first encounter with Server 2012, then called Server 8, at a press workshop in September 2011, I was impressed with the extent and significance of the new features. It does seem to me a breakthrough on several levels.

Virtualisation is one of course, with features like Hyper-V Replica doing what Microsoft should be doing: bringing features you would expect in large-scale enterprise setups within reach of small organisations. If you are not ready for public cloud, a couple of substantial servers running Hyper-V VMs with failover via Hyper-V Replica is an excellent setup.

Another is the effort Microsoft has put into modularisation and automation.

For modularity, Server 2012 is not quite at the level of the Debian server which hosts this web site, where I can add and remove packages with a simple apt-get command, but it is getting closer. You can now move between Server Core and full GUI simply by adding and removing features; it sounds easy, but represents an enormous untangling effort from the Windows team.

On the automation side, PowerShell has matured into a comprehensive scriptable, remoteable platform for managing Windows Server. I love the PowerShell History feature in the Active Directory Administration Center, which shows you the script generated by your actions in the GUI.

Storage is a big feature too. The new Storage Spaces are not aimed at Enterprises, but at the rest of us. We are beginning to see an end to the “help, we are running out of space on the C drive” problem which can cause considerable problems. You can even mount virtual disks as folders rather than drive letters, another sign that Windows is finally escaping its DOS (or CP/M?) heritage.

Annoyances? Lack of tool compatibility is one, specifically that you the new Hyper-V manager will not manage 2008 R2 VMs, and the new RSAT (Remote Server Administration Tools) require Windows 8.

More seriously, there are times when the beautiful new Server Manager UI gives mysterious errors, and as you drill down, you are back in the world of DCOM activation or some such nightmare from the past; which makes you realise that under the surface there is a ton of legacy still there and that Windows admins are not yet free from the burden of trawling the web for someone else with the same troubling error in Event Viewer. Maybe this is common to all operating systems; but Windows seems to have more than its share.

Never mind; this is a great upgrade and shows that Microsoft, for all its frustrations, is still capable of turning out strong products.

Guest post with a view from the enterprise: Microsoft is getting it right with Windows 8

The following is a guest post from a contact who holds a senior IT role in the finance industry.

image

I think Microsoft is getting it right. I don’t recall saying this about anything they have done before, which makes this a matter of some significance to me. My view on W8 is that it is a purely transitional state to a brave new world and that a number of strategic concerns are driving W8’s capabilities. Here’s what I think is going on:

1. MS thinks the the PC is over.

Well, that may be a bit extreme, perhaps it would be better to say that given MS’s dominant position, the PC will be over before anyone can take it away from them, so now is the time to maximise the cash being extracted from this cow by minimizing the investment.

The implication is that computing is heading in 2 directions – ‘down’ to phones and tablets and ‘up’ to the cloud. MS is trying in the cloud space, if not perhaps succeeding brilliantly. In the phone/tablet space

W8 is (at least potentially) a serious contender to iOS.

2. MS loves enterprises (and people who sometimes look like them, e.g. educational organizations)

Office is where MS’s money is coming from. Office is the (only?) reason the W8 has a legacy desktop. This enables corporates (many of whom won’t take W8, but there had to be a story for them) and educational users to upgrade while staying with Office.

Also, notably, Apple is conspicuous for sticking to the mass retail market. This is making a number of tricky issues for enterprises such as mine when it comes to developing corporate mobile applications on iOS.

3. MS is taking good UI chances

This is a big one. Apple has always had good old WIMP GUI right. In the new world they have opened in iOS, the UI, while easy to use, is fundamentally application-centric. In fact the iOS home view of app icons is scarily reminiscent of the Windows 3.x Program Manager.

The W8 ‘modern’ UI with its active tile concept provides something that opens up the possibility of a task-oriented UI. This could be a huge benefit to enterprises and is, at least, a good marketing angle for MS.

4. Corporate users could be excellent gateway users

What if every corporate BlackBerry user wanted to get rid of Blackberry Enterprise Server? oh – they do :-). What’s the alternative? Nothing from Apple (and no sign of anything coming). a huge slice of those corporates already use Exchange (must be 99+%). What if MS was able to offer secure mobile device management with a modern UI platform? Looks like a good way of capturing a lot of that market. Think of all those corporate mobile users with a W8 phone – MS gets to bypass head-to-head competition with Apple for this slice of the market. How many people bought Windows PCs because they had to learn Windows at the office? ok, maybe not a huge number, but it’s not a bad (affluent) group to use as the basis of chipping away at Apple mind-share.

5. What if those corporates were looking to replace PCs both real and virtualized) with tablets?

It’s already the case that an iPad can do anything that the vast majority of enterprise users do with their PC (once you include VPN desktop access). Put office on the device (with cloud storage) and an enterprise can be shown a way to make massive reduction in desktop PC costs. The only compelling reasons for another type of device are software development and large UI footprint (multi-monitor). The MS Surface offers the possibility of a device that:

  • looks like your new corporate mobile device
  • can do everything (including Office) that your PC can do
  • is at a much lower price point

so that’s my view in the crystal ball. If MS were thinking that the PC was dead and wanted to avoid a (probably losing) head-on fight with Apple, their entrenched position in the enterprise looks like their best starting point. Offering enterprises a possible post-PC future with unified mobile and desktop UX based on Windows phones and tablets with Azure or private cloud back-end looks like it might be a strategy. the coming (already started) implosion of RIM looks like an opportunity for Windows phone to kick-start the adoption process.

What would W8 look like if this was what MS was thinking?

  • it would have a modern UI, distinctly different from Apple’s, not being WIMP-like
  • it would be NOW, to help point to a future enterprise based on W phones and tablets to help capture the RIM refugees.
  • it must contain Office, at all costs to sustain the enterprise story

oh look, that’s what W8 is like. So, for all the noise around how nasty W8 is, I think it’s indistinguishable from what it would be like if MS really had a plan that might work. The inelegant dual-UI can be thought of as a consequence of the need for a migration path for existing apps, a recognition that all those office users are starting out on PCs and (possibly) that they couldn’t engineer a real modern UI office in time.

The final irony is that Vista may turn out to be the biggest boost for this strategy. Major enterprises that I have seen have generally moved their desktop fleet onto every second (or more) big Windows release.

Nobody moved to Vista, those who were due to move held off because it was so awful. Everybody went (and most are still in the process of going to) Windows 7. As a result, none of the enterprise customers have to actually implement W8 for their desktop fleet – they just have to drink MS’s Kool-Aid for the future and be able to use W8 phones and tablets, where most of the ugliness disappears.

Developing for the Windows Runtime: a few more notes from the field

I have been poking around in the code for my Windows Runtime ITWriting.com reader, which is based on this MSDN sample. The list of posts looks like this:

image

Not bad, but that block showing the date of each post is based on Windows Team Blog page, which is nothing to do with me. What would it take to modify the design?

The problem with sample code is that when you copy and paste you do not really know how the code works, and sometimes issues are hidden. The MSDN article, while it does a good job explaining most parts of the app, does not explain how the date block is put together. A few observations then from my efforts to modify this.

Most of the code for this date block is in the ResourceDictionary element in App.xaml, which means it can easily be reused on multiple pages. The code is a ControlTemplate element, which means it defines a custom control. This is then referenced within a DataTemplate element on the pages where it appears. The DataTemplate defines how the bound data appears in the list.

Reading a block of XAML and trying to visualise how it will render is not much easier than viewing a photo in a binary editor. However, you cannot view App.xaml in a visual designer, since it is not a visual page. The only solution I could think of was to copy the ControlTemplate out of App.xaml into a page where I could see the design, tweaking it, and then copying it back.

I started a new project in Blend, and copied the Canvas code from the DateBlockTemplate, and replaced the data bound values with hard-coded examples. So far so good: I could now tweak the design.

image

My design skills are rubbish so I ended up with a simpler layout. In my adaption, the month and day appear on one line, as in “Aug 26”.

This led me to another problem. In the sample, the month and day are bound as separate fields, for example:

<TextBlock.Text>
<Binding Path="PubDate" Converter="{StaticResource dateConverter}" ConverterParameter="month"  />
</TextBlock.Text>

How could I concatenate the two bindings to appear in one TextBlock? In Windows Presentation Foundation (WPF) you can do this with the MultiBinding class, but this did not seem to work in WinRT XAML. Rather than go further down that route, I decided to amend the DateConverter class which is also part of the sample, to add a conversion that returns both the month and the day.

DateConverter.cs users the new DateTimeFormatter class.  The documentation explains that this takes a “format template string” but does not offer a reference for constructing formats. I experimented and ended up with:

DateTimeFormatter dateFormatter = new DateTimeFormatter("{month.abbreviated(3)} {day.integer(2)}");

which turns out to work.

Now my list of posts looks like this:

image

Not as stylish as before, but at least it is different.

The Windows Runtime App Certification Kit: not too good detecting crashes and hangs

Now that I have a lovely ITWriting.com App I thought I should check out whether it is ready to fly.

I therefore ran the App Certification Kit that installs with Visual Studio 2012.

image

The tool asks you to select an installed app and then exercises it. I saw my app open, though I did not see it get beyond the first screen.

image

Eventually – bad news:

image

However, there is only one thing wrong with it:

image

Yes, the version installed is the debug build. I can fix this simply by rebuilding in release configuration.

What does the Kit test? Here is the list:

  • Crashes and hangs test
  • App manifest compliance test
  • Windows security features test
  • Supported API test
  • Performance test
  • App manifest resources test
  • Debug configuration test
  • File encoding
  • Direct3D feature level support
  • App Capabilities test
  • Windows Runtime metadata validation

That sounds most impressive and makes a great list for you to show to your customer.

I am sceptical though. If the app was not exercised beyond the opening screen, might it not be a bit buggy after all?

I inserted the following line of code into the the Click event handler for reading a blog:

int iCrash = 1 / string.Empty.Length;

I then rebuilt the app in release mode and ran the App Certification Test. Great news!

image

and specifically:

image

Thanks though to my umm, bug-unfix, the app crashes whenever I click to read a blog.

I mention this not to poke fun at the App Certification Kit, but to observe that it does not do a good job of automatically detecting crashes and hangs.

The implication is that the human testers are the ones who will do this before an app is admitted to the store. I think they would find my obvious bug; but how much time will they have to test every feature of an app?

Developing a Windows Runtime app: some observations

What would it take to create a Windows 8 Modern UI content reader for this site? Just for fun, I built a simple one; or rather, I slightly adapted Microsoft’s Metro style blog reader tutorial.

The app only has four screens (or pages) but despite its simplicity I found the tutorial somewhat fiddly. Getting the data from the WordPress RSS feed is simple, thanks to the Windows.Web.Syndication namespace which is part of .NET Framework 4.5. Most of the work is in the user interface, which means switching between XAML and C#. Of course as a developer I would rather work in C#.

Further, the Visual Studio editor for C# is better than the editor for XAML. In C# I can easily navigate the code using Go to Definition, Find all References, and so on.  In XAML it takes longer to find things like referenced styles and resources. Plus XAML is XML, which I find harder to read than an elegant language like C#. Even commenting out a line is more hassle in XML.

I did not like the colours used by the tutorial for the list of posts in SplitePage.xaml. It took me a while to work out what to change. Was the colour defined in a resource, or in a template, or in a style, or directly coded as an attribute of the relevant TextBlock object?

Of course you can open the XAML in Blend if you prefer, the designer-oriented tool that comes with Visual Studio 2012. Blend is more complex than the Visual Studio XAML editor, but may be better once you have figured out how it works.

The amount of work involved in making your app well-behaved is proportionately larger if your app is essentially very simple. You have to deal with different layouts for different screen sizes and orientation, as well as the small Snapped layout. You also have to consider what happens if your app is suspended and resumed.

The above means that despite the apparent simplicity of a Modern UI interface, with its chunky buttons, there is more to consider than with, say, a Windows Forms application whose window is never rotated and over which you have full control.

Still, I was pleased with my app which has reasonable functionality based on a small amount of work.

Visual Studio 2012 is impressive, though I did experience some screen corruption after switching back and forth between the Metro and Visual Studio environments for debugging. Restarting Visual Studio fixes it. Using the simulator seems more robust in this respect.

image

The App Bar

One thing though. If you squint at the above screenshot, you will see that I have put a Read button to the right of the post title. Clicking or tapping this opens the post in a embedded web browser view that is nearly full-screen. However, this Read button is not included in the tutorial, which says:

On the split page, we must provide a way for the user to go to the detail view of the blog post. We could put a button somewhere on the page, but that would distract from the core app experience, which is reading. Instead, we put the button in an app bar that’s hidden until the user needs it.

This may in fact be an excuse to include an App Bar in the tutorial; but I disagree with it. With the App Bar, the user has to right-click or swipe down to display the App Bar, and then click or tap the View Web Page button.

image

That is two actions rather than one. Is it really better than having a small button in the UI?

It seems to me that tucking things into the App Bar is fine in cases where there is real merit in an immersive experience, such as in the web browser, but less compelling when you already have a screen with a back button and a scrollable list. I was also concerned that users might not realise they needed to display the App Bar in order to use the app properly.

Let the design debate continue.

Design-centric

Microsoft’s Modern UI continues a trend which began with Windows Presentation Foundation (the first incarnation of XAML), which is to make a platform richer for UI designers and more challenging for developers who lack design skills. Nothing wrong with that; but if you remember how easy it was to snap together an app in Visual Basic 3.0, you may feel that something has been lost.

I guess that recognition of that fact was one of the motivations behind Visual Studio LightSwitch, in which you define the data and business rules, but the screens are generated for you. LightSwitch has complexities of its own though.

Installing Kodak All-in-One Printer driver on Windows 8

I have been busy upgrading computers to Windows 8 now that the RTM is available. So far so good, though I ran into a problem with a printer which, oddly, worked fine in the Windows 8 Release Preview.

The printer is a Kodak All-on-one. Kodak has a universal installer for all its all-in-one printers. When I ran this, I got a message that .NET Framework 2.0 was needed and would be updated.

image

It would then try to install .NET 2.0, but fail.

Easy, I thought, just install .NET first. In Windows 8, you do this through Control Panel – Programs – Turn Windows features on or off.

image

I installed .NET Framework 3.5, which includes 2.0, and re-tried the Kodak printer install. Same message, same error.

I also tried running the installer in compatibility mode for Windows 7 and Windows XP. No go.

Time for some serious troubleshooting. I presumed that if I could figure out what the installer was looking for when it failed to detect .NET Framework 2.0, I could fix it.

First, I checked the official instructions for detecting .NET in an installer. This was already correct.

Next, I downloaded Process Monitor to see if I could spot the registry query or file search the installer was making. I noticed that aio_install.exe, the Kodak installer, unpacks a setup into a temporary location and runs from there. I copied the extracted files and ran the setup. Using Process Monitor, I discovered a registry query to HKCU\Software\Kodak\BootStrapInstallStatus and the REG_DWORD key InstallStatusKeyForDotnet. This was currently set to 1. In a spirit of experimentation I changed the 1 to a zero.

image

Next I re-ran setup. It worked perfectly.

image

I still do not know why that registry key was set, but I am not inclined to pursue it further. Possibly if .NET Framework 2.0 is already installed before you run the Kodak installer for the first time, the problem does not arise.

If you encounter this problem though, I suspect the following two steps will be sufficient:

1. Install .NET Framework 3.5 using Control Panel.

2. If installing the printer driver fails, check for the registry key HKCU\Software\Kodak\BootStrapInstallStatus\InstallStatusKeyForDotnet and set it to 0.

Embarcadero preparing Delphi, C++ Builder XE3 release

Embarcadero has announced a world tour to promote its forthcoming XE3 development suite.

image

But what is in it? No details yet, but a few clues:

  • Windows 8 “look and functionality” for VCL and FireMonkey apps
  • A new edition of the FireMonkey cross-platform framework, called FM2
  • A new tool called HTML5 Builder.

There are a few more clues in a leaked PDF document on what is new in Delphi and C++ Builder XE3. This refers to “full support of the Windows 8 Metro user interface” and describes new project wizards for “VCL Metro Desktop Application” and “FireMonkey Metro Desktop Application”.

Since “Desktop” normally means non-Metro in a Windows 8 context, this phrase is puzzling, making me wonder if the tool will build apps that look and feel like Windows Runtime apps, but really are not. That would be unsatisfactory, because features like Contracts and Live Tiles only work with real Windows Runtime apps. Or is Embarcadero is planning full Metro support and is distinguishing from mobile apps.

There are also changes in FireMonkey to add support for Actions, Anchors, and Layout managers. Sensor and gesture support will be important for Windows 8 apps.

Finally there will be a SQLite database driver in XE3.

All the above, save the tour announcement, is unofficial and may be wrong or subject to change. I doubt the Metro name will feature so prominently in the eventual release, for example. And Metropolis?

Update

Looking at the wording here seems to confirm suspicions that Delphi and C++ Builder are not getting true Windows Runtime support:

  • Create Delphi, C++Builder and Prism applications with Windows 8 styling and functionality
  • Create HTML5 web apps and mobile apps for Android, iOS and more with new HTML5 Builder
  • Build Windows 8 apps with WinRT using Prism XE3 in RAD Studio

Otherwise, why would Embarcadero state “WinRT” for Prism but not for Delphi and C++ Builder?