Peering into the cloud with IntelliTrace
In April, we introduced Visual Studio 2010 to the world. One of the breakthrough features we delivered in VS 2010 is IntelliTrace – a tool that enables you to do historical debugging and is a key part of addressing the ‘no repro’ scenarios that we always encounter. Customer feedback on this tool has been very positive.
Today, we are announcing the availability of the June 2010 release of Windows Azure Tools for Microsoft Visual Studio. This brings the power of IntelliTrace to cloud services running in Windows Azure for Visual Studio 2010 Ultimate customers.
Yesterday: Limited Visibility; Today: Clear Skies
One of the challenges of developing for Windows Azure is being able to “see into the cloud”, and new debugging tools let you do exactly that. In particular, the integration of IntelliTrace with the Windows Azure Tools allows you to historically debug issues that occur in the cloud right from your desktop.
Show Me How
To show you how the IntelliTrace integration with the Windows Azure Tools works, let’s create a new Windows Azure Cloud Service. Click on File | New Project | Windows Azure Cloud Service. Click to add an ASP.NET MVC Web Role, and click OK.
This solution will work just fine in the cloud, so let’s introduce an error that we can debug later using IntelliTrace.
In MvcWebRole1, click to open the References node, right click on System.Web.Mvc and select “Properties”.
Change the “Copy Local” property to False, which will cause the application to be deployed without its System.Web.Mvc dependency, causing a load time error in the application. This load time error is the error we will find and trace using IntelliTrace.
Now we can deploy our project to the cloud. Right click on the Cloud Service project and select “Publish”:
This will bring up the deploy dialog. Follow the steps to setup your credentials and pick a Hosted Service to deploy to. If you are using Visual Studio 2010 Ultimate and .NET 4, you can click the checkbox option to “enable IntelliTrace for .NET 4 roles”.
This will deploy the cloud service to Windows Azure, packaging in the necessary IntelliTrace files along with an agent that Visual Studio will communicate with to retrieve the IntelliTrace data. You can monitor the progress of the deployment from the Windows Azure Activity log and the status of the Hosted Service from the Windows Azure Compute node in the Server Explorer.
Because we added a load time error into this cloud service by changing the Copy Local property of one of our referenced assemblies to False, the web role never gets to the running state. Instead, our web role becomes unresponsive. You can see the activity log showing the web role as unresponsive above, and below, the Server Explorer shows the web role instance as unresponsive as well.
Now we can use IntelliTrace to debug the issue. Right click on the instance that is unresponsive and select “View IntelliTrace logs”.
This will communicate with the debugging agent in the cloud and create an IntelliTrace log that Visual Studio will display to you. Once the file is open, navigate to the Exception Data and you’ll see the error “Could not load file or assembly System.Web.Mvc”. Now you can change the Copy Local property of the assembly to false in your project, rebuild, and redeploy your web role to ensure you’ve fixed the problem. While this is a simple issue with a quick fix, without IntelliTrace, this error could be very difficult to diagnose because it won’t reproduce in your local development environment where you may have added the required assembly to your path or global assembly cache.
Additionally, you can historically debug your code browsing stack traces, local variables, exceptions and IntelliTrace events using Visual Studio 2010 Ultimate.
Get the Tools
As with previous versions, Windows Azure Tools are freely available for Visual Studio customers and integrate into Visual Studio directly. Download the June 2010 release of the Windows Azure Tools and let us know what you think. To learn more about today’s Windows Azure Tools release, visit Cloudy In Seattle.