Content Index Search

Debugging Expression Blend applications

If your Microsoft® Expression Blend™ application does not behave the way that you expect, or if errors occur when you try to build your application, there is a bug in your application. It can be difficult to understand what is causing a bug or where in your application it exists, but it helps to understand the types of bugs that you might encounter.

Syntax errors

When you build your application, any syntax errors are displayed in the Errors tab of the Results panel of Expression Blend, or in the Error List panel in Microsoft® Visual Studio® 2005.

Syntax errors occur if your Extensible Application Markup Language (XAML) or code does not follow the formatting rules of the language. The description of the error can help you understand how to fix it. The description also specifies the name of the file and the line number where the error occurs. Some common causes of syntax errors are as follows:

For information about XAML syntax, see the overview topics for individual controls listed in the Control Library topic in the Windows Presentation Foundation section on MSDN. For information about programming syntax, you can search on MSDN for keywords in your code.

Compilation errors

When you build your application, any compilation errors are displayed in the Errors tab of the Results panel of Expression Blend, or in the Error List panel in Visual Studio 2005.

Compilation errors occur when the compilation system of Expression Blend or Visual Studio 2005 cannot find something that your project requires. For example, if your project is missing a reference to the WPF assemblies, you might get an error such as "The name 'Window' does not exist in namespace ''". If you get this error, you can click Add Reference on the Project menu to add references to the following WPF assemblies in the C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 folder:

If you still receive errors such as "The name '<member>' does not exist in the current context.", there might be another assembly reference missing, or you might need to add a using (C#) or Imports (Visual Basic .NET) statement to your code for the missing namespace. To find out which assembly or namespace is required, see the MSDN reference topic for the member that is causing the error.

Some other common causes for compilation errors are as follows:

Run-time errors

You have a run-time error if your application builds but it behaves in an unexpected way when you run it (by pressing F5 in Expression Blend). Run-time errors are the most difficult to identify because they involve errors in logic. Sometimes, you can fix run-time errors by trying out different changes in your XAML or code until you understand what is going on behind the scenes. However, it is faster to actually watch what is going on behind the scenes by stepping through your code line by line as the application is running. For more information, see Debugging in Visual Studio 2005 later in this topic.

Some common causes of run-time errors are as follows:

Debugging in Visual Studio 2005

Expression Blend is a design tool for creating rich user interfaces and Windows®-based applications that make use of WPF features. You can use Visual Studio 2005, which is also used to build Windows-based applications, to open, build, and debug Expression Blend projects. If you are having trouble debugging your application by using the Test (F5) feature of Expression Blend, you can use Visual Studio 2005 to obtain detailed error messages about run-time errors. For more information, see Debugging Expression Blend applications in Visual Studio in this User Guide.

Tip To create new XAML applications and XAML Browser applications (XBAPs) in Visual Studio 2005, you need to install the extensions for .NET Framework 3.0. These can be downloaded from MSDN. (You do not need the extensions to debug XAML applications that were created with Expression Blend.)

Debugging performance issues

WPF provides a suite of performance assessment tools that allow you to analyze the run-time behavior of your application and determine how you can improve performance. For more information, see Performance Profiling Tools for WPF and Optimizing WPF Application Performance in the WPF section on MSDN .

Event tracing

Experienced .NET programmers can add code to their WPF applications to trigger custom debugging events that help them to debug more complicated bugs. This feature is called Event Tracing for Windows (ETW). The WPF Event Trace profiling tool uses ETW for event logging. For more information, see "Event Tracing" and "PresentationTraceSources" in Performance Profiling Tools for WPF on MSDN.

Debugging hybrid applications

If you have an application that uses both WPF and another technology like Windows Forms programming, you may experience problems such as unexpected overlapping behavior, scaling behavior, control focus issues, and so on. For information that can help you debug hybrid applications, see Troubleshooting Hybrid Applications in the WPF section on MSDN.


While being debugged, your application has the same security permissions that it has when another person uses it. For more information, see Deploying and publishing Expression Blend applications in this User Guide. For more information about WPF application security, see Security in the WPF section on MSDN.

Getting help

If you need more help debugging your Expression Blend application, you can search on Windows Presentation Foundation Forum for posts related your issue or post a question.