This project is read-only.

Stacked Column Chart (1.5.0) Win 8.1 Exception

Jul 10, 2013 at 3:33 PM
Testing my app on Windows 8.1 and running into a problem. I created a sample project that shows the issue. Click on the "Pop chart" button twice to get the exception.

If you execute the below code twice you will get an exception on StackedColumn.Series.Clear();

            StackedColumnSeries stackSeries = new StackedColumnSeries();
            List<NameValueItem> items = new List<NameValueItem>();

            items.Add(new NameValueItem { name = "test name", value = "100", title = "test title" });

            SeriesDefinition tempSeries = new SeriesDefinition();
            tempSeries.ItemsSource = items;
            tempSeries.IndependentValuePath = "name";
            tempSeries.DependentValuePath = "value";
            tempSeries.Title = "test title";

The exception is "The exception is "An exception of type 'System.ArgumentException' occurred in WinRTXamlToolkit.Controls.DataVisualization.DLL but was not handled in user code" Additional Information: value does not fall within the expected range.

Did a little debugging and the line DataItems.remove(DataItem); seems to throw the exception in DefinitionSeries.cs line 861.
        /// <summary>
        /// Handles changes to the ItemsSource of a SeriesDefinition.
        /// </summary>
        /// <param name="definition">SeriesDefinition owner.</param>
        /// <param name="oldValue">Old value.</param>
        /// <param name="newValue">New value.</param>
        internal void SeriesDefinitionItemsSourceChanged(SeriesDefinition definition, IEnumerable oldValue, IEnumerable newValue)
            if (null != oldValue)
                foreach (DataItem dataItem in DataItems.Where(di => di.SeriesDefinition == definition).ToArray())
                    //Exception here
            if (null != newValue)
                // No need to add items if SeriesHost null; setting SeriesHost will take care of that
                if (null != SeriesHost)
                    AddDataItems(definition, newValue.CastWrapper<object>(), 0);