Visual Studio 11 .NET Advances


In my first post of this Visual Studio 11 series, I discussed some of the language-level innovation in the Visual Studio 11 Developer Preview.  In this second post, I’ll take a look at some of the improvements that have gone into the .NET Framework 4.5 Developer Preview.

Languages enable developers to express their intentions for the behavior of their programs.  To be as productive as possible, however, developers rely on runtimes and libraries to encapsulate commonly needed functionality.  Our teams have augmented.NET 4.5 significantly to enable developers to be as productive as possible while building out rich, reliable, and high-performance software in managed code.  My goal here is not to detail every new feature that’s been included (such an endeavor would warrant an entire book), or even to touch on every area of the Framework that’s been improved. Instead, I simply want to highlight a few additions that I believe are representative of the forward strides we’re making. For a broader look at what’s new in .NET 4.5, I recommend Joshua Goodman’s talk from //BUILD/ as well as the MSDN documentation on the topic.

Performance

For the .NET Framework 4.5, a lot of effort has gone into improving performance, both in terms of improving the performance of existing code as well as into providing new support for writing code that just runs faster, that’s more responsive, and that’s more scalable.

The Common Language Runtime (CLR) team has focused heavily on improving the performance of the runtime environment itself.  With additions like background server garbage collection, multi-core background JIT compilation, and profile-guided optimization, managed applications (especially those on the server) can now start faster and run with better throughput and lower latency.

Performance improvements extend beyond the runtime execution environment, as core components throughout the Framework have been rewritten internally to provide improved performance in key scenarios.  For example, the Stream class in .NET sits at the heart of most I/O-related operations, and asynchronously reading and writing with Stream is extremely common; these operations now have significantly less overhead in .NET 4.5.  As another example, ItemsControl in Windows Presentation Foundation (WPF) has been made much faster at handling certain kinds of data.

This work in streams is part of a larger focus on asynchrony in this release. As I mentioned in my previous post on languages, C# and Visual Basic have both been extended with first-class language support for writing asynchronous code.  That support extends well beyond the languages and into the libraries in the .NET Framework.  New task-based APIs have been added across the Framework, including in core Base Class Library (BCL) types, throughout the networking and Web services stacks, in the System.Xml and System.Data libraries, and more.

For more information, I recommend the following talks from //BUILD/:

Networking

It’s relatively rare these days to see an isolated application, one that doesn’t communicate in one way or another.  .NET has historically been rich with high-quality networking libraries, whether for low-level socket-based programming or for high-level communication via Web services.  .NET 4.5 builds upon that foundational support to enable the development of increasingly connected applications. While there are a multitude of interesting networking-related improvements in the .NET Framework 4.5, I want to call attention to three in particular.

WebSockets is a new bidirectional communication protocol that supports low-latency communications between client and server. It’s great for implementing interactive applications, such as online games, that benefit from server to client “push,” and .NET 4.5 includes support for WebSockets both in ASP.NET and in Windows Communication Foundation (WCF).  This release of .NET also sports the new HttpClient class, which enables clients and servers to easily and efficiently consume existing web APIs.

The other advance I want to call attention to is the integration of Tasks with WCF.  With the aforementioned language support, asynchronous APIs across the Framework are being exposed via tasks.  Beyond these APIs included in .NET, however, there are also APIs generated for you by Visual Studio.  One significant source of such APIs is for WCF Web service endpoints, as created by the Add Service Reference… dialog.  In previous releases, this tool by default only generated synchronous operations, and you could use the advanced configuration dialog to opt-in to having asynchronous operations exposed.  Now in Visual Studio 11 Developer Preview, by default the tool will not only generate asynchronous operations, it will do so using the task-based asynchronous pattern.

 

This means that all Web services to which you add service references will immediately support being awaited in asynchronous methods.  Here’s an example of using one such generated proxy to make asynchronous calls to search Bing:

For more information on the networking improvements in .NET 4.5, I recommend the following talks from //BUILD/:

Interop

A look at advancements in the .NET Framework would not be complete without an acknowledgement that the Framework itself contains only one of the sets of libraries your applications use.  In addition to all of the libraries from the .NET Framework that you rely upon, you also rely upon libraries of your own creation and of those created by 3rd-parties.  Historically, many of the libraries used in your applications have been thin wrappers on top of operating system functionality exposed by Windows… accessing the file system, accessing audio and video devices, and more.  Since the first release of .NET, the CLR has provided the ability to interop with such capabilities, but doing so has rarely been a trivial exercise.

With .NET 4.5 and with the advent of the Windows Runtime (WinRT), the need to create such interop wrappers becomes a thing of the past.  Through advancements in the CLR, your .NET applications can reference the metadata files for these components, and the CLR takes care of the interop details necessary to enable you to use these components as you would other .NET libraries.  This is a terrific productivity boon for developers.

For more information on the interop improvements in .NET 4.5, I recommend the following talks from //BUILD/:

There is a huge amount of functionality I’ve skipped past and glossed over in this post.  The BCL, the Managed Extensibility Framework (MEF), System.Xml, System.Net, WPF, ADO.NET, ASP.NET, WCF, Windows Workflow Foundation, Parallel Computing, and on… they’ve all received good attention in this release, and I’d encourage you to explore on your own to learn more about the work the teams have delivered.

Namaste!

Comments (18)

  1. Quppa says:

    Will .NET 4.5 and VS11 support Windows XP and Windows Vista, or is that still up in the air?

    Regarding WPF programs built with .NET 4.0 and earlier (and .NET 4.5, for that matter): will there be automatic support for the new Windows Basic and high contrast themes found in Windows 8? In the Windows Developer Preview, the Windows Classic theme is used to draw buttons and other standard controls (and the Windows Classic theme is not even present in the WDP).

  2. Interop on Win7? says:

    WRT "With .NET 4.5 and with the advent of the Windows Runtime (WinRT), the need to create such interop wrappers becomes a thing of the past."

    I assume this is only true if you're only targeting Win8, since Win7 doesn't/won't have WinRT and you'll still need to do 'painful' interop if running on Win7 is a requirement for your app?

  3. Radu says:

    Hi Soma,

    What does 'Namaste' mean?

    Best regards,

    Radu

  4. Victor says:

    Good article.

  5. toub says:

    Thank you all for your comments and questions.

    "Quppa", the system requirements for the .NET Framework 4.5 Developer Preview and the Visual Studio 11 Developer Preview are available on the download pages at http://www.microsoft.com/…/details.aspx and http://www.microsoft.com/…/details.aspx.  Requirements for subsequent releases beyond these Developer Previews have not been announced.

    "Interop on Win7?", the interop support mentioned in this post is specifically in regards to the Windows Runtime.  When interoperating with functionality exposed via COM or Win32, the standard .NET mechanisms of COM interop and P/Invoke still apply.  Further questions about WinRT will be best addressed on the forums at social.msdn.microsoft.com/…/threads.

  6. How about... says:

    Most of the performance enhancements planned for Studio 11 came from mistakes learned from VS 2010.  How about giving VS 2010 a SP2 with these fixes??  It seems when you start talking about the next version, you conveniently forget all about those who paid for the previous version.

  7. Eric Marquez says:

    Hi!

    Will Visual C++ include intellisense in this new VS edition? Thanks!

  8. Charles Kincaid says:

    Where is Windows Mobile in all of this?  Are we Mobile developers to be left out in the cold again?

    Radu,

    'Namaste' is a greeeting that is often used at the end of a conversation but also at the begining of a face to face encounter.  As one person related to me the translations is "I see god in you."  The lower case being quite intentional.  It's complementary and very cool.

  9. Z800 says:

    Let me look into my crystal ball…

    > 2016

    > .NET58

    > still something nobody really needs

  10. toub says:

    Eric, Visual C++ does support IntelliSense in Visual Studio 11 Developer Preview.

    Charles, Windows Phone is an active area of investment, with a lot of focus being put on development tools.  You can download the latest suite of tools for Windows Phone 7 and Windows Phone 7.5 from http://www.microsoft.com/…/details.aspx.

    "How about", thank you for the comments and feedback on performance.

  11. Dean says:

    When you are nailing down Studio 11's upgrade price, please consider a lower cost for owners of VS10 (much lower than you normally would).  VS10 is a Vista, and those who bought it got stuck with a sluggish app with nowhere near the stability of VS 2008.  You wouldn't have to do this lower price every time, but it would be appropriate and fair considering the state of VS10.

  12. Dave says:

    I am with holding judgement but not holding my breathe either. It has been a long time since MICROSOFT released anything note-worthy. I do find it laughable, based on history of Microsoft products, that you use productivity and Visual Studio in the same sentence. This tool is far from productive as a matter of fact it has taken significant strides backwards. I am astounded that lingering bugs go unfixed, work-around still are common place and VS is mildly better then using notepad. Not much to be proud of. Actually on second thought I use notepad for quick fixes it's more stable.  

  13. WilkoSki says:

    What about the re-introduction of support for native and managed development on Windows CE platforms, not just WinPhone7 (i.e. SmartDevice Extensions).  MS shot themselves in the foot by secretly dropping support for this in VS2010 and the ensuing developer backlash.  Typically though MS has thrown their toys out of the pram refusing to acknowledge or discuss their mistake.

    MS releases WinCE 7 and expects people to continue developing for it using VS2008. This causes fragmentation of the development and build processes which in turn means less productivity and more cost.  If MS is truly committed to the Embedded space as they keep telling us then you need to give us the tools to do the job.  I'm aware of several large organisations who previously built products on WinCE and have now ditched it for their next generation of embedded devices purely because MS has not provided any information on their strategy and the development tools are out of sync.

    Perhaps you're still ignorant of the backlash, just do a quick search for VS2010 Compact Framework and see what you find.

    Also take a look at your own Connect site http://tinyurl.com/3ctgqda

  14. David Espino says:

    Any Native Social Networking Classes or helpers?, there are lots of differents frameworks accross the web (I've created mine); but it should be great if VS 2011 could integrate some of them as standard.

  15. thasay says:

    The update process takes WAY TOO long!!!!!!! My rate is $125 per hour, who at Microsoft is going to pay me??

  16. toub says:

    WilkoSki, thanks for the follow-up.  You can read more about the Windows Embedded roadmap at http://www.microsoft.com/…/11-14RoadMap.mspx.  In particular, you might be interested in the paragraph: "Dallas also confirmed that Microsoft updated Windows Embedded Compact 7, the current generation of the Windows Embedded CE platform, in October 2011, and Windows Embedded Compact v.Next will follow in the second half of 2012, introducing support for Visual Studio 2010."

    David Espino, there is currently nothing like that in Visual Studio 11 Developer Preview, but it's something that's been talked about, and it's something we'll continue to look at moving forward.

  17. Micle says:

    Nice Article, it is very useful

    We can submit .net related article links on http://www.dotnettechy.com/ to increase traffics