Known Issues for Visual Studio 2010 Release Candidate
This post provides information on a few high profile Visual Studio 2010 Release Candidate bugs and some additional information that will help developers have a successful experience with the WPF & Silverlight Designer.
Table of Contents
Known Issues
Visual Studio crashes when IntelliSense displays
Problem: Users have reported frequent crashes of Visual Studio 2010 Release Candidate when IntelliSense displays. This can happen in the XAML Editor or Code Editor.
Solution: If you are experiencing crashes please install this Hot Fix: https://code.msdn.microsoft.com/KB980610
Find in Files is very slow when the XAML Editor is open
Problem: Some customers have reported that the Find if Files feature of Visual Studio can by very slow if a XAML Editor document is open and the search is conducted shortly after opening the solution.
Solution: If this bug affects your work, close all Visual Studio documents and then close Visual Studio. Reopen Visual Studio and the solution you were working on. Before opening any documents, perform the Find in Files search.
This bug will be corrected for the final release of Visual Studio 2010.
Implicit Style using BasedOn Disables the Designer
Problem: If you have an implicit Style that uses BaseOn that is located in App.xaml or in a Merged Resource Dictionary that is merged in App.xaml, the WPF & Silverlight Designer will always be in a read-only error state.
Gold Bar Error: InstanceBuilderException was thrown due to a document error: a loop was detected in the property expressions
Error List Error: A loop was detected in the property expressions
Solutions
- Use full XAML View or edit XAML files with the Source Code (Text Editor) rather than use the Designer.
- Instead of merging resource dictionaries in App.xaml, merge them in the root Window or root UserControl as below. The below solution while less than ideal, will enable using the Designer along with BaseOn styles in Resource Dictionaries.
Dictionary1.xaml content – note BaseOn Style
<ResourceDictionary xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Green" />
<Setter Property="Foreground" Value="Yellow" />
</Style>
</ResourceDictionary>
MainWindow.xaml – note Dictionary1.xaml was merged here, rather than App.xaml.
<Window x:Class="MainWindow"
xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" xmlns:my="clr-namespace:WpfApplication1">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary1.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<TextBlock Text="Hello" />
</Grid>
</Window>
Application Compatibility
Silverlight Support for Visual Studio 2010 Release Candidate
Silverlight 3 projects are supported with the Visual Studio 2010 Release Candidate build – however Silverlight 4 projects are not yet supported.
We will be adding Visual Studio 2010 Release Candidate support for Silverlight 4 with the next public Silverlight 4 drop.
If you are doing active Silverlight 4 development today we recommend staying with the Visual Studio 2010 Beta 2 build for now.
Tim Heuer has also blogged about this limitation here.
No Expression Blend Support for .NET 4.0 Projects
Expression Blend does not support for .NET 4.0 projects.
Visual Studio 2010 Release Candidate customers can use Blend to target .NET 3.5 and SL3, but not .NET 4.0.
Designer Limitations
Custom MarkupExtensions should be located in a separate assembly
Developers writing their own MarkupExtensions should locate them in a separate assembly from the assembly that is consuming them for the best design support. If located in the same assembly the following error may be displayed:
Error Message: No constructor for type '[ClassName]' has 0 parameters
Image files with Build Action set to Content work at runtime but not at design time for Silverlight
Usually, Silverlight image files have their Build Action set to Resource. The Silverlight run-time supports setting the Build Action to Content. However the Designer will display the following gold bar error:
Error Message: Project does not support paths relative to the root application directory.
Unhandled design-time exceptions in Converters and DataTemplateSelectors
At design-time, the Designer executes code in Converters and DataTemplateSelectors. If those classes allow an unhandled exception to bubble up to the Designer, an exception will be displayed in the Designer.
Developers must ensure they code defensively to avoid this design-time problem.
Comments
Anonymous
February 16, 2010
>> No Expression Blend Support for .NET 4.0 Projects There is support with Expression Blend Preview for .NET 4: http://timheuer.com/blog/archive/2009/11/22/fix-open-in-expression-blend-missing-link-in-visual-studio.aspx Download: http://www.microsoft.com/downloads/details.aspx?FamilyID=6806e466-dd25-482b-a9b3-3f93d2599699&displaylang=enAnonymous
February 16, 2010
@Ed, the Blend Preview for .NET 4 crashes when trying to open projects, so at the moment "no Blend support" is quite correct for the RC.Anonymous
February 16, 2010
(sent too soon) Obvious if you want to continue using the Blend preview with Beta2 just don't install the RC. :)Anonymous
April 14, 2010
The comment has been removedAnonymous
April 16, 2010
Shimmy, We do appologize for the inconvenience of moving the Custom MarkUpExtensions to another assembly This requirement will be reviewed in a future version of Visual Stuio. Have a nice day, Karl Shifflett Visual Studio Product TeamAnonymous
April 17, 2010
The comment has been removedAnonymous
April 17, 2010
Hi Shimmy, Sorry you are having another problem. With converters here is what I normally do: Check if the value parameter is null. If so, return value. Check if the value is of the expected type. If not, return value. Then cast value to the correct type and perform your logic. This removes the need for try/catch blocks. If you are working with enums it's much easier to use the Shared methods on the Enum type. Check out: Enum.GetName Enum.Parse Enum.IsDefined Glad you like the blog. Have a super day, Karl Shifflett Visual Studio Product TeamAnonymous
April 17, 2010
The comment has been removedAnonymous
April 17, 2010
The comment has been removedAnonymous
April 17, 2010
The comment has been removedAnonymous
April 17, 2010
Shimmy, Try this out, it works in the designer and at runtime. You really never want to throw from the Convert method. Public Class DemoConverter Implements IValueConverter Public Enum Demo None Happy VeryHappy End Enum Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert If value Is Nothing OrElse parameter Is Nothing OrElse Not TypeOf value Is Integer Then Return Nothing If TypeOf parameter Is Type Then Dim type = DirectCast(parameter, Type) If Not type.IsEnum Then Return Nothing Dim enumValue As Demo If [Enum].TryParse(value.ToString(), enumValue) Then 'enumValue has a value you can use Else 'bummer, out of range value passed End If End If End Function Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack End Function End Class Cheers, KarlAnonymous
April 17, 2010
OK whatever. When using the CInt, the ToString is not necessary lol. Thanks a lot.Anonymous
April 17, 2010
And since I have a huge library of enum types, I prefer to make the validation at the beginning rather then TryParse of each enum, plus the ByRef is not what I am looking for. Anyway thanks for your suggestions.