locked
C# Error Handling RRS feed

  • Question

  • Continue efforts to address C# language error handling. There is a system drawback that commonly exist within C# language . The drawback deals with the inability to catch exceptions before entering production libraries. Is there any recent update on this issue ?

    Tuesday, June 18, 2013 4:01 PM

Answers

  • Continue efforts to address C# language error handling. There is a system drawback that commonly exist within C# language . The drawback deals with the inability to catch exceptions before entering production libraries. Is there any recent update on this issue ?

    There haven't been any changes to exception handling in C#.  

    However, I am not sure I follow your "drawback" - you can easily catch exceptions before and after calling any method or creating any type within a production library, and have always been able to do so in C#...


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Mike Feng Thursday, June 27, 2013 3:22 AM
    Tuesday, June 18, 2013 4:10 PM
  • "The drawback deals with the inability to catch exceptions beforeentering production libraries."

    Care to explain a bit more what drawback are you talking about? It's more common to talk about exceptions exiting or escaping functions/libraries etc. than "entering". Entering from where?

    • Marked as answer by Mike Feng Thursday, June 27, 2013 3:22 AM
    Tuesday, June 18, 2013 4:13 PM
  • "use a “out” parameter to catch all the exceptions"

    Maybe that's why there weren't convinced. What do you mean by using out parameters to catch all exceptions?! What out parameters have to do with exceptions?

    Using out parameters tends to be frowned upon. Catching all exceptions is most of the time a bad idea.

    • Marked as answer by Mike Feng Thursday, June 27, 2013 3:22 AM
    Wednesday, June 19, 2013 3:22 PM

All replies

  • Continue efforts to address C# language error handling. There is a system drawback that commonly exist within C# language . The drawback deals with the inability to catch exceptions before entering production libraries. Is there any recent update on this issue ?

    There haven't been any changes to exception handling in C#.  

    However, I am not sure I follow your "drawback" - you can easily catch exceptions before and after calling any method or creating any type within a production library, and have always been able to do so in C#...


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Mike Feng Thursday, June 27, 2013 3:22 AM
    Tuesday, June 18, 2013 4:10 PM
  • "The drawback deals with the inability to catch exceptions beforeentering production libraries."

    Care to explain a bit more what drawback are you talking about? It's more common to talk about exceptions exiting or escaping functions/libraries etc. than "entering". Entering from where?

    • Marked as answer by Mike Feng Thursday, June 27, 2013 3:22 AM
    Tuesday, June 18, 2013 4:13 PM
  • Recently i was asked this question by an <state w:st="on"><place w:st="on">Illinois</place></state> state examiner.

    What they mean is an error or exception from any supporting libraries to the production libraries.

    What I usually do is throw the exception from the supporting libraries or use a “out” parameter to catch all the exceptions. Looks like they were not convinced and asked me to follow up on the updates to C# exception handling.

    Any help on this issue will be appreciated .Thanks!

    Wednesday, June 19, 2013 2:45 PM
  • "use a “out” parameter to catch all the exceptions"

    Maybe that's why there weren't convinced. What do you mean by using out parameters to catch all exceptions?! What out parameters have to do with exceptions?

    Using out parameters tends to be frowned upon. Catching all exceptions is most of the time a bad idea.

    • Marked as answer by Mike Feng Thursday, June 27, 2013 3:22 AM
    Wednesday, June 19, 2013 3:22 PM
  • Write Error Log or Exception Log into File in C# .NET

    Generally we are not interested to show any type of application error to end user. Error logs are very important for collecting all error data generated by an application. It is more useful during an early or beta release of a product. That's why it is better to store any kind of exceptions in one place. This files can be send by email or others technology to developer. Time to time developer must analyze them and fix all the bugs without knowing clients. It will increase application performance.

    There are different ways to save the application errors, some developers like to save logs in database while some in text file. Text file responds much quicker then database. I am discussing here to write error log in text file. This will log all errors with date and time in text file. 

    for more : VISIT
    Wednesday, July 10, 2013 6:23 AM