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

Null Reference (Race Condition)

1 Answer 47 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Kirk
Top achievements
Rank 1
Kirk asked on 06 May 2013, 02:31 PM
I am having an issue with the TimeBar throwing an exception. I will attach a screen shot of the error. I have traced it down in the source and it seems to be a race condition when you update the TimeBar multiple times in a short period of time. 

Here is the code that is throwing the exception, it is line 10 in LabelMapper.cs.

public static void MapLabels(IEnumerable<PeriodSpan> periods, Func<DateTime, string> formatter)
{
    if (periods == null)
        throw new ArgumentNullException("periods");
 
.......

So whats happening is, by the time this code is run, periods is null.

The only place this is being called is on line 351 in ViewManager.cs. Before it calls it checks for null but then it invokes the call on the dispatcher. I think the problem is the value is changing before the function gets run. It seems like this can happen if you make multiple updates in a row.

if (intervalDescriptor.Periods != null)
{
     this.Dispatcher.BeginInvoke(
          new Action(() => LabelMapper.MapLabels(intervalDescriptor.Periods, bestlabelFormatter)));
}

I am using version 2013.1.403.1050.

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 07 May 2013, 07:08 AM
Hello Kirk,

You are the first to report this problem and I am not quite sure I understand your scenario completely. As we would rather not make blind fixes, it would be best if you could open a new support ticket and send us a simple running project, demonstrating the problem.

Regards,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TimeBar
Asked by
Kirk
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or