3 // Copyright (c) Microsoft Corporation. All rights reserved.
9 using System.Runtime.Serialization;
10 using System.Security.Permissions;
11 using System.Diagnostics.Contracts;
13 [System.Runtime.InteropServices.ComVisible(true)]
15 public class NotFiniteNumberException : ArithmeticException {
16 private double _offendingNumber;
18 public NotFiniteNumberException()
19 : base(Environment.GetResourceString("Arg_NotFiniteNumberException")) {
21 SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
24 public NotFiniteNumberException(double offendingNumber)
26 _offendingNumber = offendingNumber;
27 SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
30 public NotFiniteNumberException(String message)
33 SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
36 public NotFiniteNumberException(String message, double offendingNumber)
38 _offendingNumber = offendingNumber;
39 SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
42 public NotFiniteNumberException(String message, Exception innerException)
43 : base(message, innerException) {
44 SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
47 public NotFiniteNumberException(String message, double offendingNumber, Exception innerException)
48 : base(message, innerException) {
49 _offendingNumber = offendingNumber;
50 SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
53 protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) {
54 _offendingNumber = info.GetInt32("OffendingNumber");
57 public double OffendingNumber {
58 get { return _offendingNumber; }
61 [System.Security.SecurityCritical] // auto-generated_required
62 public override void GetObjectData(SerializationInfo info, StreamingContext context) {
64 throw new ArgumentNullException("info");
66 Contract.EndContractBlock();
67 base.GetObjectData(info, context);
68 info.AddValue("OffendingNumber", _offendingNumber, typeof(Int32));