I have written an application in VB.NET using MS Visual Studio 2005. I am using .NET version '2.0.50727'. The application was running without errors until recently. After being used for a while it begins to produce a System.Runtime.InteropServices.COMException error (80080005). The error happens when I make a call to produce an instance of another external application. Once this error has occurred it never goes away, occurring each time my application is opened. This error breaks the functionality of my program because it is reliant on the 2nd application it is calling.
I am not sure what starts this error to occurring but I do know that it is user specific and not the application. It appears to be something that occurs in the user's Windows profile. I can use a different user on the same machine or create a new profile for the user with the issue and the program will work without error for a while. Eventually (within a few weeks) the error will return and stay until I resolve it again. I am trying to debug the COM error to understand why this is happening but this is such strange behavior I'm not sure where to start. I've never seen an error that would wire itself into a profile and cause it to be persistent.
I don't have a lot of .NET experience but I have done a lot of VB 6 application programming. Please offer any suggestions you have. Your help is greatly appreciated.
Here is the CODE BLOCK where the error is occurring:
Public Class frmMain
Public btApp As BarTender.Application
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
btApp = New BarTender.Application
Catch COMex As Runtime.InteropServices.COMException
MessageBox.Show("Error " + COMex.ErrorCode.ToString() + ": " + COMex.Message)
End Try
I declare the variable at the top of my frmMain.vb form (the first form to load). I load the COM Object when the first form loads. I leave it active until the application closes because I make a lot of calls to it.
Thank You for your help.