Travis
Travis

Reputation: 3629

Com Object Exception

I wrote an application that loops through a set of records and prints two things.

One is a report from SSRS wich works correctly.

The other is a drawing that uses a COM object to print. The COM object randomly fails and causes the program to quit.

Is there a way to stop it from killing the entire program when the COM Object fails? I have tried catch every exception at every level and it still does not work.

Upvotes: 1

Views: 220

Answers (3)

Vinay
Vinay

Reputation: 4793

Do you have the code of COM object that you are calling. If you have code then check whether there any exit command on failure.

Upvotes: 1

It sounds like the issue maybe with the com object itself and not your code. If this is the case then if the com object does not throw an error then you will not be able to catch one.

Kind Regards

Tony Smith-Brewster

Upvotes: 0

Nick
Nick

Reputation: 13444

Are you using the COM object from multiple threads? You should only access the COM object from a single thread with a message pump. In my experience this can cause weird instability which cannot be trapped via a try-catch.

Upvotes: 0

Related Questions