Unanswered VSTO multithreading problem

  • Tuesday, July 31, 2012 3:47 AM
     
     

    Hi folks,

    Currently I have implement a multithreading approach in my VSTO project, I used "ThreadPool.QueueUserWorkItem" to get a background thread to retrieve data from WCF service. and in background thread, I used "dispatcher.Invoke" to invoke UI rendering method from main UI thread. the "dispatcher" is define at main UI thread as "Dispatcher dispatcher = Dispatcher.CurrentDispatcher;"

    But I encounter a issue that when there is more data (means there will be more loop), my application will hung up, and not responding. However this issue is not happen when I use single thread. 

    Any idea about why use multithreading causes "not responding"?

All Replies

  • Tuesday, July 31, 2012 7:30 AM
     
     

    what do you mean by 'there is more data (means there will be more loop)' ?

    maybe show us some code that exhibits problem

  • Wednesday, August 01, 2012 5:11 AM
     
     

    my code is like:

    foreach(Category c in categorylist)
    {
       foreach(SubCategory sc in scListInCategory)
       {

          foreach(SubSubCategory ssc in sscListInSubCategory)
          {

           }

      }

    }

    So, if there is more data, like more category, then there will be more loop count

  • Wednesday, August 01, 2012 6:56 AM
     
     
    show us code that exhibits hung ups