Take advantage of the new features and enhancements in Visual Studio 2013 for better developer productivity.
Released late last year, Microsoft's Visual Studio 2013 is a widely used, popular IDE—the next-generation IDE for software developers willing to develop applications that leverage at the managed environment. Visual Studio 2013 is built on the features available in Visual Studio 2012 and subsequent Visual Studio Update releases. This article presents a bird's-eye view of some of the new features and enhancements in the Visual Studio 2013. It also discusses in brief the new features and enhancements to Microsoft .NET Framework 4.5.1. Note the .NET Framework 4.5.1 comes with Visual Studio 2013.
The minimum software requirements for you to have Visual Studio 2013 up and running in your system is that you should have Windows 7 or later installed with a minimum of 1 GB of RAM. I use 8 GB in my laptop, and Visual Studio 2013 works just fine. Here's a quick look at the hardware requirements and supported operating systems.
- 1.6 GHz or faster processor
- 1 GB of RAM
- 20 GB of available hard disk space
Operating systems that support Visual Studio 2013:
- Windows 8.1 (x86 and x64)
- Windows 8 (x86 and x64)
- Windows 7 SP1 (x86 and x64)
- Windows Server 2012 R2 (x64)
- Windows Server 2012 (x64)
- Windows Server 2008 R2 SP1 (x64)
You can download a copy of Visual Studio 2013 from the Visual Studio downloads page. You can download a trial copy of Visual Studio 2013 Ultimate here. After you download and install Visual Studio 2013 in your system, you will be prompted to sign in using your Microsoft account (hotmail.com, live.com, etc.).
Figure 1: The Welcome page will prompt you to sign in.
Now, the reason this feature is provided is that it allows you to use Visual Studio 2013 from different systems while at the same time preserving and using the same settings on each of the nodes. When you sign in using your Microsoft account, your settings are synched; you can use the same Microsoft account that you used to sign in from one system to be applied in another system when you sign in. In essence, this saves you the time needed to otherwise configure your settings each time you use Visual Studio 2013 from a new system.
New Features and Enhancements in .NET Framework 4.5.1
Microsoft .NET Framework 4.5.1 comes with Visual Studio 2013. You also have multi-targeting support in Visual Studio 2013 IDE; you can compile your application to generate assemblies that are targeted at earlier versions of the framework. Note that multi-targeting support in Visual Studio was first introduced in Visual Studio 2010.
Microsoft .NET Framework 4.5.1 provides support for Multi-Core JIT, which can improve your application launch time considerably. Multicore JIT compiles methods on two cores in parallel. It uses two modes of operation: recording mode and playback mode. While in the former the JIT compiler records all the methods it has to compile and saves a profile of the methods that have been executed, the latter loads the profile information to compile the methods using a background thread. These profiles are stored in the disk.
The CLR uses two types of heap for storing objects: the small object heap (SOH) and the large object heap (LOH). Note that LOH is not compacted, which can lead to memory leaks as fragmentation can occur due to non-availability of adequate free memory.
With .NET 4.5.1 you have built-in support for on-demand LOH compaction. You can now compact the large object heaps using the following code:
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
Note that LOH compaction is an expensive operation and should be used only after you perform a through memory analysis.
With .NET Framework 4.5.1, you now have a new worker process state: the suspended state. In this state, your website will be transitioned into a suspended state in which the CPU and memory resources the website needed while it was active are released. Suspended sites are those that were in the running state earlier and have been paged out into memory. To enable this feature, you need to start IIS manager and right-click on the application pool on which you would need to have this feature. You would then have to select the "Idle Time-out Action" property and select the value as "Suspend." When the App Suspend feature is enabled in IIS, your application start-up time would drop drastically.
Figure 2: These are the states of the IIS worker process
ADO.NET idle connection resiliency is another great new feature added to .NET Framework 4.5.1. It can work in both synchronous and asynchronous mode. This feature helps you to recover broken or idle SQL Server connections automatically so you no longer need to write code to re-establish broken connections to your database.
IDE Enhancements in Visual Studio 2013
Visual Studio 2013 includes many new features and enhancements to the IDE. This section discusses most of these with screenshots wherever appropriate.
Peek Definition Window
Visual Studio 2013 includes the new Peek Definition Window. Peek definition allows you to see the definition of a method without having to open the file in which the method is present. To invoke the Peek definition window, all you have to do is select the method for which you would like to see the definition, right-click, and then select "Peek Definition" from the drop-down list that appears. You can invoke the Peek Definition Window by pressing Alt + F12.
Figure 3: The Peek Definition window is shown.
Figure 4: Look inside the Peek Definition window.
The introduction of CodeLens is one of the most striking new features in Visual Studio 2013. CodeLens is a window to your source code, a window that acts as a lens and enables you to see things that you cannot see by just looking at the source code in the IDE. You can use CodeLens to find references, changes to your code, linked bugs, work items, code reviews, and unit tests without having to leave the editor. Note that you can use CodeLens together with CodeMap in Visual Studio 2013 IDE. You can enable CodeLens in your Visual Studio 2013 IDE by going to Tools > Options > Text Editor > All Languages > CodeLens > Enable CodeLens in the menu.
Figure 5: Enable CodeLens.
Auto Brace Complete
The Auto Brace Complete feature is a Productivity Power Tool in Visual Studio 2013 IDE. This amazing new feature automatically adds the closing parenthesis, quote, bracket, or brace when you are writing your code in the code editor.
The Navigate To feature was first introduced in Visual Studio 2010, and it has been extended a lot in Visual Studio 2013. It enables you to type a part of a symbol (class, property, method, etc.) and then locate its definition using semantic search. As an example, say you have a method that calculates the salary of an employee but you don't remember the exact name of the method. You can just type in the name you remember and then use this feature to search for this method in files, classes, properties, methods, or other symbols that contain the text you have typed. You can invoke the Navigate To feature by pressing the CTRL and comma keys together on a symbol.
Figure 6: Use "Navigate To" in Visual Studio 2013.
Other Interesting Features
The Just My Code feature is another addition. When enabled, it allows you to debug your code while ignoring frameworks and other code. To enable this feature, turn it on from Debug > Options and Settings > General > Enable Just My Code.
Figure 7: Enable Just My Code in Visual Studio 2013.
You now have live debugging and tracing support for your Azure websites. Another new feature in Visual Studio 2013 is Browser Link, which enables you to refresh the browser window from within the Visual Studio 2013 IDE. Visual Studio 2013 also provides better support for developing Windows 8.1 applications.
Enhanced Support for Performance, Debugging, and Optimization in Visual Studio 2013
Visual Studio 2013 provides better support for optimization and debugging. With Visual Studio 2013 you have many tools that can help you to develop, optimize, debug, and diagnose applications seamlessly.
When you write programs in .NET's managed environment, you need not explicitly clean the objects that are created at runtime to free up the space occupied by them. The Garbage Collector of .NET takes care of cleaning up unused memory as and when needed. However, there can be unnecessary allocations and memory leaks due to inefficient memory usage. Your application can crash out due to "Out of Memory" exceptions or exhibit decreased performance if resource consumption is high. In order to analyze the potential memory leaks, you need to collect memory data and create memory dump files. Such files have a .dmp extension. Visual Studio 2013 includes a new feature named Memory Dump Analyzer that can help you to analyze memory dumps and detect why memory leaks have occurred. You can also compare two memory dumps to see how memory consumption has changed over time. It should be noted that Memory Dump Analyzer is available in Visual Studio 2013 Ultimate edition only.
Debugging is a feature that enables you to break into the source code to inspect and detect runtime errors. Visual Studio 2013 comes with improved support for debugging. The Edit and Continue feature enables you to edit your source code while in debug mode. The earlier versions of Visual Studio provided support for this feature only for 32-bit applications. With Visual Studio 2013, support for this feature is available for both 32-bit and 64-bit environments. You can verify whether this feature is enabled in the Visual Studio 2013 IDE from the Tools > Options menu option.
Figure 8: Use the Edit and Continue feature in Visual Studio 2013.
Another interesting new feature in Visual Studio 2013 allows you to examine the return value of a method while you are in the debug mode. You can explore this feature using the Autos Window. To enable this window, you need to choose Debug >Windows >Autos from the menu while you are in the debug mode. The Autos window displays the values of the objects for both the current and the previous statement. You can also change values of objects in the Autos window while still in the debug mode. Note that you can also examine the return values of a method by typing $ReturnValue in the Immediate window.
Visual Studio 2013 provides enhanced support for asynchronous debugging. Support for asynchronous debugging was available in Visual Studio 2012 as well. However, with Visual Studio 2013, you have a much cleaner view of the call stack for methods that execute asynchronously. The tasks window is also improved; you can now see the active tasks, completed tasks, and scheduled tasks in the tasks window.
TypeScript Support in Visual Studio 2013
Typescript support doesn't come with Visual Studio 2013 by default. You can use the TypeScript project template for Visual Studio 2013. When you select this template, you will be taken to the site from where you can download and install the latest version of TypeScript. Note that TypeScript 1.0 is a part of the final release of Visual Studio 2013 Update 2.
Figure 9: Create a new TypeScript Project in Visual Studio 2013.
Better Support for Application Lifecycle Management
Application Lifecycle Management comprises of a collection of tools that include IDE, source control, work items, collaboration, metrics, reporting tools, etc. Visual Studio Application Lifecycle Management consists of the following:
- Visual Studio IDE
- Visual Studio Test Professional
- Team Foundation Server
- Visual Studio Lab Management
You can use Visual Studio Team Foundation Server (TFS) 2013 for better version control, efficient management of your product lifecycle, reduction of the risks involved in the project, and deployment facilitation, testing, and overall team collaboration and productivity.
With release management in Visual Studio, you can configure, approve, and deploy your applications for any environment. You can create automated deployment orchestrations for each environment, no matter how complex the configuration. You'll be able to deliver your software more frequently and easily to an environment that allows your testers to get to work validating your system and keeps your stakeholders involved in giving feedback.
Release management for Visual Studio 2013 incorporates InRelease. InRelease is a product from InCycle software. Release management in Visual Studio 2013 enables you to manage application releases and helps you to easily and more confidently configure and automate complex deployments. Note that you should install Release Management Server for Team Foundation Server 2013 before you start using the release management capabilities of Visual Studio 2013.
CodeMap: Debug Your Code Visually
When you are in the debug mode in the Visual Studio 2013 IDE, you will find an option called CodeMap in the toolbar. When you click on this, you will be able to see a visual representation of the flow of execution of your code in a new window.
Figure 10: Use CodeMap in Visual Studio 2013.
This option helps you to debug your source code with ease, and most importantly, you can easily understand the flow of execution. CodeMap helps you to understand the dependencies in your code, which this comes in handy for debugging complex code. You can use CodeMap to navigate across pieces of code and understand the relationships. You can do many more things with CodeMap: you can navigate and examine the code, highlight the references, change colors, and add comments if you need to.
Figure 11: Explore CodeMap
Visual Studio 2013 is one of Microsoft's most popular IDEs. In this article, we explored some of the new features and enhancements to this IDE and learned how we can make best use of it. Leverage these features and enhancements to the best extent to improve developer productivity. Happy reading!
MC Press Online