Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a VSIX VIsual studio extension which is a tool window and has many progress bars and buttons. Clicking one of the buttons starts 5-8 worker threads on the background..This starts the 5-8 progress bar and shows the progress of the thread.

Occasionally I see that the progress bar on the thread reset randomly; its almost like a refresh of the ToolWindow and the progress go back to default state. I am not sure what is happening because there is no code that resets the progress bar to default state. The only explanation that I have is the app is crashing and recovering on GUI somehow. After the reset, some of the progress keep updating as if nothing happened continuing on from the reset state as if nothing happened (the worker threads keep running). I am at a loss to figure out what is going on. How can i troubleshoot this?

Have you seen this kind of issue in a Visual Studio extension that you developed where the GUI resets randomly?

What I have tried:

I have looked at crash exceptions. Nothing to report yet.
Posted
Updated 29-Jan-18 11:44am
Comments
johannesnestler 29-Jan-18 10:23am    
Do you know how to debug a VS Extension (via experimental instance)?
nitrous_007 29-Jan-18 10:26am    
Yes. It might be that in the worker thread work completed thread, I am not checking if error is not null . I added that. Before this I couldn’t identify a crash in the output log when I run and it only crashed once in a while so tough to debug.
johannesnestler 29-Jan-18 10:35am    
So it seems to be a classic "threading and exceptions" problem...
nitrous_007 29-Jan-18 10:39am    
It could be. Is that the normal behavior for VSIX tool for the tool window GUI to flash and reset so as to recover from the exception? This is my first time working with VSIX project.

1 solution

It was an exception that was unhandled. I should have used a different background worker for 2 different button click events- I accidentally used the same one and I was clicking both buttons.

I added below error detection and traced the error then.

void workerBuild_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error == null)
             {     //Proceed as usual}
            else
             {   //print out error}
          }

{
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900