This is a migrated thread and some comments may be shown as answers.

Cannot evaluate expression because the code of the current method is optimized (after upgrade to Q2)

2 Answers 142 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Judi Martini
Top achievements
Rank 1
Judi Martini asked on 14 Jul 2009, 11:49 PM

Hi

I would very much appreciate some help on the following problem:

I have a project in which I have a RadChart. Upon starting my application the RadChart is populated with 3 data series (Car, Property and Travel) in a stacked bar format. User can then click on any of the 12 resulting ChartItems, in which case the chart is repopulated by a new DataSeries, this time in a line format. (Basically it is based on Telerik's Drill Down demo - the first chart displays sales per month, the second chart breaks it further into days.)

To return from the second view back to the first view, user clicks the Reload button, which runs the same method (ConfigureMonthlyRevenue()) that was run upon starting the application.

There were no problems with this code until I upgraded to Q2 yesterday. Now all runs smoothly until I hit the Reload button and the application hangs. When I pause it, I get the "Cannot evaluate expression because the code of the current method is optimized" error when hovering over the bit of code where I'm adding the series to the chart. Please see the code snippet below:

//This is the bit that's run upon starting the app (without problems) and then when the Reload button is hit (which is when it hangs on the bold line)

private void ConfigureMonthlyRevenue()

{

 

this.past12Months.DefaultView.ChartArea.DataSeries.Clear();

this.past12Months.DefaultView.ChartTitle.Content = "Past 12 Months Revenue";


DataSeries
seriesCar = new DataSeries();

seriesCar.Definition = new StackedBarSeriesDefinition();
seriesCar.LegendLabel =
"Car";

seriesCar.Definition.ShowItemToolTips = true;

DataSeries seriesProperty = new DataSeries();

seriesProperty.Definition = new StackedBarSeriesDefinition();
seriesProperty.LegendLabel = "Property";

seriesProperty.Definition.ShowItemToolTips = true;


DataSeries
seriesTravel = new DataSeries();

seriesTravel.Definition = new StackedBarSeriesDefinition();
seriesTravel.LegendLabel = "Travel";

seriesTravel.Definition.ShowItemToolTips = true;


this
.FillWithRevenueData(seriesCar, seriesProperty, seriesTravel);

chartArea.DataSeries.Add(seriesCar);

chartArea.DataSeries.Add(seriesProperty);

chartArea.DataSeries.Add(seriesTravel);

chartArea.AxisX.StripLinesVisibility = Visibility.Collapsed;

chartArea.AxisY.Title = "(thousand dollars)";

chartArea.AxisX.TickPoints.Clear();
chartArea.AxisY.Step = 100d;

chartArea.AxisY.DefaultFormat = "C0";

string[] months = new string[] { "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun" };

for (int i = 0; i < months.Length; i++)

{

 chartArea.AxisX.TickPoints.Add(new TickPoint());

chartArea.AxisX.TickPoints[i].Label = months[i];

}

}




//When chartItem clicked

private void chartArea_ChartItemClick(object sender, ChartItemClickEventArgs e)

{

this.past12Months.DefaultView.ChartArea.ChartItemClick -= this.chartArea_ChartItemClick;


string
axisItemLabel = past12Months.DefaultView.ChartArea.AxisX.TickPoints[e.ItemIndex].Label;

string product = e.DataSeries.LegendLabel.ToString();

past12Months.DefaultView.ChartTitle.Content = string.Format("Daily Revenue {0} ({1})", product, axisItemLabel);

 

DataSeries series = new DataSeries();

series.Definition = new LineSeriesDefinition();

series.LegendLabel = "Daily Revenue";

FillWithDailyDummyData(series);

past12Months.DefaultView.ChartArea.DataSeries.Clear();

past12Months.DefaultView.ChartArea.DataSeries.Add(series);

string[] days = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" };


for
(int i = 0; i < days.Length; i++)

{

past12Months.DefaultView.ChartArea.AxisX.TickPoints[i].Label = days[i];

}

this.past12Months.DefaultView.ChartArea.ChartItemClick += this.chartArea_ChartItemClick;

}

Any help with this would be much appreciated.

Thank you
Judi

2 Answers, 1 is accepted

Sort by
0
Judi Martini
Top achievements
Rank 1
answered on 14 Jul 2009, 11:50 PM
Oh, I forgot to say that I am in Debug mode and my checkbox "Optimize code" is unchecked.
0
Giuseppe
Telerik team
answered on 16 Jul 2009, 11:23 AM
Hi Judi Martini,

Please open a formal support ticket and attach a runnable sample application that we can investigate locally as based on the provided code snippets we are unable to reproduce the erroneous behavior.

Looking forward to your reply.


All the best,
Manuel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart
Asked by
Judi Martini
Top achievements
Rank 1
Answers by
Judi Martini
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or