1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 /*=============================================================================
9 ** Purpose: The base class for all "less serious" exceptions that must be
10 ** declared or caught.
13 =============================================================================*/
15 using System
.Runtime
.Serialization
;
19 // The ApplicationException is the base class for nonfatal,
20 // application errors that occur. These exceptions are generated
21 // (i.e., thrown) by an application, not the Runtime. Applications that need
22 // to create their own exceptions do so by extending this class.
23 // ApplicationException extends but adds no new functionality to
24 // RecoverableException.
26 [System
.Runtime
.CompilerServices
.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
27 public class ApplicationException
: Exception
29 // Creates a new ApplicationException with its message string set to
30 // the empty string, its HRESULT set to COR_E_APPLICATION,
31 // and its ExceptionInfo reference set to null.
32 public ApplicationException()
33 : base(SR
.Arg_ApplicationException
)
35 HResult
= HResults
.COR_E_APPLICATION
;
38 // Creates a new ApplicationException with its message string set to
39 // message, its HRESULT set to COR_E_APPLICATION,
40 // and its ExceptionInfo reference set to null.
42 public ApplicationException(string? message
)
45 HResult
= HResults
.COR_E_APPLICATION
;
48 public ApplicationException(string? message
, Exception
? innerException
)
49 : base(message
, innerException
)
51 HResult
= HResults
.COR_E_APPLICATION
;
54 protected ApplicationException(SerializationInfo info
, StreamingContext context
) : base(info
, context
)