Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Anyway to ignore unhandled errors in config file?

Posted on 2007-11-29
8
Medium Priority
?
534 Views
Last Modified: 2010-04-15
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>

0
Comment
Question by:Camillia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 20377143
This code here is for ASP.Net, Web Applications not for Windows Form or Console applications.

<runtime>
   <legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>

To avoid the exception just place the offending code in a Try/Catch block.

        Try
            'Place statement/s that cause the exception here. Program
            ' continues on the first statement after the End Try.
        Catch ex As Exception

        End Try

Fernando
0
 
LVL 7

Author Comment

by:Camillia
ID: 20377187
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.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 20377328
Does it post an exception name? If so what is it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Author Comment

by:Camillia
ID: 20377406
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
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 20377683
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

0
 
LVL 7

Author Comment

by:Camillia
ID: 20378415
let me try it.
0
 
LVL 7

Author Comment

by:Camillia
ID: 20392135
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.

0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 20392456
Sorry but I have not used this configuration before and can not help in this matter.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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