<p>What is best practice when creating your exception classes in a .NET solution: To derive from <code>System.Exception</code> or from <code>System.ApplicationException</code>?</p>

[{'answer_id': 52762, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 4, 'selected': False, 'text': '<p><a href="https://web.archive.org/web/20190904221653/https://blogs.msdn.microsoft.com/kcwalina/2006/06/23/applicationexception-considered-useless/" rel="nofollow noreferrer"><code>ApplicationException</code> considered useless</a> is a strong, and critical, argument against <code>ApplicationException</code>.</p>\n\n<p>Upshot: don\'t use it. Derive from <code>Exception</code>.</p>\n'}, {'answer_id': 52763, 'author': 'rp.', 'author_id': 2536, 'author_profile': 'https://Stackoverflow.com/users/2536', 'pm_score': 4, 'selected': False, 'text': '<p>The authors of the framework themselves consider ApplicationException worthless:</p>\n\n<p><a href="https://web.archive.org/web/20190904221653/https://blogs.msdn.microsoft.com/kcwalina/2006/06/23/applicationexception-considered-useless/" rel="nofollow noreferrer">https://web.archive.org/web/20190904221653/https://blogs.msdn.microsoft.com/kcwalina/2006/06/23/applicationexception-considered-useless/</a></p>\n\n<p>with a nice follow-up here:</p>\n\n<p><a href="https://web.archive.org/web/20190828075736/https://blogs.msdn.microsoft.com/kcwalina/2006/07/05/choosing-the-right-type-of-exception-to-throw/" rel="nofollow noreferrer">https://web.archive.org/web/20190828075736/https://blogs.msdn.microsoft.com/kcwalina/2006/07/05/choosing-the-right-type-of-exception-to-throw/</a></p>\n\n<p>When in doubt, I follow their book Framework Design Guidelines.</p>\n\n<p><a href="https://rads.stackoverflow.com/amzn/click/com/0321246756" rel="nofollow noreferrer" rel="nofollow noreferrer">http://www.amazon.com/Framework-Design-Guidelines-Conventions-Development/dp/0321246756</a></p>\n\n<p>The topic of the blog post is further discussed there.</p>\n\n<p>rp</p>\n'}, {'answer_id': 52770, 'author': 'fryguybob', 'author_id': 4592, 'author_profile': 'https://Stackoverflow.com/users/4592', 'pm_score': 7, 'selected': True, 'text': '<p>According to Jeffery Richter in the Framework Design Guidelines book:</p>\n\n<blockquote>\n  <p><code>System.ApplicationException</code> is a class that should not be part of the .NET framework.</p>\n</blockquote>\n\n<p>It was intended to have some meaning in that you could potentially catch "all" the application exceptions, but the pattern was not followed and so it has no value.</p>\n'}, {'answer_id': 1086628, 'author': 'Olivier de Rivoyre', 'author_id': 26071, 'author_profile': 'https://Stackoverflow.com/users/26071', 'pm_score': 1, 'selected': False, 'text': '<p>I\'m used to do:</p>\n\n<pre><code>private void buttonFoo_Click()\n{\n    try\n    {\n       foo();\n    } \n    catch(ApplicationException ex)\n    {\n      Log.UserWarning(ex);\n      MessageVox.Show(ex.Message);\n    }\n    catch(Exception ex)\n    {\n       Log.CodeError(ex);\n       MessageBox.Show("Internal error.");\n    }\n}\n</code></pre>\n\n<p>It allow to do the difference between:</p>\n\n<ul>\n<li>C# code system error that I must repairs.</li>\n<li>"Normal" user error that do not need correction from me.</li>\n</ul>\n\n<p>I know it is not recommended to use ApplicationException, but it works great since there is <a href="http://msdn.microsoft.com/en-us/library/system.applicationexception.aspx" rel="nofollow noreferrer">very few classes</a> that do not respect the ApplicationException pattern.</p>\n'}, {'answer_id': 1086636, 'author': 'Blorgbeard', 'author_id': 369, 'author_profile': 'https://Stackoverflow.com/users/369', 'pm_score': 5, 'selected': False, 'text': '<p>You should derive custom exceptions from <code>System.Exception</code>.</p>\n\n<p>Even MSDN now says to ignore <code>ApplicationException</code>:</p>\n\n<blockquote>\n  <p>If you are designing an application\n  that needs to create its own\n  exceptions, you are advised to derive\n  custom exceptions from the Exception\n  class. It was originally thought that\n  custom exceptions should derive from\n  the ApplicationException class;\n  however in practice this has not been\n  found to add significant value. For \n  more information, see <a href="http://msdn.microsoft.com/en-us/library/seyhszts.aspx" rel="noreferrer">Best Practices for Handling Exceptions</a>. </p>\n</blockquote>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/system.applicationexception.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.applicationexception.aspx</a></p>\n'}]
['https://Stackoverflow.com/questions/52753', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5392/']