Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has Airspace Support Definitely Been Dropped in WPF 4.5?

Tags:

wpf

.net-4.5

As I write this question, 2 days after the beta of .NET 4.5 was released, the What's New in WPF 4.5 Version 4.5 Beta page on MSDN still lists "Integrating WPF with win32 Graphical User Interfaces" as an area in which WPF 4.5 offers improvements. That page talks about the two new properties on HwndHost that support this: IsRedirected and CompositionMode. Also, the top-level what's new in .NET 4.5 beta page mentions this integration as a new feature.

Again, as I write this, there are pages for those two items. You've got IsRedirected here and CompositionMode here. (Update 27th Jan 2014: original pages no longer available, so I've moved these links to point to the Internet Archive copies.)

However, if you go to the docs for HwndHost itself, neither of those properties is present. And they don't appear to be in Visual Studio either.

So it would appear that the rumours are true - it looks like the airspace improvements for interop have been dropped. But just in case anyone from Microsoft is reading this, it would be good if a) we could get positive confirmation and b) the pages mentioned above could be updated to stop getting our hopes up.

Update 27th Jan 2014: I've updated the links for IsRedirected and CompositionMode to point into the Internet Archive, because the original links are now dead. Also note that the What's New pages no longer mention this because those links are now for the final release. You can see the old pages that were current when I originally asked this question at this archived page and here.

like image 504
Ian Griffiths Avatar asked Mar 02 '12 14:03

Ian Griffiths


2 Answers

There is a rather good blog post from Dwayne Need that describes the extraordinary effort they put in trying to make it work. Nothing subtle, they for example ending up intercepting over 200 GDI functions to get them to play along with the WPF rendering model. The outcome was to be expected:

You can imaging my heartbreak when, after an extensive review, we decided we could not actually ship this feature. Our concern was that we had to hack too deeply into the system, and in ways that were too difficult to explain - let alone maintain. Even though we required that developers explicitly turn on this feature for each HwndHost, we felt the kinds of problems they would encounter would be baffling to them and training our support engineers to handle the escalations would be very difficult. Even towards the end of our development, we were struggling with a long bug tail and performance concerns.

This is exactly the kind of deep system integration that needs to be done by the Win32 platform team, officially sanctioned and supported. With Win8, we are beginning to see some incremental improvements in this space, as noted before in the DirectComposition API. Unfortunately, it is still not possible to build the same kind of rich composited experience we had developed.

Whether the Windows group is going to commit to providing this kind of integration is right now an open question. They certainly put their money on a very different horse and spent a lot of effort on WinRT, a rendering model that's certainly inspired by WPF but doesn't do anything to make it better. If it is going to be tackled at all then count on years to get there.

Do check the rest of the blog post as well. It has excellent, albeit it high-level, advice on addressing existing airspace issues.

like image 195
Hans Passant Avatar answered Nov 12 '22 10:11

Hans Passant


A suggestion to "Bring back the HwndHost.IsRedirected and CompositionMode" was posted at the Visual Studio UserVoice.

Microsoft declined it, saying:

at this time, we will not be able to add the feature to WPF and the .NET Framework.

It also looks like the MSDN pages you linked to have been taken down.

like image 31
Bradley Grainger Avatar answered Nov 12 '22 09:11

Bradley Grainger