Home Dashboard Directory Help
Search

XAML Designer cannot handle TypeName with nested classes. by Matt Slay


Status: 

Closed
 as Postponed Help for as Postponed


12
0
Sign in
to vote
Type: Bug
ID: 361509
Opened: 8/12/2008 1:06:15 PM
Access Restriction: Public
0
Workaround(s)
view
5
User(s) can reproduce this bug

Description

Notice the "+" signs in the TypeName value below. This is a valid syntax to drill into a class structure to get to an enum definition. It runs perfectly, but the Design surface in VS2008 gives an error when trying to render it. The error occurs in VS2008, and also on another machine which has VS2008 SP1 beta on it, and the error still happens in the newly released RTM of VS2008 SP1.

The error is: "Problem Loading: The document contains errors that must be fixed before the designer can be loaded. Reload the designer after your have fixed the errors."
    
and in the error list:

Error    1    Type 'HolePattern+Hole+HoleTypes' was not found.    D:\VSAPPS\WpfApplication1\WpfApplication1\Window1.xaml    15    17    WpfApplication1


Here are some code-snippets:

<Window.Resources>

<ObjectDataProvider x:Key="HoleTypeList" MethodName="GetValues" ObjectType="{x:Type sys:Enum}" >
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:HolePattern+Hole+HoleTypes" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

...

HolePattern is a class that contains the Hole class, which is what contains the enum HoleTypes.





The Window definition is like this:


<Window x:Class="WpfApplication1.Window1" Name="winBoltCircle"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
xmlns:local="clr-namespace:WpfApplication1"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="Bolt Hole Pattern" Height="1000" Width="1200" Background="Gray">
Details
Sign in to post a comment.
Posted by Jeffrey Ferman on 5/1/2012 at 5:24 PM
I am happy to let everyone know that this bug has been fixed in the next release of Visual Studio. You can find the fix in Visual Studio 11 Beta.

Thanks,

Jeffrey Ferman
Program Manager,
Visual Studio WPF & Silverlight Designer
Posted by Karl-Michael Beck on 9/13/2011 at 8:33 AM
Hi,

i need this feature too.

Here is the scenario what i want to do with it:

I want to write a function which dynamically selects a control which displays a certain property of a certain viewmodel. (To focus the control which has invalid data entered.)

We have classes for each property which is a nested class of the class aggregating the property. (The property class contains things like validation rules, behaviours (lazy load, persistance etc.))

I need to define a PropertyId which can be assigned to controls using an attached property. This is the basic information needed for determining the control to be focused.

As an property id i'd like to use the type information of the property class. This saves me from defining Ids for all properties in the system.
Posted by Microsoft on 12/10/2010 at 2:37 PM
Hi Sean,

The upcoming Service Pack for VS2010 was focused on increasing reliability and performance and unfortunantly we were not able to focus on bugs of this nature. This bug is being considered for the next release of Visual Studio. I would like to better understand the importance of enabling this scenario. Please feel free to email me at Jeffrey.Ferman<at>microsoft<dot>com.

Thanks,

Jeffrey Ferman
Program Manager,
Visual Studio WPF & Silverlight Designer
Posted by Sean Cullinan on 12/3/2010 at 6:26 AM
This is a nasty bug and it has carried forward to VS 2010. This seems odd considering Blend renders it ok as stated here and elsewhere. Any word on if this will be included in a VS2010 SP?
Posted by Microsoft on 1/16/2009 at 9:23 AM
Hi MattSlay

Thanks for raising this issue. We have verified that the issue reproduces in Visual Studio 2008 and in the pre-release version of our next major release.

Whilst the XAML you are writing is clearly legal, works at runtime, and loads in correctly in Expression Blend, we do not currently believe that use of and access to nested classes from Markup Extensions is very common in application building.

Our upcoming major release is very focussed on enabling productivity scenarios for mainline Line-of-Business development in WPF and Silverlight, and due to these competing priorities, regrettably we do not plan to fix this issue at this time. We will reconsider fixing it in a later release if common scenarios emerge that support it.

Unfortunatley this means that to avoid seeing this issue, you will need to refactor your application to avoid using nested classes where they need to be databound or otherwise accessed via a markup extension in XAML.

If you would like to provided further feedback in support of the importance of enabling this scenario, please feel free to contact me directly at mwthomas at microsoft dot com.

Regards

Mark Wilson-Thomas
Program Manager, WPF+Silverlight Designer, Visual Studio.
Posted by Matt Slay on 8/13/2008 at 11:16 AM
By the way, I just tested this in Expression Blend 2.5 June 2008 Preview, and it *DOES* render correctly there (on the machine that did the Blend test, I am running a VM with Vista running VS2008 SP1 Beta and Blend 2.5 June 2008 PReview).
Posted by Microsoft on 8/12/2008 at 10:20 PM
We were able to reproduce the issue you are seeing. We are escalating this bug to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release.
Sign in to post a workaround.