Microsoft Visual Studio 2013 Tips and Tricks
Microsoft released Visual Studio 2013 on November 13, 2013. With this new release came many cool features for .net developer’s to take advantage of. I’ve outlined below some of the new features that I’ve found most interesting.
- resolve menu typing
- creating new Azure site’s from VS 2013
- live debugging in Azure
- live tracing from Azure
- 64 bit Edit and Continue
- return value inspection
- just my code
- peek a definition
Open the Resolve menu when typing happens once in a while that you haven’t included the namespace you need at the top of your file. One common example is Trace found in System.Diagnostics. If you write Trace, Visual Studio suggests TraceMode and other things, but no Trace. To quickly solve this, type Trace followed by CTRL + SPACE + . and the Resolve menu comes up where you can select to include using System.Diagnostics; to make Trace available.
Create a new Azure website from within VS there is no need to open the Azure portal and create a website there before you publish it using Visual Studio. Now you can do it directly within. You need to make sure you’ve installed Azure SDK 2.2 and can connect to Azure properly.
Live debugging in Azure After you’ve published your website you can also, using live debugging, step through the executed code line by line as if it was on your local machine. Locate your published website under Server Explorer -> Windows Azure -> Web Sites. Right-click on your website and select Attach Debugger.
Live tracing from Azure in the same way you can do live debugging you can also make all trace messages, written in an Azure application, end up in your Visual Studio’s Output window.
Add trace messages to your code simply by writing like this.
Ex. Trace.WriteLine(“This is my trace message”).Don’t forget to re-publish your application if you make any changes to your code.
Locate your website under Server Explorer as you did in the previous step. Right click on it and select View settings. Change Application logging (File system) to Verbose and click Save as done in the picture. Right click on the website again and this time select View streaming logs in Output window. In the Output window you can then see all the trace messages as they are being processed. Don’t forget to turn off Verbose debugging after having done your testing. You might end up with huge amounts of log files otherwise.
64 bit Edit and Continue have we been waiting for this one. Finally, by using .Net Framework 4.5.1, we can have the same edit and continue for 64 bits as we’ve been able to with 32 bit code for ages.
Return value inspection to help out the debugging process you can now easily see return values of functions being used as parameters in other function calls, for example if you nest several functions in each other.
public partial class MainWindow : Window
Random rnd = new Random();
Foo(Bar() * Bar());
void Foo(int p)
After you’ve stepped over line 7 (the call to Foo) this is what you’ll see in the Autos window. We called Bar twice inside the calling to Foo and the results can be seen here.
Peek a definition It’s now possible to open up a method definition without having to open that specific file. You can even open up a section located further up/down in your current file without having to leave the location you are at now. This feature is called Peek Definition and can be accessed through ALT + F12 or by right clicking the method and select Peek Definition. Here is an example where I’m peeking on the InitializeComponent() method.
All of these cool features will help developers code faster and more effectively.
There are many more new features like the new .Net framework 4.5.1, and visual studio online. Which are your favorite ones? Let us know in the comments below.