Microsoft Visual Studio 2012 review
By Rick Grehan | InfoWorld | Published: 11:05, 02 November 2012
In concert with the arrival of Windows 8, .Net is being updated to version 4.5. Here, Visual Studio 2012 supports the new "async code" constructs in C# and VB.Net, which require new syntax elements in the languages and define new behaviors. Using the async and await keywords, you can identify potentially long-running methods - that is, methods that may be blocked waiting for an I/O response - but permit other parts of your code to continue executing, unimpeded by the blocked methods. Asynchronicity is key in Windows 8 apps. The Windows 8 application model is geared toward responsiveness, and many of the Windows 8 runtime APIs only support asynchronous operations.
When you define an async method, you're specifying that the method's results will be available at some unknown time in the future. The calling code can continue to execute, until it reaches a point where it must use the async method's return value. You identify this point with the await keyword. An async method returns a Task object, which encapsulates the rendezvous point (used by await) and provides access to the method's return value. In essence, the async and await keywords provide multithreading without your having to write callback functions, or thread startup and teardown code.
Not only does Visual Studio 2012 recognize the new async keywords, the IDE's debugger is also async-aware. You can debug an application as though the otherwise asynchronous code executed synchronously.
Turning C++ to 11
Visual Studio 2012 also supports new syntactic features for the C++11 standard. These include range-based iteration for loops, which lets you define an iterable - say, an integer array - and compose a for statement whose index is drawn from successive members of that iterable. Among other new features, C++11 also implements a standard thread class and supports atomic operations, which provide classes and template classes that give more expressive control over multithreaded access to objects.
In addition, Visual Studio 2012 supports C++ Accelerated Massive Parallelism (AMP), announced last year by Microsoft. C++ AMP is a programming model that exploits the data parallelism present in graphics processing units (GPUs) and provides data handling constructs, as well as math function libraries. Visual Studio 2012 not only recognizes the new constructs, but also includes a GPU debugger for working with C++ AMP applications.
Debugging C++ AMP applications is not the only graphics debugging feature in Visual Studio 2012. Perhaps one of the IDE's most interesting new capabilities is Pixel History. Used in debugging Direct3D applications, Pixel History lets you identify which piece of code is responsible for a specific pixel in your application's display and examine the events that affected the pixel over the application's lifetime. This is important if the rendered pixel is the result of a blending of two or more events that have modified it at different points in the past. You can step through the events and find the graphical primitive responsible for altering the pixel.
While Visual Studio 2012 looks forward to Windows 8, it doesn't shrug off its ancestry. The IDE is particularly tolerant of projects built by its predecessors. Provided that a project doesn't explicitly employ a feature available only in Visual Studio 2012, that project file can be opened either in Visual Studio 2010 or Visual Studio 2012. The notable exceptions to this are F# and LightSwitch projects. Once you allow Visual Studio 2012 to upgrade such projects, they can no longer be opened in Visual Studio 2010. The reason given for these exceptions is the relative novelty of F# and LightSwitch. Microsoft deemed it unlikely that a large legacy codebase existed for either, so focused less effort on preserving backward compatibility with such projects.
In addition to all the new capabilities, some welcome features in the IDE have been updated. Code snippets have been improved with the inclusion of "surround with" snippets. Whereas ordinary code snippets are pieces of skeletal code for common constructs that you simply "pour" into a single location (like a glorified paste operation), "surround with" snippets let you define an enclosing construct -- such as an if statement and its accompanying body -- that surrounds a section of selected code.