Solved

ConfigurationException(string, System.Exception)' is obsolete

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

13 Experts available now in Live!

Get 1:1 Help Now