none
upgraded VS2012 with Update2 and now my WP8 project fails! RRS feed

  • Question

  • I just updated my installation of VS2012 with Update2 and now I can't compile the project anymore. Why?

    Here's the error:

    Unable to cast object of type 'System.Reflection.CustomAttributeData' to type 'System.ComponentModel.TypeConverterAttribute'

    If I revert to (using a restore point) to VS2012 Update1 it compiles and runs perfectly.  How can I fix this.  The project was originally a WP7.1 project that I converted to WP8 (and I've worked on this one in parallel with the 7.1 project since most of the code is the same).

    When I build the project all my static references show this error for a static reference to a type converter

    Error 55 The name "Converter_AppMode_ToNullBoolean" does not exist in the namespace "clr-namespace:ZenAlarmClock". 

    even though this declaration is correct

    xmlns:localNamespace="clr-namespace:ZenAlarmClock"

    I am completely baffled and don't know where to start in trying to fix this.  I don't want to revert to Update 1.

    BTW, the WP7 version still compiles & runs in the updated VS2012...

    thank you for any guidance anyone can provide


    Tom


    • Edited by tbink Wednesday, May 15, 2013 2:59 PM updated info
    Wednesday, May 15, 2013 1:20 AM

Answers

  • Mark and All,

    I found the problem and it looks to me like a somewhat arcane bug in VS2012 Update2.

    I can reproduce the error everytime with Update2 installed (Update1 does NOT fail in the same circumstance)

    Simply,

    Update2 does NOT allow you to put a RichTextBox inside a ScrollViewer:  example...

    <ScrollViewer Background="{x:Null}" >
                                                <RichTextBox x:Name="HowTo" Foreground="#FFFEFFEF" VerticalScrollBarVisibility="Visible">
                                                    <Paragraph FontSize="12" FontFamily="Calibri" TextAlignment="Left">
                                                        <Run FontWeight="Bold" FontSize="26.667" FontFamily="Bodoni MT" Text="Awakener"/>
                                                        <Run FontWeight="Bold" FontSize="16" FontFamily="Segoe UI" Text=" "/>
                                                        <Run FontSize="24" FontFamily="Bodoni MT" Text="is easy to use, just follow these simple steps:"/>
                                                    </Paragraph>
                                                    <Paragraph FontSize="12" FontFamily="Calibri" TextAlignment="Left">
                                                        <Run FontStretch="Expanded" FontSize="32" FontFamily="Bodoni MT" Text="· "/>
                                                        <InlineUIContainer>
                                                            <Image IsHitTestVisible="False" HorizontalAlignment="Left" Height="65" Width="128" Margin="5,5,8,0" VerticalAlignment="Top">
                                                                <Image.Source>
                                                                    <ImageSource>/uiImages/UI-HowTo-SelectTime.png</ImageSource>
                                                                </Image.Source>
                                                            </Image>
                                                        </InlineUIContainer>
                                                        <Run FontStretch="Expanded" FontSize="24" FontFamily="Bodoni MT" Text="Set the final wakeup time."/>
                                                    </Paragraph>

    As soon as that is run I get this error

    "Unable to cast object of type 'System.Reflection.CustomAttributeData' to type 'System.ComponentModel.TypeConverterAttribute'

    (As a note... this XAML was generated by Blend for VS2012)

    Please pass this along to the Visual Studio Team


    Tom

    • Marked as answer by tbink Tuesday, May 21, 2013 4:22 AM
    Tuesday, May 21, 2013 4:22 AM

All replies

  • Hi,

    After the upgrade, I would try removing and re-adding the References in the WP8 project to ensure that the project is using the latest libraries.

    If you have any libraries that you developed, be sure to clean build them too.

    -Mark


    Getting Started? Click here
    Blog: Windows Store & Phone Developer Solutions

    Wednesday, May 15, 2013 5:24 PM
  • Thanks for this note Mark.  I've been digging into the issue.  Update2 appears to "not like" something about using Silverlight4 assemblies.... (I used them for handling RSS.... which appears to be the solution in WP8 also, right?)...  I'm not sure where its happening or why.  what I've decided to do is rebuild the Solution from the ground up as a WinPhone8 project... adding a type converter that I know works... then slowly add in XAML and C# code and the necessary References, compiling as I go to see when it breaks.  I'll report back here when I figure out what it is <sigh>. 

    It has something to do with having converted the Project to WP8 in VStudio....  under Update1.. no problem (with a few minor code adjustments).  But Update2 breaks it with the above message... (and another error message about Silverlight4 that I noticed briefly but can't trigger again).

    Any idea what could have broken?

    thanks

    tom


    Tom

    Thursday, May 16, 2013 8:08 PM
  • Mark and All,

    I found the problem and it looks to me like a somewhat arcane bug in VS2012 Update2.

    I can reproduce the error everytime with Update2 installed (Update1 does NOT fail in the same circumstance)

    Simply,

    Update2 does NOT allow you to put a RichTextBox inside a ScrollViewer:  example...

    <ScrollViewer Background="{x:Null}" >
                                                <RichTextBox x:Name="HowTo" Foreground="#FFFEFFEF" VerticalScrollBarVisibility="Visible">
                                                    <Paragraph FontSize="12" FontFamily="Calibri" TextAlignment="Left">
                                                        <Run FontWeight="Bold" FontSize="26.667" FontFamily="Bodoni MT" Text="Awakener"/>
                                                        <Run FontWeight="Bold" FontSize="16" FontFamily="Segoe UI" Text=" "/>
                                                        <Run FontSize="24" FontFamily="Bodoni MT" Text="is easy to use, just follow these simple steps:"/>
                                                    </Paragraph>
                                                    <Paragraph FontSize="12" FontFamily="Calibri" TextAlignment="Left">
                                                        <Run FontStretch="Expanded" FontSize="32" FontFamily="Bodoni MT" Text="· "/>
                                                        <InlineUIContainer>
                                                            <Image IsHitTestVisible="False" HorizontalAlignment="Left" Height="65" Width="128" Margin="5,5,8,0" VerticalAlignment="Top">
                                                                <Image.Source>
                                                                    <ImageSource>/uiImages/UI-HowTo-SelectTime.png</ImageSource>
                                                                </Image.Source>
                                                            </Image>
                                                        </InlineUIContainer>
                                                        <Run FontStretch="Expanded" FontSize="24" FontFamily="Bodoni MT" Text="Set the final wakeup time."/>
                                                    </Paragraph>

    As soon as that is run I get this error

    "Unable to cast object of type 'System.Reflection.CustomAttributeData' to type 'System.ComponentModel.TypeConverterAttribute'

    (As a note... this XAML was generated by Blend for VS2012)

    Please pass this along to the Visual Studio Team


    Tom

    • Marked as answer by tbink Tuesday, May 21, 2013 4:22 AM
    Tuesday, May 21, 2013 4:22 AM
  • I am having the same problems, but I have no Rich Text Boxes within Scroll Viewers.  I do have List Boxes and I wonder if they cause the same problems.
    Thursday, May 30, 2013 7:29 PM
  • Interesting....  the issue has something to do with what's inside a scrollviewer.  That said, I'm not having any trouble with ListBoxes used in WP8 (I understand that those are now deprecated(?) in favor of LongListSelectors (anyone, right?).  I do think that the issue has to do with the ScrollViewer though.  Isn't that a subcomponent of a ListBox...?... so maybe...

    Whatever though this is clearly a bug in VS Update2 with regard to WP8 (doesn't affect WP7.x projects)


    Tom

    Thursday, May 30, 2013 8:56 PM
  • I found the source of my error, but it had nothing to do with a Scroll Viewer.

    I attempted to set an image source as a StaticResource

        <phone:PhoneApplicationPage.Resources>
            <ImageSource x:Key="TestScreenImage">/FlexTestScreen.png</ImageSource>
        </phone:PhoneApplicationPage.Resources>
                <Image x:Name="FlexDesktopGraphic" HorizontalAlignment="Center" Height="240" Margin="0,130,0,0" 
                       VerticalAlignment="Top" Width="320" Canvas.ZIndex="1" Source="{StaticResource TestScreenImage}"/>
    Although XAML handles this fine, the error occurs.  This worked prior to Update 2.

    Thursday, June 6, 2013 4:20 PM
  • I had a same problem. 

    It had a problem from some elements on ResourceDictionary.

    For example, it worked fine on VS2012 Update 1, but it didn't work on VS2012 Update 2.

    <ImageSource x:Key="TestImage">/Resources/Image.jpg</ImageSource>

    <Image Source="{StaticResource TestImage}" />



    I had changed all ImageSource elements in my project to BitmapImage elements below. And It built successfully.

    <BitmapImage x:Key="TestImage" UriSource="/Resources/Image.jpg" />


    Tuesday, August 13, 2013 7:16 AM