Null Reference (Race Condition)

2 posts, 0 answers
  1. Kirk
    Kirk avatar
    28 posts
    Member since:
    Jun 2012

    Posted 06 May 2013 Link to this post

    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)
              new Action(() => LabelMapper.MapLabels(intervalDescriptor.Periods, bestlabelFormatter)));

    I am using version 2013.1.403.1050.
  2. Tsvetie
    Tsvetie avatar
    1517 posts

    Posted 07 May 2013 Link to this post

    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.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top