BT

How VS2015 Update 2 Improves .NET Native Code

| by Jeff Martin Follow 16 Followers on Apr 26, 2016. Estimated reading time: 1 minute |

Microsoft continues to put forth new features and capabilities into Visual Studio 2015.  The latest changes, designated Update 2, is no exception as it has been packed with several updates to the .NET Native compiler.  As you may recall, when .NET native is used as a compilation target, Windows apps (defined here as UWP apps targeting Windows 10) are compiled directly to native code rather than the default Intermediate Language (IL). There are several advantages to doing so, principally developers can continue to write apps in C# or Visual Basic while users benefit from faster execution times, shorter startup times, and less memory usage as compared to a traditional IL-based app.

As can be expected, compiling .NET to native code does have some drawbacks.  Microsoft has prepared a lengthy list for what they deem to be “behavioral changes” between .NET Native and regular Windows apps.  Detailing all of these differences is beyond the scope of this article, but the salient point is that one of these changes concerns reflections on generic types.  As Microsoft’s Stacey Haffner and Matthew Whilden of the .NET team write, “Dynamism is a challenge when compiling to native code, since all of the code must be known and compiled at compile-time.” 

Because using static analysis to determine all of the generic instantiations is fairly complicated, the team is introducing Universal Shared Generics (UGS).  Now optimized code is generated where it is feasible to be represented by type specific code, and UGS is used when it is not.

Another big change that will benefit all developers targeting .NET Native is a switch in compiler backends used by the .NET Native project.  The new 1.3.1 release of the .NET Native tools now uses the “same whole program inlining engine” used by the Microsoft C++ compiler.  As time progresses the .NET team plans to utilize more of the optimizations the C++ compiler provides within the .NET Native project. 

To utilize these new compiler features, you will need to download the latest UWP App Development Tools (version 1.3.1 for Windows 10 SDK 10.0.10586) and the latest .NET Core UWP packages from NuGet.  Both of these should be installed on an instance of Visual Studio 2015 with Update 2 applied.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT