DESKTOP

Windows 8 Architecture from a Developer’s Point of View : .NET Framework 4.5

3/11/2014 9:21:32 PM

Two programming languages that support Windows 8 style applications — C# and Visual Basic — run over the .NET Framework. Windows 8 has been released with a new version of .NET Framework — version 4.5. The development architecture picture would not be complete without understanding what’s new in this version, and how .NET Framework cooperates with Windows Runtime.

The Installation Model of .NET Framework 4.5

Since 2002 (when .NET 1.0 was released), there have been several ways for a new .NET Framework release to cooperate with previous releases, as shown in Figure 1. Although the first three versions (1.0, 1.1, and 2.0) were shipped with different CLR versions that could run side-by-side on the same computer, subsequent versions followed a different path.

Figure 1: The relation of .NET versions

c03f013.eps

When .NET Framework 3.0 was released in 2006, it did not install its own CLR. It was simply an addition to version 2.0 and used its runtime core. The same thing happened with .NET 3.5 in 2007. It was an addition to .NET 3.0, and still used the CLR released with .NET 2.0.

In 2010, .NET 4.0 was released, again with its own CLR, encapsulating the enhanced forms of Base Class Libraries coming from .NET 3.5. Theoretically, in 2010, you could install four CLR versions side-by-side on your computer: CLR 1.0, CLR 1.1, CLR 2.0, and CLR 4.0. The newest .NET Framework, version 4.5, added more salt to the installation models used before. Instead of adding a new CLR side-by-side or new Base Class Libraries on top of the CLR 4.0 runtime, .NET 4.5 is an in-place update (that is, an update that not only adds new files, but overwrites existing ones) that changes both the CLR 4.0 runtime (it upgrades it to CLR 4.5) and also extends the prior Base Class Libraries.


NOTE An in-place operating system update or .NET CLR update is always a big risk from a compatibility point of view. With the .NET Framework 4.5 release, Microsoft undertook this risk, and spent much effort to cope with potential incompatibility issues. Microsoft set up a compatibility lab, reviewed all bug fixes and new features, and ran old tests unchanged.

Window Runtime Integration

The .NET CLR has always had integration features with other legacy technologies, such as COM and P/Invoke (Platform Invoke to access the Win32 API). With .NET Framework 4.5, the CLR natively integrates with Windows Runtime. C# and Visual Basic programmers now can use Windows Runtime types with the same ease, as if those were .NET types.

Windows Runtime types are native types. They actually use a new and modern version of COM that does not require object registration, and so their operations cannot be called directly from managed code. However, the .NET CLR and the language compilers arrange everything behind the scenes, and you do not need to deal with the details of calling the native Windows Runtime object from your managed code.

Both the desktop application and Windows 8 style application development stacks contain a .NET Runtime box. You may think this means that two different .NET Frameworks exist, one for the desktop applications and one for Windows 8 style applications. Fortunately, there is only one.

The Base Class Library available to Windows 8 style applications (Windows Runtime applications) is restricted to services that are considered “safe” for a Windows 8 application to use. When you try to build your existing .NET source code, some parts would not compile, because those might be using some .NET Base Class Library functions that are not found in Windows Runtime, or are not thought “safe” in Windows 8 apps.


NOTE Generally, all operations are taken into account as “safe” that do not jeopardize UI responsiveness.

Asynchrony Support

As you have learned, asynchronous programming is a key technique to provide UI responsiveness, and Windows Runtime was designed with asynchrony in mind. The results of the Windows Runtime design process inspired the .NET Framework team, and they added asynchrony support to many components of the framework. The .NET Base Class Libraries contain hundreds of changes and improvements, including the following most significant ones:

  • The key interfaces of the Base Class Library (for example, file I/O operations) support asynchrony.
  • Data access procedures in ADO.NET (the foundational data access technology in .NET), and network communication components in Windows Communication Foundation (WCF), also handle asynchronous constructs as first-class operations.
  • ASP.NET supports asynchronous pipelines when processing requests and creating responses. ASP.NET MVC 4 provides asynchronous controllers.
  • The Task Parallel Library — introduced in .NET Framework 4.0 — was designed with asynchronous programming in mind. In .NET Framework 4.5, its thread-management was improved with new types managing synchronization and various timeout scenarios.

Although the asynchronous programming patterns provide better UI responsiveness and improved throughput, it is quite difficult to apply them, and they are pretty error-prone. With .NET Framework 4.5, the C# and Visual Basic compilers provide two new keywords (async and await in C#, Async and Await in Visual Basic) that take over all complexity related to these patterns.



Other  
  •  Windows Server 2008 R2 Powershell Cmdlets (part 6) - Windows Server Backup cmdlets
  •  Windows Server 2008 R2 Powershell Cmdlets (part 5) - Server Manager cmdlets
  •  Windows Server 2008 R2 Powershell Cmdlets (part 4) - Group Policy cmdlets
  •  Windows Server 2008 R2 Powershell Cmdlets (part 3) - Failover Cluster cmdlets
  •  Windows Server 2008 R2 Powershell Cmdlets (part 2) - AppLocker cmdlets
  •  Windows Server 2008 R2 Powershell Cmdlets (part 1) - Active Directory cmdlets
  •  Windows Server 2008 R2 : PowerShell V2 feature focus - Installing Powershell, Introduction to Powershell Scripting
  •  Windows Server 2008 R2 : PowerShell V2 feature focus - Introduction to Powershell
  •  Installing Windows 8 on startup VHD files (part 3) - Starting the system from the VHD, Removing VHD installations
  •  Installing Windows 8 on startup VHD files (part 2) - Creating the VHD during the installation by using DiskPart
  •  
    Top 10
    3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
    3 Tips for Maintaining Your Cell Phone Battery (part 1) - Charge Smart
    OPEL MERIVA : Making a grand entrance
    FORD MONDEO 2.0 ECOBOOST : Modern Mondeo
    BMW 650i COUPE : Sexy retooling of BMW's 6-series
    BMW 120d; M135i - Finely tuned
    PHP Tutorials : Storing Images in MySQL with PHP (part 2) - Creating the HTML, Inserting the Image into MySQL
    PHP Tutorials : Storing Images in MySQL with PHP (part 1) - Why store binary files in MySQL using PHP?
    Java Tutorials : Nested For Loop (part 2) - Program to create a Two-Dimensional Array
    Java Tutorials : Nested For Loop (part 1)
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    VIDEO TUTORIAL
    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
    Popular Tags
    Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS