1 // Copyright (c) Microsoft. All rights reserved. 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 4 using System; 5 using System.Globalization; 6 using System.Runtime.Serialization; 7 8 using Microsoft.Build.BuildEngine.Shared; 9 10 namespace Microsoft.Build.BuildEngine 11 { 12 /// <summary> 13 /// Generic exception used to wrap exceptions thrown during Registry access. 14 /// </summary> 15 [Serializable] 16 internal class RegistryException : Exception 17 { 18 /// <summary> 19 /// Basic constructor. 20 /// </summary> RegistryException()21 public RegistryException() 22 : base() 23 { 24 } 25 26 /// <summary> 27 /// Basic constructor. 28 /// </summary> 29 /// <param name="message"></param> RegistryException(string message)30 public RegistryException(string message) 31 : base(message) 32 { 33 } 34 35 /// <summary> 36 /// Basic constructor. 37 /// </summary> 38 /// <param name="message"></param> 39 /// <param name="innerException"></param> RegistryException(string message, Exception innerException)40 public RegistryException(string message, Exception innerException) 41 : base(message, innerException) 42 { 43 } 44 45 /// <summary> 46 /// Constructor that takes a string description of the registry 47 /// key or value causing the error. 48 /// </summary> 49 /// <param name="message"></param> 50 /// <param name="source"></param> RegistryException(string message, string source)51 public RegistryException(string message, string source) 52 : base(message) 53 { 54 base.Source = source; 55 } 56 57 /// <summary> 58 /// Since this class implements Iserializable this constructor is required to be implemented. 59 /// </summary> RegistryException(SerializationInfo info, StreamingContext context)60 protected RegistryException(SerializationInfo info, StreamingContext context) : base(info, context) 61 { 62 // We don't have any reason at the moment to do any custom serizlization or deserialization, this methods was added 63 // to conform to the implementation of the standard constructors for ISerializable classes 64 } 65 66 /// <summary> 67 /// Constructor that takes a string description of the registry 68 /// key or value causing the error. 69 /// </summary> 70 /// <param name="message"></param> 71 /// <param name="source"></param> 72 /// <param name="innerException"></param> RegistryException(string message, string source, Exception innerException)73 public RegistryException(string message, string source, Exception innerException) 74 : base(message, innerException) 75 { 76 base.Source = source; 77 } 78 } 79 } 80