Exception threw during launch of Apllication : "An exception was thrown during the initialization of'System.Windows.Data.ObjectDataProvider'."

Saddam Hussain Quraishi 1 Reputation point
2021-03-04T10:12:38.017+00:00

Hi all,

I am getting an exception when launch application as below mentioned.

Exception: "An exception was thrown during the initialization of'System.Windows.Data.ObjectDataProvider'."

I have use the ObjectDataProvider at XAML side inside the StackPanel as below code.

====================================================
<StackPanel VerticalAlignment="Center" Margin="5,0,10,0" Visibility="Visible">
<StackPanel.DataContext>
<ObjectDataProvider ObjectType="l:ObjectProviderHelper"/>
</StackPanel.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Name="ObjectLikeWinExpBd" Grid.Row="0" BorderBrush="#97A0A5" BorderThickness="1" Background="White" Height="25">
<StackPanel Name="ObjectLikeWinExp" Orientation="Horizontal">
<TextBox x:FieldModifier="public" Name="ObjectTextStr" Width="300" Height="25" Text="{Binding Path=ObjectText, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
</StackPanel>
</Border>
</Grid>

</StackPanel>

Kindly help me to prevent such exception on launching of application.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,694 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
778 questions
{count} votes