1 Please add your comments to this file about mismatches between the API
2 documentation and the implementation in the Microsoft or ECMA implementations
3 of the class libraries.
5 * Type.GetCustomAttributes(Type, bool)
7 Documentation does not mention that an ArgumentNullException is
8 thrown if Type is a null value.
10 * Rectangle.IsEmpty and RectangleF.IsEmpty
12 Documentation says "This property returns true if the Width, Height, X,
13 and Y properties of this RectangleF all have values of zero; otherwise,
14 false." Reality: returns TRUE if width or height are equal 0.
16 * Array.CreateInstance (Type, long[] lengths)
18 Docs say if lengths is null, it will throw an ArgumentNullException,
19 but actually .NET 1.1 throws a NullReferenceException.
21 * String Constructor (Char[], Int32, Int32):
23 String s = new String ((char[])null, 0, 0) throws a null, but the docs
28 File.Exists(null) returns false whenever there is a problem with the
29 path or permissions. This is a security feature which prevents the
30 abuse of this method to discover what files might exist on the sytem.
31 This doc error has been confirmed with MS and should be fixed in
32 the next version of the docs.
34 * SocketPermission.IsSubsetOf:
36 10.11.4.* IsSubsetOf 10.11.*.* returns false --> which is incorrect
38 * SecurityElement.IsValid* ():
40 All return incorrect results. E.g. IsValidTag ("&") returns true while
41 it should be false and IsValidAttributeValue ("1 >= 2") returns false
42 while this should be true.
44 * SocketPermission.Union (null):
46 Doesn't throw an ArgumentNullException.
48 * System.Net.Cookie.Value:
50 Spec says property cannot accept the semicolon and comma characters,
53 * System.Net.Cookie.Domain:
55 Setting this property has no effect on ToString
57 * System.Net.Cookie Path:
59 Setting this property has no effect on ToString
61 * System.Net.CookieCollection:
63 The ReadOnly property has a getter only, which always returns true.
64 Yet you can always add Cookie's.
66 * Array.IList.Contains(object):
67 Throws an exception when called on a multi-dimensional array. Docs
68 do not say this. Similar to Array.IList.IndexOf(object).
70 * Version.CompareTo(null):
72 Does not throw an exception. Any version compared to null is
73 considered to be subsequent to null.
77 The docs say it should be ArgumentOutOfRangeException in the
78 case where "startIndex is less than zero or greater than the
79 length of value minus 2.", but the mscorlib throws an
82 * Guid.Guid(string) ctor:
84 The documentation says this ctor accepts (amongst others) the format
85 "{0xdddddddd,0xdddd,0xdddd,{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},
86 {0xdd},{0xdd}}". As implemented in mscorlib, however, it accepts:
87 "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}.
89 * Guid.ToString(string format):
91 The documentation specifies that if the format is the empty
92 string or null, this is equivalant to a format "N". In
93 mscorlib, the format "D" is taken here.
95 * String.Compare (String, Int32, String, Int32, Int32):
97 The documentation is a bit confusing.
99 In the "Remarks" section it says
101 >> The number of characters compared is the lesser of the length of
102 strA less indexA, the length of strB less indexB, and length.
104 In the "Exception" section it says a condition for the
105 ArgumentOutOfRangeException
107 >> The sum of indexA and length is greater than strA. Length.
109 >> The sum of indexB and length is greater than strB. Length.
111 >> indexA, indexB, or length is negative.
113 The latter implies that Compare ("ab", 0, "abcdef", 0, 3) will
114 throw an exception - but the "Remarks" section implies that it will
115 not. Both mscorlib.dll and our class libraries behave according to
116 the "Remarks" section.
118 * TypeBuilder.GetInterfaces
120 This method does not return all the interfaces as documented,
121 it only returns the interfaces that are implemented by this
122 class, but not the interfaces that are exposed by the parent
125 * Array.CopyTo (Array, int).
127 According to the documentation, an ArgumentException is thrown
128 if either "index is equal to or larger than the size of the
129 array" or "the number of elements in the source array is
130 greater than the available space from index to the end of the
133 The first condition is wrong, an exception is not thrown if
134 index is equal to the length of array, but the source array
135 contains zero elements:
137 int[] src = new int [0];
138 int[] dest = new int [0];
141 * Assembly.Load (string)
143 The documentation states that the argument is the 'display name'
144 of an assembly (eg 'System.Data') but since v1 this method will
145 only successfully load an assembly if a full reference is given.
146 The docs even give the following example:
148 Assembly SampleAssembly;
149 // Load the assembly by providing the type name.
150 SampleAssembly = Assembly.Load("System.Data");
152 which fails with a FileNotFoundException. Apparently the method
153 to use for loading an assembly given a display name is
154 Assembly.LoadWithPartialName (string).
156 * SortedList.Clear ()
158 The documentation claims that the Capacity of the sorted list
159 will not change, but it does.
161 * StringBuilder.Insert (int index, string value, int count)
163 It throws an exception for count < 1 instead of count < 0, which