1

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?
Community
  • 1
  • 1
Anya Hope
  • 1,301
  • 1
  • 17
  • 33
  • 1
    *I have far too much xaml to post it all here*... if you can't fix your bug with all of your code, what chance do we have with just a random selection of it? What you need to do is to follow the advice given in the [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/asking) page and then show us just the *relevant* code. Most of the time, we find the error when trying to reproduce it in a smaller example, so it's well worth doing. – Sheridan Jan 13 '15 at 13:48
  • Thanks for getting back to me, usually I am able to create a minimal example, however because of the lack of documentation of this problem, I don't have any idea what is producing it. I can only presume it is the list box item because that is what is being selected when it fails. I'm sorry I couldn't make an example for this one. – Anya Hope Jan 13 '15 at 14:01
  • *I'm sorry I couldn't make an example for this one*... that's *your* loss because that's the only way that you'll fix your problem. Just start to replicate your project in a new project bit by bit until you either find the error or can reproduce it with minimal code. – Sheridan Jan 13 '15 at 14:05
  • If this code works in another project then posting that code alone is not going to help. I you have that code and nothing else on a page does is crash? – paparazzo Jan 13 '15 at 14:07

0 Answers0