Still having problems with exceptions in .NET causing program or thread to end without error

Posted on 2008-11-13
Last Modified: 2013-11-26
As you can see, the question I'm relating to yielded a long discussion and a lot of good context.  It turns out, I'm running into a similar problem (probably the result of an external .dll also), but I want to know how to *really* avoid/solve it if I can't get rid of the offending .dll.  I'm using VS 2008, and I've also checked to make sure the debug option is turned on for the exception assistant.

In my case, the rogue exception is on a backgroundworker--so the program doesn't even end--the thread just goes away and the user assumes all is OK.  Not good.

I realize that in a perfect world every exception would be coded for and handled with at try/catch block--but in the real world there are times I need to even force an exception because the cost/benefit of coding for that exception is too high vs a real person intervening.

If it *is* a rogue .dll causing the situation, what can I do?  What would be the equivalent of a VB6 'on error goto 0' (the statement that turns off error trapping in VB6)?
Question by:WJoeMoore
    LVL 10

    Accepted Solution


    You asked:

    What would be the equivalent of a VB6 'on error goto 0' (the statement that turns off error trapping in VB6)?

    It think that's the whole point of the Try/Catch block.  You can choose to react to an exception or not.  For example:


       ' Some function or code

    Catch ex as exception

       ' Put code in here to handle the error

      '  If I put nothing in here it will ignore error and attempt to continue processing

    End try

    I might be misunderstanding you, but that's my cents.



    Author Comment

    It looks as if when I put the offending .dll call in a try/catch, future uncaught exceptions do throw the program into the exception assistant.

    So, I can still use try/catch as appropriate and allow human intervention in places where I deem that appropriate as well.

    Even though you didn't provide new information, I know how to work with the situation and code for it.  Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now