Note that there are some explanatory texts on larger screens.

plurals
  1. POXAML Parsing Exception
    primarykey
    data
    text
    <p>I have a simple XAML page that load fine when it is loaded as part of any application within Visual Studio. However, when I deploy this application using ClickOnce, I get the following exception:</p> <pre><code>Type : System.Windows.Markup.XamlParseException, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Message : Unable to cast object of type 'System.Windows.Controls.Grid' to type 'EMS.Controls.Dictionary.StatusBarControl'. Error at object 'System.Windows.Controls.Grid' in markup file 'EMS.Controls.Dictionary;component/views/statusbarcontrol.xaml'. Source : PresentationFramework Help link : LineNumber : 0 LinePosition : 0 KeyContext : UidContext : NameContext : BaseUri : pack://application:,,,/EMS.Controls.Dictionary;component/views/statusbarcontrol.xaml Data : System.Collections.ListDictionaryInternal TargetSite : Void ThrowException(System.String, System.Exception, Int32, Int32, System.Uri, System.Windows.Markup.XamlObjectIds, System.Windows.Markup.XamlObjectIds, System.Type) Stack Trace : at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType) at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord) at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment() at System.Windows.Markup.TreeBuilder.Parse() at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at EMS.Controls.Dictionary.StatusBarControl.InitializeComponent() at EMS.Controls.Dictionary.StatusBarControl..ctor(IDataView content) at OCC600.ReportManager.ReportPresenter.ShowQueryView(Object arg, Boolean bringForward, Type selectedDataType) at OCC600.ReportManager.ReportPresenter..ctor(IUnityContainer container) at OCC600.ReportManager.Module.Initialize() at Microsoft.Practices.Composite.Modularity.ModuleLoader.Initialize(ModuleInfo[] moduleInfos) Inner Exception --------------- Type : System.InvalidCastException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Unable to cast object of type 'System.Windows.Controls.Grid' to type 'EMS.Controls.Dictionary.StatusBarControl'. Source : EMS.Controls.Dictionary Help link : Data : System.Collections.ListDictionaryInternal TargetSite : Void System.Windows.Markup.IComponentConnector.Connect(Int32, System.Object) Stack Trace : at EMS.Controls.Dictionary.StatusBarControl.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target) at System.Windows.Markup.BamlRecordReader.ReadConnectionId(BamlConnectionIdRecord bamlConnectionIdRecord) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) </code></pre> <p>The XAML page is given below:</p> <pre><code>&lt;cdic:ResultSetControl x:Class="EMS.Controls.Dictionary.StatusBarControl" xmlns:dc="clr-namespace:DevComponents.WpfRibbon;assembly=DevComponents.WpfRibbon" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cdic="clr-namespace:EMS.Controls.Dictionary.Primitives" xmlns:dicutil="clr-namespace:OCC600.Infrastructure.Dictionary.Utility;assembly=EMS.Infrastructure.Dictionary" Loaded="ResultSetControl_Loaded"&gt; &lt;UserControl.Resources&gt; &lt;ResourceDictionary&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="../Resources/Styles.xaml"/&gt; &lt;/ResourceDictionary.MergedDictionaries&gt; &lt;BooleanToVisibilityConverter x:Key="BooToVisConv"/&gt; &lt;/ResourceDictionary&gt; &lt;/UserControl.Resources&gt; &lt;Grid Name="panel" &gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*"/&gt; &lt;RowDefinition Height="21"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;StatusBar Name="statusBar" Grid.Row="1"&gt; &lt;StatusBar.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;DockPanel LastChildFill="False"/&gt; &lt;/ItemsPanelTemplate&gt; &lt;/StatusBar.ItemsPanel&gt; &lt;StatusBarItem Margin="10,0, 10, 0"&gt; &lt;TextBlock Text="{Binding CountText}" Padding="5,0"/&gt; &lt;/StatusBarItem&gt; &lt;StatusBarItem Margin="10,0"&gt; &lt;TextBlock Text="{Binding MemoryUsageText}" Padding="5,0"/&gt; &lt;/StatusBarItem&gt; &lt;StatusBarItem Margin="10,0" MaxWidth="400"&gt; &lt;TextBlock Text="{Binding StatusReport.Summary}" Padding="5,0" /&gt; &lt;/StatusBarItem&gt; &lt;ProgressBar Margin="20,0" Name="progBar" Width="150" Height="13" Visibility="Collapsed" &gt; &lt;ProgressBar.ContextMenu&gt; &lt;ContextMenu Name="ctxMenu" ItemsSource="{Binding ActiveWorkItems}" Visibility="{Binding Path=ActiveWorkItems.HasItems, Converter={StaticResource BooToVisConv}}"&gt; &lt;ContextMenu.ItemContainerStyle&gt; &lt;Style TargetType="{x:Type MenuItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type MenuItem}"&gt; &lt;StackPanel Height="20" Margin="10,0" Orientation="Horizontal" HorizontalAlignment="Left"&gt; &lt;TextBlock Text="{Binding Path=Name, Mode=OneTime}" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Left" /&gt; &lt;ToggleButton Style="{StaticResource vistaGoldenToggleButtonStyle}" Padding="5,0" Content="Cancel" IsChecked="{Binding Cancel}" Margin="10,0,0,0" &gt; &lt;/ToggleButton&gt; &lt;/StackPanel&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/ContextMenu.ItemContainerStyle&gt; &lt;/ContextMenu&gt; &lt;/ProgressBar.ContextMenu&gt; &lt;/ProgressBar&gt; &lt;StatusBarItem Margin="10,0" MaxWidth="400" HorizontalAlignment="Right"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;TextBlock Text="Last Update:" Padding="5,0" /&gt; &lt;TextBlock Text="{Binding TimeStamp}" Padding="5,0" /&gt; &lt;/StackPanel&gt; &lt;/StatusBarItem&gt; &lt;!-- TODO: Put checkmark if all is well, or error if connection failed--&gt; &lt;StatusBarItem Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=dc:Ribbon, ResourceId=StatusBarItemAlt}}" DockPanel.Dock="Right" Padding="6,0,32,0" &gt; &lt;cdic:SplitButton Margin="5,0" Padding="5,2" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type cdic:SplitButtonResources}, ResourceId=vistaSplitButtonStyle}}" Mode="Split"&gt; &lt;cdic:SplitButton.ContextMenu&gt; &lt;ContextMenu &gt; &lt;MenuItem Header="Refresh Now" Command="{Binding ToggleConnectivityCmd}" CommandParameter="false"/&gt; &lt;MenuItem IsCheckable="True" IsChecked="{Binding ConnectState, Converter={StaticResource isFailedConverter}}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=IsChecked}" Header="Work Offline" Command="{Binding ToggleConnectivityCmd}"/&gt; &lt;/ContextMenu&gt; &lt;/cdic:SplitButton.ContextMenu&gt; &lt;cdic:SplitButton.Content&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Image x:Name="img" Source="{Binding ConnectState, Converter={StaticResource imageConverter}}" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center"/&gt; &lt;TextBlock Text="{Binding ConnectState}" Padding="3,0,0,0"/&gt; &lt;/StackPanel&gt; &lt;/cdic:SplitButton.Content&gt; &lt;/cdic:SplitButton&gt; &lt;/StatusBarItem&gt; &lt;/StatusBar&gt; &lt;/Grid&gt; &lt;/cdic:ResultSetControl&gt; </code></pre> <p>The error just seems to have come out of no where. Any ideas?</p> <p>TIA.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload