Partilhar via


Visual Studio 2010 Read Me for the WPF and Silverlight Designer

User code exceptions may affect designer and Visual Studio

Any user code that throws an exception at design-time can cause unhandled exceptions in the designer and may even cause Visual Studio to crash.  To protect against this, prevent your code from executing at design time by wrapping it with DesignerProperties.GetIsInDesignMode checks.  Common examples of methods that will be executed at design-time are the UserControl.Loaded event handler, binding converters, and WCF async event handlers.

To resolve this issue:

Refer to the following articles:

Assemblies downloaded from the Web fail to load

In Visual Studio 2010, assemblies that have been downloaded from the Web may not load correctly.  This is because these assemblies have been given the "Mark of the Web" and thus are not fully trusted.  Using these assemblies as-is may cause errors when you build an application, reference these assemblies in XAML, or try to consume one of these assemblies through the Choose Items dialog box.  In these cases, the error will generally indicate that this assembly may have been downloaded from the Web. 

To resolve this issue:

If you fully trust these assemblies, you can work around this issue by following the instructions here:

https://go.microsoft.com/fwlink/?LinkId=179545

Resources from external Silverlight 3 assemblies fail to resolve at design-time

Resources from external Silverlight assemblies (that is, the projects that build these assemblies are not part of your solution) will fail to be found by the designer.

To resolve this issue:

For any Silverlight ResourceDictionary that is contained in an assembly that will be consumed as an assembly reference, you must include the following in the ResourceDictionary definition:

    x:Class="ResourceDictionary"

As a more detailed example, your ResourceDictionary has to resemble this:

<ResourceDictionary

    x:Class="ResourceDictionary"

    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml">

 </ResourceDictionary> 

Upgrading version 3.5 projects to version 4 may cause build errors

For this release of Visual Studio, some types were moved to the System.Xaml assembly.  As a result, retargeting your project from version 3.5 to version 4 may cause errors that indicate:

This type has been forwarded to assembly 'System.Xaml'.

To resolve this issue:

Manually add this assembly to your project and rebuild.