disable broken tests on net_4_0
[mcs.git] / class / corlib / System.Globalization / CultureNotFoundException.cs
blob642410e7b8e45eea7a1411df6defd09d1552bd54
1 //
2 // System.Globalization.CultureNotFoundException.cs
3 //
4 // Authors:
5 // Gonzalo Paniagua Javier (gonzalo@novell.com)
6 //
7 // Copyright (c) 2010 Novell (http://www.novell.com)
8 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 #if NET_4_0
31 using System;
32 using System.Runtime.InteropServices;
33 using System.Runtime.Serialization;
35 namespace System.Globalization {
36 [Serializable]
37 [ComVisible (true)]
38 public class CultureNotFoundException : ArgumentException, ISerializable {
39 string invalid_culture_name;
40 int? invalid_culture_id;
42 public CultureNotFoundException () : base ("Culture not found")
46 public CultureNotFoundException (string message) : base (message)
50 protected CultureNotFoundException (SerializationInfo info, StreamingContext context)
51 : base (info, context)
53 invalid_culture_name = (string) info.GetValue ("invalid_culture_name", typeof (string));
54 invalid_culture_id = (int?) info.GetValue ("invalid_culture_id", typeof (int?));
57 public CultureNotFoundException (string message, Exception innerException)
58 : base (message, innerException)
62 public CultureNotFoundException (string paramName, string message)
63 : base (message, paramName)
67 public CultureNotFoundException (string message, int invalidCultureId, Exception innerException)
68 : base (message, innerException)
70 invalid_culture_id = invalidCultureId;
73 public CultureNotFoundException (string paramName, int invalidCultureId, string message)
74 : base (message, paramName)
76 invalid_culture_id = invalidCultureId;
79 public CultureNotFoundException (string message, string invalidCultureName, Exception innerException)
80 : base (message, innerException)
82 invalid_culture_name = invalidCultureName;
85 public CultureNotFoundException (string paramName, string invalidCultureName, string message)
86 : base (message, paramName)
88 invalid_culture_name = invalidCultureName;
91 public override void GetObjectData(SerializationInfo info, StreamingContext context)
93 if (info == null)
94 throw new ArgumentNullException ("info");
96 base.GetObjectData (info, context);
97 info.AddValue ("invalid_culture_name", invalid_culture_name, typeof (string));
98 info.AddValue ("invalid_culture_id", invalid_culture_id, typeof (int?));
101 public virtual int? InvalidCultureId {
102 get { return invalid_culture_id; }
105 public virtual string InvalidCultureName {
106 get { return invalid_culture_name; }
109 public override string Message {
110 get {
111 if (invalid_culture_name == null && invalid_culture_id.HasValue == false)
112 return base.Message;
114 if (invalid_culture_name != null)
115 return String.Format ("Culture name {0} is invalid", invalid_culture_name);
116 return String.Format ("Culture ID {0} is invalid", invalid_culture_id);
121 #endif