Answered Dispatcher Name not appearing in Threads window

  • Wednesday, April 11, 2012 1:25 AM
    Moderator
     
      Has Code

    Hi All,

    I am having problems with CCR dispatcher name not appearing for its threads in Visual Studio->Debug->Windows->Threads window. This occurs when I create the Dispatcher use the parameterless Dispatcher() constructor (without passing the name of the dispatcher) and then later set the Name property. If I use any of the non-parameterless Dispatcher() constructor that explicitly takes the name of the dispatcher, it works correctly. Please find a sample code below.

    The following has the name of all the threads appear correctly as "MyThreadPool" in the Threads window

    Dispatcher dispatcher = new Dispatcher(4, "MyThreadPool");

    The following has the name of all the threads appear as "<No Name>" in the Threads window

    Dispatcher dispatcher = new Dispatcher();
    dispatcher.Name = "MyThreadPool";

    Please help.

    Thanks,

    Venkat

All Replies

  • Wednesday, April 11, 2012 6:46 PM
    Moderator
     
     Answered

    Good find, this appears to be a “feature” J

    Looking at the source I can clearly see that the Dispatcher constructor immediately adds threadCount workers; assigning the given threadPoolName. However, the Name property setter has no effect on the existing workers thereafter. The Name property really should be readonly.

  • Wednesday, April 11, 2012 8:26 PM
    Moderator
     
     
    Thanks Ashley Feniello for the clarification.