Windows Phone 8 introduces some very hot features from Common Language Runtime that provide tremendous benefits to Windows Phone application developers.
Here is the list of top 6 Common Language Runtime features that were introduced in Windows Phone 8.
1. Faster Code Generation
Windows Phone 8 has enabled optimization for code generation by the Just-In-Time compiler. This allows for improving the application performance. By having application files precompiled to native in the cloud, Windows Phone store guarantees best performance of a Windows Phone 8 application.
The .NET framework engine behind Windows Phone 8 is multi-core aware and supports the ThreadPool class. This support allows applications to create threads.
Additionally, the task parallel library offers Windows Phone 8 application all thread synchronization primitives to leverage multiple cores.
Note that Thread.Sleep in Windows Phone 8 does not perform standard COM and SendMessage pumping. Calling Thread.Sleep in Windows Phone 8 will make the application unresponsive, blocking DispatcherTime and BackgroundWorker events.
The performance of async and parallel operations that use classes, which reside in System.Threading.Tasks namespace has been improved in Windows Phone 8.
3. Security Model
The security model in Windows Phone 8 has changed compared to Windows Phone 7.1. There is no managed sandbox (which has been removed in Windows Phone 8), resulting in security exceptions like MethodAccessException not to be thrown in typical cases.
4. Garbage Collection
GC (Garbage Collection) in Windows Phone matches Silverlight. (There are three generations in Windows Phone 8, unlike Windows Phone 7.1, which had only 2 generations).
The resource manager for the phone automatically invokes Garbage Collection when memory is short, and it can additionally terminate the application if it exceeds the memory cap.
The garbage collector in Windows Phone 8 includes a large object heap (LOH), however, background garbage collection is no longer offered in WP8.
5. Portable Class Libraries
With Portable class libraries, application developers can write class libraries that they can share across modern applications on Windows 8 as well as mobile applications on Windows Phone 8. This is supported by the Portable Class Library project template in Visual Studio 2012.
A Portable Class Library that is targeted for Windows Phone 7.1 and Windows Phone 8 can be run on Windows Phone 8 without any issues.
Windows Phone 8 applications can directly invoke Windows Runtime APIs from managed code, reducing memory and other interop issues.
In this article, we learned about new common language runtime features that we released as part of Windows Phone 8. I hope you have found this information useful.
About the Author
Vipul Patel is a Program Manager currently working at Amazon Corporation. He has formerly worked at Microsoft in the Lync team and in the .NET team (in the Base Class libraries and the Debugging and Profiling team). He can be reached at [email protected]