Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Has anyone else ever had a .NET win app that would just quit working and shut down?

 

I am using some COM libraries from a third party app to do some calculations on some records that I am pulling from Oracle. It is a big loop and most records work but some don't.

Every now and then this app will simply close up and cease to operate.

The window will close and I will be dumped into Studio.

I have all of my code in a try catch block and I am trapping for

 

catch ex as exception

 

What more can I do than this? Shouldn't this handle all exceptions? I know it doesn't because sometimes you get those yellow or green (that one is bad news) highlights in the debugger when something serious has gone wrong.

But I don't even get that. I just get kaput!

 

This has happened with another app I wrote that does similar.

 

I'm at the point where I am going to have to write a long, drawn out database solution to this problem.

If I can't get it solved I was thinking I could at least write something that would figure out if this app ran the whole way and if not fire it up again.

 

The problem is repeatable and I am pulling records from Oracle and sorting them before I start the loop so I would know where to pick up again. But what a pain.

 

Any suggestions?

Wanna-Be C# Superstar
Posted

I'm fairly certain that I am not going to find a way to avoid or even trap this error from shutting down my application.

Which stinks because I can't rely on any code I put after it. So this whole process needs to go in it's own separate application.

 

Now my issue is how do you design an application to run when it has a tendency to cop out at odd intervals?

 

What my process does is select some records from Oracle, work on them, then update the original records with some new values.

 

So the way I thought I would go about solving this dilemma is to create a table in Oracle that lists how many records need to be done and how many have been done. Then I can check the table at intervals and see if the process is done with all the records. If it is then great. If it is not then I need to restart the process and set the first record to work on equal to the last record done plus one (effectively skipping the record that is the bad seed).

 

One big problem is: how do I know that my first process has completed or crashed? It could be running slowly and still working but how would I know?

Wanna-Be C# Superstar
  • Administrators
Posted

Catch ex as exception

will catch all managed exceptions, if you are calling into unmanaged code (which you are) it is possible for non .net errors to occur.

 

Try using either

catch   'no exception specified

or hooking the application domain's unhandledexception event

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf BadThingHappened
   End Sub

   Public Sub BadThingHappened(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
'see if it ever hits this block
   End Sub

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Thanks for the tip. That may be just what I am looking for. Unfortunately, when I went back this morning to implement this I got some more strange results. What was happening yesterday is not happening today. Yesterday when I reached the offending code it would bail out of my whole program, today it freezes it. In debug mode I step right up to the bad code and when I get to the line it just freezes in read-only [run] debug mode. The only way out is to break.

 

<rant>

Inconsistency is the mortal enemy of any programmer. If you can't reproduce something today that happened yesterday how the heck can you plan for tomorrow.

</rant>

 

Oh well, back to the drawing board.

Wonder why it would freeze like that?

Wanna-Be C# Superstar
Posted

Well, I found that there were 2 different kinds of 'bad' files. Ones that freeze my app and ones that crash it. I tried the two methods mentioned (the Handler and the singel Catch) and no luck. The app just dies and bails out and dumps me back into Studio with no excuses, no errors.

 

I think I'm ready to give up on this one........ :o

Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...