Solved

ConfigurationException(string, System.Exception)' is obsolete

Posted on 2006-11-12
3
1,658 Views
Last Modified: 2012-08-13
Please help!!

I have been unable to resolve the following warning: System.Configuration.ConfigurationException.ConfigurationException(string, System.Exception)' is obsolete: 'This class is obsolete, to create a new exception create a System.Configuration!System.Configuration.ConfigurationErrorsException'

internal static void LogAndThrowException(Exception e)
{
        string string1 = ResourceLoader.Instance.GetString(ResourceNamespaceEnum.ExceptionMessages, e.GetType().FullName, new object[0]);
        throw new ConfigurationException((string1, e);

}  // END: internal static void LogAndThrowException(Exception e)
0
Comment
Question by:wenyonk
3 Comments
 
LVL 13

Expert Comment

by:dungla
ID: 17928358
What is your .NET version?

You can try to throw new Exception instead of ConfigurationException
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 500 total points
ID: 17928803
Just change your code to :

internal static void LogAndThrowException(Exception e)
{
        string string1 = ResourceLoader.Instance.GetString(ResourceNamespaceEnum.ExceptionMessages, e.GetType().FullName, new object[0]);
        throw new ConfigurationErrorsException((string1, e);

}  // END: internal static void LogAndThrowException(Exception e)

0
 

Author Comment

by:wenyonk
ID: 17930313
If worked after i added a reference to System.Configuration

I already added using System.Configuration but forgot to add the reference...

Thank you

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

15 Experts available now in Live!

Get 1:1 Help Now