Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

AG_E_PARSER_BAD_TYPE Error RSS

5 replies

Last post Mar 04, 2009 08:26 PM by JDHofer

(0)
  • ZhangTeng

    ZhangTeng

    Member

    4 Points

    18 Posts

    AG_E_PARSER_BAD_TYPE Error

    Jan 13, 2009 06:14 PM | LINK

    I'm trying to localize a Silverlight 2 app.

    After adding the following markup to Page.xaml, VS complains of a AG_E_PARSER_BAD_TYPE parsing error on the UserControl.Resources.

    <UserControl x:Class="SilverlightApplication2.Page"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:Loc="clr-namespace:SilverlightApplication2.My.Resources"    
        Width="400" Height="300">

        <UserControl.Resources>
            <Loc:Resource1 x:Name="LocStrings" />
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot" Background="White">
            <TextBlock x:Name="String1" Text="{Binding String1, Source={StaticResource LocStrings}}" />
        <Image Source="errormsg.jpg"></Image>
        </Grid>
    </UserControl>

  • Ken Tucker

    Ken Tucker

    All-Star

    23250 Points

    3534 Posts

    Re: AG_E_PARSER_BAD_TYPE Error

    Jan 13, 2009 06:31 PM | LINK

    It should be x:Key="LocStrings"
  • ZhangTeng

    ZhangTeng

    Member

    4 Points

    18 Posts

    Re: AG_E_PARSER_BAD_TYPE Error

    Jan 13, 2009 11:40 PM | LINK

    I had changed the string "Name" to "Key" ,but it still doesn't work

  • struggle-luan

    struggle-luan

    Member

    592 Points

    104 Posts

    Re: AG_E_PARSER_BAD_TYPE Error

    Jan 14, 2009 06:14 AM | LINK

    Hi~

    First.. congratulations! The AG_E_PARSER_BAD_TYPE Error is one of the error which makes you confused most..

    I've found that your Resource Element is actually a User-Created-Class or Control.

    The error may orrurs when

    1) There's Handler,but there's no Event.

    Example :

    <Button Click="A" /> , but in code file, there's no Event "A".

     

    2) Try to add child-element directly to a XAML BASED User-Control.

    Example :(MyControl is based on XAML & partical code file)

    <MyControlRef:MyControl>
    <Button/>

    </MyControlRef:MyControl>

     

     3) Your control is from a Dll, and you cannot debug into it, when it has a error(always in building VisualTree), Error would be thrown.

     

    Sometimes.. VS + SL cannot bring Detail infomation about THE ERROR. Hope you can fix it soon~

    ehh... this is what I called "POOR ENGLISH"..
  • lee_sl

    lee_sl

    Contributor

    4222 Points

    864 Posts

    Re: Re: AG_E_PARSER_BAD_TYPE Error

    Jan 14, 2009 09:04 AM | LINK

    try adding  xmlns:Loc="clr-namespace:SilverlightApplication2.My.Resources"    
    assembly also

    something like this

     xmlns:Loc="clr-namespace:SilverlightApplication2.My.Resources;assembly=xxx"    

    ----------------------------------------------
    Available for consulting in Dallas, TX
    http://leeontech.wordpress.com/
  • JDHofer

    JDHofer

    Member

    2 Points

    6 Posts

    Re: Re: AG_E_PARSER_BAD_TYPE Error

    Mar 04, 2009 08:26 PM | LINK

    lee_sl

    try adding  xmlns:Loc="clr-namespace:SilverlightApplication2.My.Resources"    
    assembly also

    something like this

     xmlns:Loc="clr-namespace:SilverlightApplication2.My.Resources;assembly=xxx"    

     

    You just saved me hours ... Thanks ... [H]