Solved

ConfigurationException(string, System.Exception)' is obsolete

Posted on 2006-11-12
3
1,664 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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