Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Windows Explorer being affected after VB.Net application closes.

Posted on 2014-04-10
6
Medium Priority
?
341 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

610 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