Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Anyway to ignore unhandled errors in config file?

I'm developing an app using both SQL Server and IBM provider.
I'm getting this error and seems like it's from IBM and we need to get a hotfix from them. Until then, is there a way to catch/ignore unhandled exceptions in App.Config (i'm using windows console).

Code works fine , just get the error at the end. Need to ignore the error until we get the hotfix.

This thread talks about the error and mentions below but i dont see that legacy option. I added it but got an error.
<runtime>
   <legacyUnhandledExceptionPolicy enabled="1"/>
  </runtime>

ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

try catch wont work since it happens at the end of the app. No where specific. At the very very last line of the app when it's closing...

Getting the hotfix . I'll see if that would fix it.
Does it post an exception name? If so what is it.
i thought i posted the link , i hadnt:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=115170

Error is :
System.ObjectDisposedException was unhandled
Safe handle has been closed
Hi Farzadw;

If you structure your console application like this then you should not get the error being displayed.

Fernando
using System;
using System.Collections.Generic;
using System.Text;
 
namespace ConsoleApplication3
{
    class Program
    {
        private static void DoTheRealWorkHere()
        {
            // Do you real work here
        }
        
        static void Main(string[] args)
        {
            try
            {
                DoTheRealWorkHere();
            }
            catch (Exception ex)
            {
 
            }
        }
    }
}

Open in new window

let me try it.
tried it and still throws the error. I havent applied IBM's fix. I'm using this code for the Data Access layer
http://aspalliance.com/837 
and there's no try-catch in his code. I think the error is from IBM's provider when it connects or something (i read something like that).

I****  got a more detailed error:

Unhandled Exception: System.ObjectDisposedException: Safe handle has been closed
   at System.Runtime.InteropServices.SafeHandle.DangerousRelease()
   at System.Threading.RegisteredWaitHandleSafe.Finalize()


Which lead me to this site:
http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.safehandle.dangerousrelease(VS.80).aspx

Wonder if I need to code for safe handle.

*** told my manager about the fix and he's in la la land somewhere. If I could get around it with code, that would be great. Otherwise, he needs to deal with it.

Sorry but I have not used this configuration before and can not help in this matter.