?
Solved

Windows Explorer being affected after VB.Net application closes.

Posted on 2014-04-10
6
Medium Priority
?
342 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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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
Course of the Month16 days, 12 hours left to enroll

864 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