Solved

ConfigurationException(string, System.Exception)' is obsolete

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Reference issues in Visual Studio 3 41
performance tune IIS 10 on win 2016 that only runs one website 4 121
abstract class C# 1 31
Input parameteres to DragOver 2 19
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

861 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