Bump corefx
[mono.git] / mcs / class / referencesource / mscorlib / system / notfinitenumberexception.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 namespace System {
7     
8     using System;
9     using System.Runtime.Serialization;
10     using System.Security.Permissions;
11     using System.Diagnostics.Contracts;
12
13 [System.Runtime.InteropServices.ComVisible(true)]
14     [Serializable]
15     public class NotFiniteNumberException : ArithmeticException {
16         private double _offendingNumber;    
17     
18         public NotFiniteNumberException() 
19             : base(Environment.GetResourceString("Arg_NotFiniteNumberException")) {
20             _offendingNumber = 0;
21             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
22         }
23
24         public NotFiniteNumberException(double offendingNumber) 
25             : base() {
26             _offendingNumber = offendingNumber;
27             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
28         }
29
30         public NotFiniteNumberException(String message) 
31             : base(message) {
32             _offendingNumber = 0;
33             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
34         }
35
36         public NotFiniteNumberException(String message, double offendingNumber) 
37             : base(message) {
38             _offendingNumber = offendingNumber;
39             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
40         }
41
42         public NotFiniteNumberException(String message, Exception innerException) 
43             : base(message, innerException) {
44             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
45         }
46         
47         public NotFiniteNumberException(String message, double offendingNumber, Exception innerException) 
48             : base(message, innerException) {
49             _offendingNumber = offendingNumber;
50             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
51         }
52
53         protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) {
54             _offendingNumber = info.GetInt32("OffendingNumber");
55         }
56
57         public double OffendingNumber {
58             get { return _offendingNumber; }
59         }
60
61         [System.Security.SecurityCritical]  // auto-generated_required
62         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
63             if (info==null) {
64                 throw new ArgumentNullException("info");
65             }
66             Contract.EndContractBlock();
67             base.GetObjectData(info, context);
68             info.AddValue("OffendingNumber", _offendingNumber, typeof(Int32));
69         }
70     }
71 }