This is a really tricky one. I'm experiencing an error that I have only been able to find about 5 results from google searches.
It is exactly the same as the below question asked a year ago:
Infinite loop invalidating the TimeManager
I am however, able to provide slightly more information. I have a basic WPF program implementing mvvm. My code opens up a window to add, edit or delete single-line details.
My window opens fine, I am able to add or delete lines.
Each line becomes selected when clicked HOWEVER after the THIRD click (third selection event) the program crashes with the above error.
I was shown a previous error before this one "The call stack contains only external code" (has previously been documented: The call stack contains only external code ) which asked me to disable "Just My Code" in order to continue. Stupidly, I did so and now the above is the error that I am shown.
From research I know this is a xaml issue, however I have far too much xaml to post it all here. Here is my listview item that is crashing on the third selection:
<ListView x:Name="RegexPatternsListBox" SelectionMode="Single" ItemsSource="{Binding RegexList}" KeyboardNavigation.TabNavigation="Continue" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" HorizontalAlignment="Stretch" VerticalAlignment="Top" SelectedItem="{Binding SelectedRegex}" IsEnabled="true">
<ListView.Resources>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="IsTabStop" Value="False" />
<Style.Triggers>
<EventTrigger RoutedEvent="PreviewGotKeyboardFocus">
<BeginStoryboard>
<Storyboard>
<BooleanAnimationUsingKeyFrames
Storyboard.TargetProperty="(ListViewItem.IsSelected)">
<DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</ListView.Resources>
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="FontWeight" Value="Bold"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridView.Columns>
<GridViewColumn x:Name="description" Header="Description" CellTemplate="{StaticResource descriptionTemplate}" Width="Auto"/>
<GridViewColumn x:Name="regex" Header="Regex" CellTemplate="{StaticResource regexTemplate}" Width="{Binding ElementName=helperField, Path=ActualWidth}"/>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
The code relating to the view has been copied almost word for word from another project that does function correctly so I'm not sure what's different about mine. Perhaps this information will shed some more light on this error for us all?
- Update * I tried selecting various items in my list very slowly, leaving a few seconds between each selection. In this way, I reached 7 selection events before the crash. Background event issue maybe?