?
Solved

Windows Explorer being affected after VB.Net application closes.

Posted on 2014-04-10
6
Medium Priority
?
340 Views
Last Modified: 2014-04-11
Thought I had discovered a solution to my problem but I guess not.  I thought that it was the built-in context menus in vb2008 that caused Windows Explorer to restart over and over after shutting the application down and using the right mouse button.  But after eliminating them, the problem still persists.  The only way to correct it is to shut down and restart Windows.

I realize this is probably a very ambigous question, but does anyone have an suggestions where to look for the problem within vb 2008.  I am not using any third party add ins.  Everything being used is from Microsoft.

Thanks in advance.
0
Comment
Question by:GCCal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 40
ID: 39993166
If the problem starts to happen only after you close the application, then I would first look at the code that runs when you do stop the application.
0
 

Author Comment

by:GCCal
ID: 39993204
Here is my shut down code.  See anything wrong with it, James.  Thanks....

        Try
            Microsoft.VisualBasic.DeleteSetting("NewCVR", "MySoftware", "Edit")
        Catch ex As Exception
            'do nothing
        End Try
        If MessageBox.Show("Confirm exit?", "Quit Color Video Report?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
            Exit Sub
        Else
            If MyPictureBoxes(0).Image Is Nothing Then

            Else
                If MessageBox.Show("Do you want to save the video report before exit?", "Save Video Report?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
                    'Do nothing.....continue with exit
                Else
                    mnuSave.PerformClick()
                End If
            End If

            GC.Collect()
            Me.Dispose()
            Application.Exit()
            GC.Collect()
        End If
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 39993234
GC.Collect? And twice? And after you requested that the application Exit?

Although you see it all over the place, there are very few instances where calling GC.Collect is a good thing. You are overriding the normal garbage collection mechanism (memory cleanup) when you call that method.

Assuming that you are in a Form, calling Dispose is usually quite sufficient.

And as stated in the documentation, GC.Collect "performs a blocking garbage collection", which means that it needs to stop currently running processes while it is cleaning up memory. Normally, it should not have an impact on Windows Explorer, since it is not a .NET application and the GC works only on .NET memory allocation, but who knows.

If removing GC.Collect does not solve your problem, put a breakpoint on Application.Exit, and step through the code with F11. Depending on how the application was started and what you did while it was running, some other code can run even after Exit.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:GCCal
ID: 39993236
Okay, thanks James. I will give it a try and get back with you either today or tomorrow.
0
 

Author Comment

by:GCCal
ID: 39994346
Thanks James.  I did as you suggested.  I delete GC and am only using Application.Exit.  Then I step through my code from that point and think I have found code that may have been causing me the problems.  Anyway, it has not occurred three times after shutting the software down.

Thanks for your help.
0
 

Author Closing Comment

by:GCCal
ID: 39994351
Thanks for the expert advice....
0

Featured Post

Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question