diff --git a/Microsoft.Research/Contracts/MsCorlib/MsCorlib.Contracts10.csproj b/Microsoft.Research/Contracts/MsCorlib/MsCorlib.Contracts10.csproj
index 047c523c..8518d5d8 100644
--- a/Microsoft.Research/Contracts/MsCorlib/MsCorlib.Contracts10.csproj
+++ b/Microsoft.Research/Contracts/MsCorlib/MsCorlib.Contracts10.csproj
@@ -328,8 +328,11 @@
+
+
+
@@ -848,6 +851,7 @@ Include="System.Security.Principal.WindowsPrincipal.cs" /> -->
+
diff --git a/Microsoft.Research/Contracts/MsCorlib/System.Collections.Generic.IDictionary.cs b/Microsoft.Research/Contracts/MsCorlib/System.Collections.Generic.IDictionary.cs
index feb13afd..e02ef420 100644
--- a/Microsoft.Research/Contracts/MsCorlib/System.Collections.Generic.IDictionary.cs
+++ b/Microsoft.Research/Contracts/MsCorlib/System.Collections.Generic.IDictionary.cs
@@ -167,11 +167,13 @@ TValue IDictionary.this[TKey key]
{
get
{
+ Contract.Requires(!ReferenceEquals(key, null));
// Contract.Requires(ContainsKey(key));
throw new NotImplementedException();
}
set
{
+ Contract.Requires(!ReferenceEquals(key, null));
// Contract.Ensures(ContainsKey(key));
//Contract.Ensures(old(ContainsKey(key)) ==> Count == old(Count));
//Contract.Ensures(!old(ContainsKey(key)) ==> Count == old(Count) + 1);
@@ -181,29 +183,31 @@ TValue IDictionary.this[TKey key]
void IDictionary.Add(TKey key, TValue value)
{
+ Contract.Requires(!ReferenceEquals(key, null));
// Contract.Requires(!ContainsKey(key));
//modifies this.*;
//Contract.Ensures(ContainsKey(key));
}
- bool IDictionary.ContainsKey(TKey key)
+ public bool ContainsKey(TKey key)
{
- var @this = (IDictionary)this;
- Contract.Ensures(!Contract.Result() || @this.Count > 0);
+ Contract.Requires(!ReferenceEquals(key, null));
+ Contract.Ensures(!Contract.Result() || (Count > 0));
throw new NotImplementedException();
}
bool IDictionary.Remove(TKey key)
{
+ Contract.Requires(!ReferenceEquals(key, null));
// Contract.Ensures(!Contract.Result() || Contract.OldValue(ContainsKey(key)) && !ContainsKey(key));
throw new NotImplementedException();
}
bool IDictionary.TryGetValue(TKey key, out TValue value)
{
- var @this = (IDictionary)this;
- Contract.Ensures(Contract.Result() == @this.ContainsKey(key));
+ Contract.Requires(!ReferenceEquals(key, null));
+ Contract.Ensures(Contract.Result() == ContainsKey(key));
throw new NotImplementedException();
}
@@ -211,7 +215,7 @@ bool IDictionary.TryGetValue(TKey key, out TValue value)
#region ICollection> Members
- int ICollection>.Count
+ public int Count
{
get { throw new NotImplementedException(); }
}
diff --git a/Microsoft.Research/Contracts/MsCorlib/System.Collections.ObjectModel.Collection.cs b/Microsoft.Research/Contracts/MsCorlib/System.Collections.ObjectModel.Collection.cs
new file mode 100644
index 00000000..099c91c1
--- /dev/null
+++ b/Microsoft.Research/Contracts/MsCorlib/System.Collections.ObjectModel.Collection.cs
@@ -0,0 +1,395 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Reflection;
+using System.Runtime;
+using System.Runtime.InteropServices;
+
+namespace System.Collections.ObjectModel
+{
+ // Summary:
+ // Provides the base class for a generic collection.
+ //
+ // Type parameters:
+ // T:
+ // The type of elements in the collection.
+ public class Collection : IList, ICollection, IEnumerable, IList, ICollection, IEnumerable
+ {
+ // Summary:
+ // Initializes a new instance of the System.Collections.ObjectModel.Collection
+ // class that is empty.
+ public Collection()
+ {
+ }
+
+ //
+ // Summary:
+ // Initializes a new instance of the System.Collections.ObjectModel.Collection
+ // class as a wrapper for the specified list.
+ //
+ // Parameters:
+ // list:
+ // The list that is wrapped by the new collection.
+ //
+ // Exceptions:
+ // System.ArgumentNullException:
+ // list is null.
+ public Collection(IList list)
+ {
+ Contract.Requires(list != null);
+ }
+
+ // Summary:
+ // Gets the number of elements actually contained in the System.Collections.ObjectModel.Collection.
+ //
+ // Returns:
+ // The number of elements actually contained in the System.Collections.ObjectModel.Collection.
+ public int Count
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ throw new NotImplementedException();
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ bool IList.IsReadOnly
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ bool ICollection.IsReadOnly
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ //
+ // Summary:
+ // Gets a System.Collections.Generic.IList wrapper around the System.Collections.ObjectModel.Collection.
+ //
+ // Returns:
+ // A System.Collections.Generic.IList wrapper around the System.Collections.ObjectModel.Collection.
+ protected IList Items
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result>() != null);
+ return null;
+ }
+ }
+
+ // Summary:
+ // Gets or sets the element at the specified index.
+ //
+ // Parameters:
+ // index:
+ // The zero-based index of the element to get or set.
+ //
+ // Returns:
+ // The element at the specified index.
+ //
+ // Exceptions:
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.-or-index is equal to or greater than System.Collections.ObjectModel.Collection.Count.
+ public T this[int index] {
+ get
+ {
+ return default(T);
+ }
+ set
+ {
+ }
+ }
+
+ // Summary:
+ // Adds an object to the end of the System.Collections.ObjectModel.Collection.
+ //
+ // Parameters:
+ // item:
+ // The object to be added to the end of the System.Collections.ObjectModel.Collection.
+ // The value can be null for reference types.
+ public void Add(T item)
+ {
+
+ }
+ //
+ // Summary:
+ // Removes all elements from the System.Collections.ObjectModel.Collection.
+
+ int IList.Add(object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Clear()
+ {
+
+ }
+
+ bool IList.Contains(object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ int IList.IndexOf(object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ void IList.Remove(object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ //
+ // Summary:
+ // Removes all elements from the System.Collections.ObjectModel.Collection.
+ protected virtual void ClearItems()
+ {
+
+ }
+ //
+ // Summary:
+ // Determines whether an element is in the System.Collections.ObjectModel.Collection.
+ //
+ // Parameters:
+ // item:
+ // The object to locate in the System.Collections.ObjectModel.Collection.
+ // The value can be null for reference types.
+ //
+ // Returns:
+ // true if item is found in the System.Collections.ObjectModel.Collection;
+ // otherwise, false.
+ public bool Contains(T item)
+ {
+ return false;
+ }
+ //
+ // Summary:
+ // Copies the entire System.Collections.ObjectModel.Collection to a compatible
+ // one-dimensional System.Array, starting at the specified index of the target
+ // array.
+ //
+ // Parameters:
+ // array:
+ // The one-dimensional System.Array that is the destination of the elements
+ // copied from System.Collections.ObjectModel.Collection. The System.Array
+ // must have zero-based indexing.
+ //
+ // index:
+ // The zero-based index in array at which copying begins.
+ //
+ // Exceptions:
+ // System.ArgumentNullException:
+ // array is null.
+ //
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.
+ //
+ // System.ArgumentException:
+ // The number of elements in the source System.Collections.ObjectModel.Collection
+ // is greater than the available space from index to the end of the destination
+ // array.
+ public void CopyTo(T[] array, int index)
+ {
+
+ }
+ //
+ // Summary:
+ // Returns an enumerator that iterates through the System.Collections.ObjectModel.Collection.
+ //
+ // Returns:
+ // An System.Collections.Generic.IEnumerator for the System.Collections.ObjectModel.Collection.
+ public IEnumerator GetEnumerator()
+ {
+ return null;
+ }
+
+ [ContractModel]
+ public object[] Model
+ {
+ [ContractRuntimeIgnored]
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ //
+ // Summary:
+ // Searches for the specified object and returns the zero-based index of the
+ // first occurrence within the entire System.Collections.ObjectModel.Collection.
+ //
+ // Parameters:
+ // item:
+ // The object to locate in the System.Collections.Generic.List. The value
+ // can be null for reference types.
+ //
+ // Returns:
+ // The zero-based index of the first occurrence of item within the entire System.Collections.ObjectModel.Collection,
+ // if found; otherwise, -1.
+ public int IndexOf(T item)
+ {
+ return 0;
+ }
+ //
+ // Summary:
+ // Inserts an element into the System.Collections.ObjectModel.Collection
+ // at the specified index.
+ //
+ // Parameters:
+ // index:
+ // The zero-based index at which item should be inserted.
+ //
+ // item:
+ // The object to insert. The value can be null for reference types.
+ //
+ // Exceptions:
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection.Count.
+ public void Insert(int index, T item)
+ {
+
+ }
+ //
+ // Summary:
+ // Inserts an element into the System.Collections.ObjectModel.Collection
+ // at the specified index.
+ //
+ // Parameters:
+ // index:
+ // The zero-based index at which item should be inserted.
+ //
+ // item:
+ // The object to insert. The value can be null for reference types.
+ //
+ // Exceptions:
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection.Count.
+ protected virtual void InsertItem(int index, T item)
+ {
+ Contract.Requires((index >= 0) && (index <= Count));
+ }
+ //
+ // Summary:
+ // Removes the first occurrence of a specific object from the System.Collections.ObjectModel.Collection.
+ //
+ // Parameters:
+ // item:
+ // The object to remove from the System.Collections.ObjectModel.Collection.
+ // The value can be null for reference types.
+ //
+ // Returns:
+ // true if item is successfully removed; otherwise, false. This method also
+ // returns false if item was not found in the original System.Collections.ObjectModel.Collection.
+ public bool Remove(T item)
+ {
+ return false;
+ }
+ //
+ // Summary:
+ // Removes the element at the specified index of the System.Collections.ObjectModel.Collection.
+ //
+ // Parameters:
+ // index:
+ // The zero-based index of the element to remove.
+ //
+ // Exceptions:
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.-or-index is equal to or greater than System.Collections.ObjectModel.Collection.Count.
+ public void RemoveAt(int index) { }
+ //
+ // Summary:
+ // Removes the element at the specified index of the System.Collections.ObjectModel.Collection.
+ //
+ // Parameters:
+ // index:
+ // The zero-based index of the element to remove.
+ //
+ // Exceptions:
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.-or-index is equal to or greater than System.Collections.ObjectModel.Collection.Count.
+ protected virtual void RemoveItem(int index)
+ {
+ Contract.Requires((index >= 0) && (index < Count));
+ }
+ //
+ // Summary:
+ // Replaces the element at the specified index.
+ //
+ // Parameters:
+ // index:
+ // The zero-based index of the element to replace.
+ //
+ // item:
+ // The new value for the element at the specified index. The value can be null
+ // for reference types.
+ //
+ // Exceptions:
+ // System.ArgumentOutOfRangeException:
+ // index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection.Count.
+ protected virtual void SetItem(int index, T item)
+ {
+ // Comment is wrong, index must be < Count!
+ Contract.Requires((index >= 0) && (index < Count));
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
diff --git a/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CalendarWeekRule.cs b/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CalendarWeekRule.cs
index 57cf7277..3d1f53db 100644
--- a/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CalendarWeekRule.cs
+++ b/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CalendarWeekRule.cs
@@ -22,8 +22,6 @@
namespace System.Globalization {
// Summary:
// Defines different rules for determining the first week of the year.
- [Serializable]
- [ComVisible(true)]
public enum CalendarWeekRule {
// Summary:
// Indicates that the first week of the year starts on the first day of the
diff --git a/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CultureInfo.cs b/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CultureInfo.cs
index feb8a39d..8b90ebc9 100644
--- a/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CultureInfo.cs
+++ b/Microsoft.Research/Contracts/MsCorlib/System.Globalization.CultureInfo.cs
@@ -18,6 +18,19 @@
namespace System.Globalization
{
+#if !SILVERLIGHT
+ public enum CultureTypes
+ {
+ NeutralCultures = 1,
+ SpecificCultures = 2,
+ InstalledWin32Cultures = 4,
+ AllCultures = InstalledWin32Cultures | SpecificCultures | NeutralCultures,
+ UserCustomCulture = 8,
+ ReplacementCultures = 16,
+ WindowsOnlyCultures = 32,
+ FrameworkCultures = 64,
+ }
+#endif
public abstract class CultureInfo
{
@@ -168,26 +181,27 @@ public static CultureInfo InstalledUICulture
}
#endif
-#if false
- public DateTimeFormatInfo DateTimeFormat
+ public virtual DateTimeFormatInfo DateTimeFormat
{
get
{
Contract.Ensures(Contract.Result() != null);
+ return null;
}
set
{
Contract.Requires(value != null);
}
}
-#endif
-#if false
- public CultureInfo Parent
+ public virtual CultureInfo Parent
{
- get;
+ get
+ {
+ Contract.Ensures(Contract.Result() != null);
+ return null;
+ }
}
-#endif
public virtual string EnglishName
{
@@ -225,14 +239,14 @@ public static CultureInfo ReadOnly(CultureInfo ci)
public abstract object GetFormat(Type formatType);
-#if false
+#if !SILVERLIGHT
+
public static CultureInfo[] GetCultures(CultureTypes types)
{
+ Contract.Ensures(Contract.Result() != null);
return default(CultureInfo[]);
}
-#endif
-#if !SILVERLIGHT
public static CultureInfo CreateSpecificCulture(string name)
{
Contract.Ensures(Contract.Result() != null);
diff --git a/Microsoft.Research/Contracts/MsCorlib/System.Globalization.DateTimeFormatInfo.cs b/Microsoft.Research/Contracts/MsCorlib/System.Globalization.DateTimeFormatInfo.cs
index 9d6197ca..a8d7c93d 100644
--- a/Microsoft.Research/Contracts/MsCorlib/System.Globalization.DateTimeFormatInfo.cs
+++ b/Microsoft.Research/Contracts/MsCorlib/System.Globalization.DateTimeFormatInfo.cs
@@ -170,6 +170,7 @@ public String[] AbbreviatedDayNames
}
}
+#if !SILVERLIGHT
public string DateSeparator
{
get
@@ -183,6 +184,7 @@ public string DateSeparator
Contract.Requires(value != null);
}
}
+#endif
public string FullDateTimePattern
{
@@ -198,6 +200,7 @@ public string FullDateTimePattern
}
}
+#if !SILVERLIGHT
public string TimeSeparator
{
get
@@ -211,13 +214,13 @@ public string TimeSeparator
Contract.Requires(value != null);
}
}
-
+#endif
public Calendar Calendar
{
get
{
Contract.Ensures(Contract.Result() != null);
- return default(string);
+ return default(Calendar);
}
set
@@ -334,16 +337,20 @@ public string GetDayName(DayOfWeek dayofweek)
return default(string);
}
+
+#if !SILVERLIGHT
public String[] GetAllDateTimePatterns(Char format)
{
-
+ Contract.Ensures(Contract.Result() != null);
return default(String[]);
}
public String[] GetAllDateTimePatterns()
{
-
+ Contract.Ensures(Contract.Result() != null);
return default(String[]);
}
+#endif
+
public string GetAbbreviatedDayName(DayOfWeek dayofweek)
{
Contract.Requires((int)dayofweek >= 0);
@@ -369,24 +376,20 @@ public int GetEra(string eraName)
return default(int);
}
- public object Clone()
+ public virtual object Clone()
{
return default(object);
}
- public object GetFormat(Type formatType)
+ public virtual object GetFormat(Type formatType)
{
return default(object);
}
public static DateTimeFormatInfo GetInstance(IFormatProvider provider)
{
-
- return default(DateTimeFormatInfo);
- }
- public DateTimeFormatInfo()
- {
- return default(DateTimeFormatInfo);
+ Contract.Ensures(Contract.Result() != null);
+ return default(DateTimeFormatInfo);
}
}
}
diff --git a/Microsoft.Research/Contracts/MsCorlib/System.String.cs b/Microsoft.Research/Contracts/MsCorlib/System.String.cs
index 85126c16..3157612b 100644
--- a/Microsoft.Research/Contracts/MsCorlib/System.String.cs
+++ b/Microsoft.Research/Contracts/MsCorlib/System.String.cs
@@ -162,6 +162,26 @@ public static String Concat(object arg0)
Contract.Ensures(Contract.Result() != null);
return default(String);
}
+
+#if NETFRAMEWORK_4_0 || NETFRAMEWORK_4_5
+
+ [Pure]
+ [Reads(ReadsAttribute.Reads.Nothing)]
+ public static String Concat(IEnumerable args)
+ {
+ Contract.Ensures(Contract.Result() != null);
+ return default(String);
+ }
+ [Pure]
+ [Reads(ReadsAttribute.Reads.Nothing)]
+ public static String Concat(IEnumerable args)
+ {
+ Contract.Ensures(Contract.Result() != null);
+ return default(String);
+ }
+#endif
+
+
[Pure]
[Reads(ReadsAttribute.Reads.Nothing)]
public static String Copy(String str)
@@ -1198,6 +1218,17 @@ public static String Join(String separator, String[] value)
}
#if NETFRAMEWORK_4_0 || NETFRAMEWORK_4_5
+
+ [Pure]
+ [Reads(ReadsAttribute.Reads.Nothing)]
+ public static String Join(String separator, Object[] value)
+ {
+ Contract.Requires(value != null);
+ Contract.Ensures(Contract.Result() != null);
+
+ return default(String);
+ }
+
[Pure]
public static string Join(string separator, IEnumerable values)
{
diff --git a/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Transform.cs b/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Transform.cs
index 14e41792..e6aa6741 100644
--- a/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Transform.cs
+++ b/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Transform.cs
@@ -83,6 +83,7 @@ public static System.Windows.Media.Transform Identity
{
get
{
+ Contract.Ensures(Contract.Result() != null);
return default(System.Windows.Media.Transform);
}
}
diff --git a/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Visual.cs b/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Visual.cs
index f50e4549..af92f926 100644
--- a/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Visual.cs
+++ b/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Visual.cs
@@ -19,6 +19,7 @@
using System.Text;
using System.Diagnostics.Contracts;
using System;
+using System.Windows.Media.Media3D;
// Disable the "this variable is not used" warning as every field would imply it.
#pragma warning disable 0414
@@ -104,21 +105,25 @@ int System.Windows.Media.Composition.DUCE.IResource.GetChannelCount()
public GeneralTransform TransformToAncestor(System.Windows.Media.Visual ancestor)
{
+ Contract.Ensures(Contract.Result() != null);
return default(GeneralTransform);
}
public System.Windows.Media.Media3D.GeneralTransform2DTo3D TransformToAncestor(System.Windows.Media.Media3D.Visual3D ancestor)
{
+ Contract.Ensures(Contract.Result() != null);
return default(System.Windows.Media.Media3D.GeneralTransform2DTo3D);
}
public GeneralTransform TransformToDescendant(System.Windows.Media.Visual descendant)
{
+ Contract.Ensures(Contract.Result() != null);
return default(GeneralTransform);
}
public GeneralTransform TransformToVisual(System.Windows.Media.Visual visual)
{
+ Contract.Ensures(Contract.Result() != null);
return default(GeneralTransform);
}
diff --git a/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.UIElement.cs b/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.UIElement.cs
index f6fa7f0d..750cbeda 100644
--- a/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.UIElement.cs
+++ b/Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.UIElement.cs
@@ -19,6 +19,7 @@
using System.Text;
using System.Diagnostics.Contracts;
using System;
+using System.Windows.Input;
// Disable the "this variable is not used" warning as every field would imply it.
#pragma warning disable 0414
@@ -767,6 +768,7 @@ public System.Windows.Input.CommandBindingCollection CommandBindings
{
get
{
+ Contract.Ensures(Contract.Result() != null);
return default(System.Windows.Input.CommandBindingCollection);
}
}
@@ -775,6 +777,7 @@ public Size DesiredSize
{
get
{
+ Contract.Ensures(!Contract.Result().IsEmpty);
return default(Size);
}
}
@@ -813,6 +816,7 @@ public System.Windows.Input.InputBindingCollection InputBindings
{
get
{
+ Contract.Ensures(Contract.Result() != null);
return default(System.Windows.Input.InputBindingCollection);
}
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Application.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Application.cs
index 4bce84a4..b264b583 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Application.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Application.cs
@@ -174,8 +174,7 @@ public static System.Windows.Application Current
{
get
{
- Contract.Ensures(Contract.Result() != null);
-
+ // May return null if called from non-WPF application (e.g. WinForms app with embedded WPF controls).
return default(System.Windows.Application);
}
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Control.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Control.cs
index ca793553..b9e1c76a 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Control.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Control.cs
@@ -57,10 +57,12 @@ protected override System.Windows.Size MeasureOverride(System.Windows.Size const
protected virtual new void OnMouseDoubleClick(System.Windows.Input.MouseButtonEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnPreviewMouseDoubleClick(System.Windows.Input.MouseButtonEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Panel.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Panel.cs
index abe56b1d..b9980394 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Panel.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.Panel.cs
@@ -43,6 +43,7 @@ abstract public partial class Panel : System.Windows.FrameworkElement, System.Wi
#region Methods and constructors
protected virtual new UIElementCollection CreateUIElementCollection(System.Windows.FrameworkElement logicalParent)
{
+ Contract.Ensures(Contract.Result() != null);
return default(UIElementCollection);
}
@@ -106,10 +107,21 @@ public UIElementCollection Children
{
get
{
+ Contract.Ensures(Contract.Result() != null);
return default(UIElementCollection);
}
}
+ protected internal UIElementCollection InternalChildren
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result() != null);
+ return default(UIElementCollection);
+ }
+ }
+
+
internal protected virtual new bool HasLogicalOrientation
{
get
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TextBox.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TextBox.cs
index 0b10e506..8495b588 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TextBox.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TextBox.cs
@@ -282,6 +282,8 @@ public string Text
{
get
{
+ // => TextBox.CoerceText will ensure value is never null.
+ Contract.Ensures(Contract.Result() != null);
return default(string);
}
set
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.ToolTip.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.ToolTip.cs
index 01286d29..8feb7193 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.ToolTip.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.ToolTip.cs
@@ -43,6 +43,7 @@ public partial class ToolTip : ContentControl
#region Methods and constructors
protected virtual new void OnClosed(System.Windows.RoutedEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer()
@@ -52,6 +53,7 @@ protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutoma
protected virtual new void OnOpened(System.Windows.RoutedEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnVisualParentChanged(System.Windows.DependencyObject oldParent)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TreeViewItem.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TreeViewItem.cs
index c4acfd19..e36dfaf6 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TreeViewItem.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.TreeViewItem.cs
@@ -52,19 +52,23 @@ protected override System.Windows.DependencyObject GetContainerForItemOverride()
protected virtual new void OnCollapsed(System.Windows.RoutedEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnExpanded(System.Windows.RoutedEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnSelected(System.Windows.RoutedEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnUnselected(System.Windows.RoutedEventArgs e)
{
+ Contract.Requires(e != null);
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingPanel.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingPanel.cs
index d52ada7e..c26b6cf6 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingPanel.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingPanel.cs
@@ -59,6 +59,7 @@ protected void InsertInternalChild(int index, System.Windows.UIElement child)
protected virtual new void OnItemsChanged(Object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs args)
{
+ Contract.Requires(args != null);
}
protected void RemoveInternalChildRange(int index, int range)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingStackPanel.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingStackPanel.cs
index 60fedb00..5132e296 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingStackPanel.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Controls.VirtualizingStackPanel.cs
@@ -1,295 +1,296 @@
-// CodeContracts
-//
-// Copyright (c) Microsoft Corporation
-//
-// All rights reserved.
-//
-// MIT License
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// File System.Windows.Controls.VirtualizingStackPanel.cs
-// Automatically generated contract file.
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Diagnostics.Contracts;
-using System;
-
-// Disable the "this variable is not used" warning as every field would imply it.
-#pragma warning disable 0414
-// Disable the "this variable is never assigned to".
-#pragma warning disable 0067
-// Disable the "this event is never assigned to".
-#pragma warning disable 0649
-// Disable the "this variable is never used".
-#pragma warning disable 0169
-// Disable the "new keyword not required" warning.
-#pragma warning disable 0109
-// Disable the "extern without DllImport" warning.
-#pragma warning disable 0626
-// Disable the "could hide other member" warning, can happen on certain properties.
-#pragma warning disable 0108
-
-
-namespace System.Windows.Controls
-{
- public partial class VirtualizingStackPanel : VirtualizingPanel, System.Windows.Controls.Primitives.IScrollInfo
-#if NETFRAMEWORK_4_5
- , IStackMeasure
-#endif
-
- {
- #region Methods and constructors
- public static void AddCleanUpVirtualizedItemHandler(System.Windows.DependencyObject element, CleanUpVirtualizedItemEventHandler handler)
- {
- }
-
- protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize)
- {
- return default(System.Windows.Size);
- }
-
- protected internal override void BringIndexIntoView(int index)
- {
- }
-
-#if !NETFRAMEWORK_4_5
- public static bool GetIsVirtualizing(System.Windows.DependencyObject o)
- {
- return default(bool);
- }
-
- public static VirtualizationMode GetVirtualizationMode(System.Windows.DependencyObject element)
- {
- return default(VirtualizationMode);
- }
-
- public static void SetIsVirtualizing(System.Windows.DependencyObject element, bool value)
- {
- }
-
- public static void SetVirtualizationMode(System.Windows.DependencyObject element, VirtualizationMode value)
- {
- }
-
-
-#endif
-
- public virtual new void LineDown()
- {
- }
-
- public virtual new void LineLeft()
- {
- }
-
- public virtual new void LineRight()
- {
- }
-
- public virtual new void LineUp()
- {
- }
-
- public System.Windows.Rect MakeVisible(System.Windows.Media.Visual visual, System.Windows.Rect rectangle)
- {
- return default(System.Windows.Rect);
- }
-
- protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint)
- {
- return default(System.Windows.Size);
- }
-
- public virtual new void MouseWheelDown()
- {
- }
-
- public virtual new void MouseWheelLeft()
- {
- }
-
- public virtual new void MouseWheelRight()
- {
- }
-
- public virtual new void MouseWheelUp()
- {
- }
-
- protected virtual new void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)
- {
- }
-
- protected override void OnClearChildren()
- {
- }
-
- protected override void OnItemsChanged(Object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs args)
- {
- }
-
- protected virtual new void OnViewportOffsetChanged(System.Windows.Vector oldViewportOffset, System.Windows.Vector newViewportOffset)
- {
- }
-
- protected virtual new void OnViewportSizeChanged(System.Windows.Size oldViewportSize, System.Windows.Size newViewportSize)
- {
- }
-
- public virtual new void PageDown()
- {
- }
-
- public virtual new void PageLeft()
- {
- }
-
- public virtual new void PageRight()
- {
- }
-
- public virtual new void PageUp()
- {
- }
-
- public static void RemoveCleanUpVirtualizedItemHandler(System.Windows.DependencyObject element, CleanUpVirtualizedItemEventHandler handler)
- {
- }
-
- public void SetHorizontalOffset(double offset)
- {
- }
-
- public void SetVerticalOffset(double offset)
- {
- }
-
- public VirtualizingStackPanel()
- {
- }
- #endregion
-
- #region Properties and indexers
- public bool CanHorizontallyScroll
- {
- get
- {
- return default(bool);
- }
- set
- {
- }
- }
-
- public bool CanVerticallyScroll
- {
- get
- {
- return default(bool);
- }
- set
- {
- }
- }
-
- public double ExtentHeight
- {
- get
- {
- return default(double);
- }
- }
-
- public double ExtentWidth
- {
- get
- {
- return default(double);
- }
- }
-
- internal protected override bool HasLogicalOrientation
- {
- get
- {
- return default(bool);
- }
- }
-
- public double HorizontalOffset
- {
- get
- {
- return default(double);
- }
- }
-
- internal protected override System.Windows.Controls.Orientation LogicalOrientation
- {
- get
- {
- return default(System.Windows.Controls.Orientation);
- }
- }
-
- public Orientation Orientation
- {
- get
- {
- return default(Orientation);
- }
- set
- {
- }
- }
-
- public ScrollViewer ScrollOwner
- {
- get
- {
- return default(ScrollViewer);
- }
- set
- {
- }
- }
-
- public double VerticalOffset
- {
- get
- {
- return default(double);
- }
- }
-
- public double ViewportHeight
- {
- get
- {
- return default(double);
- }
- }
-
- public double ViewportWidth
- {
- get
- {
- return default(double);
- }
- }
- #endregion
-
- #region Fields
- public readonly static System.Windows.RoutedEvent CleanUpVirtualizedItemEvent;
- public readonly static System.Windows.DependencyProperty IsVirtualizingProperty;
- public readonly static System.Windows.DependencyProperty OrientationProperty;
- public readonly static System.Windows.DependencyProperty VirtualizationModeProperty;
- #endregion
- }
-}
+// CodeContracts
+//
+// Copyright (c) Microsoft Corporation
+//
+// All rights reserved.
+//
+// MIT License
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// File System.Windows.Controls.VirtualizingStackPanel.cs
+// Automatically generated contract file.
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Diagnostics.Contracts;
+using System;
+
+// Disable the "this variable is not used" warning as every field would imply it.
+#pragma warning disable 0414
+// Disable the "this variable is never assigned to".
+#pragma warning disable 0067
+// Disable the "this event is never assigned to".
+#pragma warning disable 0649
+// Disable the "this variable is never used".
+#pragma warning disable 0169
+// Disable the "new keyword not required" warning.
+#pragma warning disable 0109
+// Disable the "extern without DllImport" warning.
+#pragma warning disable 0626
+// Disable the "could hide other member" warning, can happen on certain properties.
+#pragma warning disable 0108
+
+
+namespace System.Windows.Controls
+{
+ public partial class VirtualizingStackPanel : VirtualizingPanel, System.Windows.Controls.Primitives.IScrollInfo
+#if NETFRAMEWORK_4_5
+ , IStackMeasure
+#endif
+
+ {
+ #region Methods and constructors
+ public static void AddCleanUpVirtualizedItemHandler(System.Windows.DependencyObject element, CleanUpVirtualizedItemEventHandler handler)
+ {
+ }
+
+ protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize)
+ {
+ return default(System.Windows.Size);
+ }
+
+ protected internal override void BringIndexIntoView(int index)
+ {
+ }
+
+#if !NETFRAMEWORK_4_5
+ public static bool GetIsVirtualizing(System.Windows.DependencyObject o)
+ {
+ return default(bool);
+ }
+
+ public static VirtualizationMode GetVirtualizationMode(System.Windows.DependencyObject element)
+ {
+ return default(VirtualizationMode);
+ }
+
+ public static void SetIsVirtualizing(System.Windows.DependencyObject element, bool value)
+ {
+ }
+
+ public static void SetVirtualizationMode(System.Windows.DependencyObject element, VirtualizationMode value)
+ {
+ }
+
+
+#endif
+
+ public virtual new void LineDown()
+ {
+ }
+
+ public virtual new void LineLeft()
+ {
+ }
+
+ public virtual new void LineRight()
+ {
+ }
+
+ public virtual new void LineUp()
+ {
+ }
+
+ public System.Windows.Rect MakeVisible(System.Windows.Media.Visual visual, System.Windows.Rect rectangle)
+ {
+ return default(System.Windows.Rect);
+ }
+
+ protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint)
+ {
+ return default(System.Windows.Size);
+ }
+
+ public virtual new void MouseWheelDown()
+ {
+ }
+
+ public virtual new void MouseWheelLeft()
+ {
+ }
+
+ public virtual new void MouseWheelRight()
+ {
+ }
+
+ public virtual new void MouseWheelUp()
+ {
+ }
+
+ protected virtual new void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)
+ {
+ Contract.Requires(e != null);
+ }
+
+ protected override void OnClearChildren()
+ {
+ }
+
+ protected override void OnItemsChanged(Object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs args)
+ {
+ }
+
+ protected virtual new void OnViewportOffsetChanged(System.Windows.Vector oldViewportOffset, System.Windows.Vector newViewportOffset)
+ {
+ }
+
+ protected virtual new void OnViewportSizeChanged(System.Windows.Size oldViewportSize, System.Windows.Size newViewportSize)
+ {
+ }
+
+ public virtual new void PageDown()
+ {
+ }
+
+ public virtual new void PageLeft()
+ {
+ }
+
+ public virtual new void PageRight()
+ {
+ }
+
+ public virtual new void PageUp()
+ {
+ }
+
+ public static void RemoveCleanUpVirtualizedItemHandler(System.Windows.DependencyObject element, CleanUpVirtualizedItemEventHandler handler)
+ {
+ }
+
+ public void SetHorizontalOffset(double offset)
+ {
+ }
+
+ public void SetVerticalOffset(double offset)
+ {
+ }
+
+ public VirtualizingStackPanel()
+ {
+ }
+ #endregion
+
+ #region Properties and indexers
+ public bool CanHorizontallyScroll
+ {
+ get
+ {
+ return default(bool);
+ }
+ set
+ {
+ }
+ }
+
+ public bool CanVerticallyScroll
+ {
+ get
+ {
+ return default(bool);
+ }
+ set
+ {
+ }
+ }
+
+ public double ExtentHeight
+ {
+ get
+ {
+ return default(double);
+ }
+ }
+
+ public double ExtentWidth
+ {
+ get
+ {
+ return default(double);
+ }
+ }
+
+ internal protected override bool HasLogicalOrientation
+ {
+ get
+ {
+ return default(bool);
+ }
+ }
+
+ public double HorizontalOffset
+ {
+ get
+ {
+ return default(double);
+ }
+ }
+
+ internal protected override System.Windows.Controls.Orientation LogicalOrientation
+ {
+ get
+ {
+ return default(System.Windows.Controls.Orientation);
+ }
+ }
+
+ public Orientation Orientation
+ {
+ get
+ {
+ return default(Orientation);
+ }
+ set
+ {
+ }
+ }
+
+ public ScrollViewer ScrollOwner
+ {
+ get
+ {
+ return default(ScrollViewer);
+ }
+ set
+ {
+ }
+ }
+
+ public double VerticalOffset
+ {
+ get
+ {
+ return default(double);
+ }
+ }
+
+ public double ViewportHeight
+ {
+ get
+ {
+ return default(double);
+ }
+ }
+
+ public double ViewportWidth
+ {
+ get
+ {
+ return default(double);
+ }
+ }
+ #endregion
+
+ #region Fields
+ public readonly static System.Windows.RoutedEvent CleanUpVirtualizedItemEvent;
+ public readonly static System.Windows.DependencyProperty IsVirtualizingProperty;
+ public readonly static System.Windows.DependencyProperty OrientationProperty;
+ public readonly static System.Windows.DependencyProperty VirtualizationModeProperty;
+ #endregion
+ }
+}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionContainer.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionContainer.cs
index 42833ef2..e4665dad 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionContainer.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionContainer.cs
@@ -47,10 +47,12 @@ public CollectionContainer()
protected virtual new void OnContainedCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs args)
{
+ Contract.Requires(args != null);
}
protected virtual new bool ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
{
+ Contract.Requires(e != null);
return default(bool);
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionView.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionView.cs
index 699d7df6..317fa23a 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionView.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionView.cs
@@ -112,10 +112,12 @@ protected bool OKToChangeCurrent()
protected virtual new void OnBeginChangeLogging(System.Collections.Specialized.NotifyCollectionChangedEventArgs args)
{
+ Contract.Requires(args != null);
}
protected virtual new void OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs args)
{
+ Contract.Requires(args != null);
}
protected void OnCollectionChanged(Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args)
@@ -128,6 +130,7 @@ protected void OnCollectionChanged(Object sender, System.Collections.Specialized
protected virtual new void OnCurrentChanging(System.ComponentModel.CurrentChangingEventArgs args)
{
+ Contract.Requires(args != null);
}
protected void OnCurrentChanging()
@@ -136,6 +139,7 @@ protected void OnCurrentChanging()
protected virtual new void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
{
+ Contract.Requires(e != null);
}
public virtual new bool PassesFilter(Object item)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewGroup.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewGroup.cs
index e4e7bed1..f8cd4d69 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewGroup.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewGroup.cs
@@ -47,6 +47,7 @@ protected CollectionViewGroup(Object name)
protected virtual new void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
{
+ Contract.Requires(e != null);
}
#endregion
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewSource.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewSource.cs
index 121098a6..878a5676 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewSource.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CollectionViewSource.cs
@@ -15,6 +15,8 @@
// File System.Windows.Data.CollectionViewSource.cs
// Automatically generated contract file.
using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
@@ -72,6 +74,7 @@ public static bool IsDefaultView(System.ComponentModel.ICollectionView view)
protected virtual new bool ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
{
+ Contract.Requires(e != null);
return default(bool);
}
@@ -116,6 +119,7 @@ public System.Collections.ObjectModel.ObservableCollection>() != null);
return default(System.Collections.ObjectModel.ObservableCollection);
}
}
@@ -124,6 +128,7 @@ public System.ComponentModel.SortDescriptionCollection SortDescriptions
{
get
{
+ Contract.Ensures(Contract.Result() != null);
return default(System.ComponentModel.SortDescriptionCollection);
}
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CompositeCollection.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CompositeCollection.cs
index c9ffc002..fad36c43 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CompositeCollection.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Data.CompositeCollection.cs
@@ -79,6 +79,7 @@ public void Insert(int insertIndex, Object insertItem)
protected virtual new bool ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
{
+ Contract.Requires(e != null);
return default(bool);
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkContentElement.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkContentElement.cs
index 4accd98c..6daa8ae8 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkContentElement.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkContentElement.cs
@@ -102,10 +102,12 @@ public sealed override bool MoveFocus(System.Windows.Input.TraversalRequest requ
protected virtual new void OnContextMenuClosing(System.Windows.Controls.ContextMenuEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnContextMenuOpening(System.Windows.Controls.ContextMenuEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnGotFocus(RoutedEventArgs e)
@@ -114,6 +116,7 @@ protected override void OnGotFocus(RoutedEventArgs e)
protected virtual new void OnInitialized(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
@@ -126,10 +129,12 @@ protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
protected virtual new void OnToolTipClosing(System.Windows.Controls.ToolTipEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnToolTipOpening(System.Windows.Controls.ToolTipEventArgs e)
{
+ Contract.Requires(e != null);
}
public sealed override DependencyObject PredictFocus(System.Windows.Input.FocusNavigationDirection direction)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkElement.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkElement.cs
index 30bbb272..10c4b0ee 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkElement.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.FrameworkElement.cs
@@ -54,8 +54,32 @@ protected sealed override void ArrangeCore(Rect finalRect)
{
}
- protected virtual new Size ArrangeOverride(Size finalSize)
- {
+ ///
+ /// ArrangeOverride allows for the customization of the positioning of children.
+ ///
+ /// The final size that element should use to arrange itself and its children.
+ /// The size that element actually is going to use for rendering. If this size is not the same as finalSize
+ /// input parameter, the AlignmentX/AlignmentY properties will position the ink rect of the element
+ /// appropriately.
+ protected virtual Size ArrangeOverride(Size finalSize)
+ {
+ // Only a positive number is allowed here for width and height, since this will be used as the size of a physical Rect.
+ // See also comments or implementation of UIElement.Arrange()
+ Contract.Requires(!finalSize.IsEmpty
+ && !double.IsNaN(finalSize.Width) && !double.IsNaN(finalSize.Height)
+ && !double.IsPositiveInfinity(finalSize.Width) && !double.IsPositiveInfinity(finalSize.Height));
+
+ /* The function must return a physical size, i.e. positive numbers for Width and Height, so this would be the correct result contract:
+ *
+ * Contract.Ensures(!Contract.Result().IsEmpty
+ * && !double.IsNaN(Contract.Result().Width) && !double.IsNaN(Contract.Result().Height)
+ * && !double.IsInfinity(Contract.Result().Width) && !double.IsInfinity(Contract.Result().Height));
+ *
+ * However in practice this is unusable; the analyzer can't infer all double operations in the method,
+ * because there are usually complex calculations, and we would end up with always the same huge Contract.Assume at the end, just
+ * to make the analyzer happy.
+ */
+
return default(Size);
}
@@ -138,8 +162,29 @@ protected sealed override Size MeasureCore(Size availableSize)
return default(Size);
}
- protected virtual new Size MeasureOverride(Size availableSize)
- {
+ ///
+ /// Measurement override. Implement your size-to-content logic here.
+ ///
+ /// Available size that parent can give to the child. May be infinity (when parent wants to
+ /// measure to content). This is soft constraint. Child can return bigger size to indicate that it wants bigger space and hope
+ /// that parent can throw in scrolling...
+ /// Desired Size of the control, given available size passed as parameter.
+ protected virtual Size MeasureOverride(Size availableSize)
+ {
+ // Only positive number or positive infinity is allowed here for width and height, see also comments on UIElement.Measure.
+ Contract.Requires(!availableSize.IsEmpty && !double.IsNaN(availableSize.Width) && !double.IsNaN(availableSize.Height));
+
+ /* The function must return a physical size, i.e. positive numbers for Width and Height, so this would be the correct result contract:
+ *
+ * Contract.Ensures(!Contract.Result().IsEmpty
+ * && !double.IsNaN(Contract.Result().Width) && !double.IsNaN(Contract.Result().Height)
+ * && !double.IsInfinity(Contract.Result().Width) && !double.IsInfinity(Contract.Result().Height));
+ *
+ * However in practice this is unusable; the analyzer can't infer all double operations in the method,
+ * because there are usually complex calculations, and we would end up with always the same huge Contract.Assume at the end, just
+ * to make the analyzer happy.
+ */
+
return default(Size);
}
@@ -154,10 +199,12 @@ public sealed override bool MoveFocus(System.Windows.Input.TraversalRequest requ
protected virtual new void OnContextMenuClosing(System.Windows.Controls.ContextMenuEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnContextMenuOpening(System.Windows.Controls.ContextMenuEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnGotFocus(RoutedEventArgs e)
@@ -166,6 +213,7 @@ protected override void OnGotFocus(RoutedEventArgs e)
protected virtual new void OnInitialized(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
@@ -182,10 +230,12 @@ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
protected virtual new void OnToolTipClosing(System.Windows.Controls.ToolTipEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnToolTipOpening(System.Windows.Controls.ToolTipEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnVisualParentChanged(DependencyObject oldParent)
@@ -264,7 +314,7 @@ public double ActualHeight
{
get
{
- Contract.Ensures(Contract.Result() == this.RenderSize.Height);
+ Contract.Ensures(Contract.Result() >= 0.0);
return default(double);
}
@@ -274,7 +324,7 @@ public double ActualWidth
{
get
{
- Contract.Ensures(Contract.Result() == this.RenderSize.Width);
+ Contract.Ensures(Contract.Result() >= 0.0);
return default(double);
}
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Interop.HwndHost.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Interop.HwndHost.cs
index 91a4cd93..3ba66c2d 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Interop.HwndHost.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Interop.HwndHost.cs
@@ -74,10 +74,12 @@ protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutoma
protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnKeyUp(System.Windows.Input.KeyEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new bool OnMnemonicCore(ref MSG msg, System.Windows.Input.ModifierKeys modifiers)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Markup.Localizer.BamlLocalizer.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Markup.Localizer.BamlLocalizer.cs
index 24283fd4..8d85fc4f 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Markup.Localizer.BamlLocalizer.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Markup.Localizer.BamlLocalizer.cs
@@ -62,6 +62,7 @@ public BamlLocalizationDictionary ExtractResources()
protected virtual new void OnErrorNotify(BamlLocalizerErrorNotifyEventArgs e)
{
+ Contract.Requires(e != null);
}
public void UpdateBaml(Stream target, BamlLocalizationDictionary updates)
diff --git a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Window.cs b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Window.cs
index 372a9506..6bc57217 100644
--- a/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Window.cs
+++ b/Microsoft.Research/Contracts/PresentationFramework/Sources/System.Windows.Window.cs
@@ -75,14 +75,17 @@ protected override Size MeasureOverride(Size availableSize)
protected virtual new void OnActivated(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnClosed(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnClosing(System.ComponentModel.CancelEventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnContentChanged(Object oldContent, Object newContent)
@@ -91,6 +94,7 @@ protected override void OnContentChanged(Object oldContent, Object newContent)
protected virtual new void OnContentRendered(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer()
@@ -100,10 +104,12 @@ protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutoma
protected virtual new void OnDeactivated(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnLocationChanged(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected override void OnManipulationBoundaryFeedback(System.Windows.Input.ManipulationBoundaryFeedbackEventArgs e)
@@ -112,10 +118,12 @@ protected override void OnManipulationBoundaryFeedback(System.Windows.Input.Mani
protected virtual new void OnSourceInitialized(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnStateChanged(EventArgs e)
{
+ Contract.Requires(e != null);
}
protected sealed override void OnVisualParentChanged(DependencyObject oldParent)
diff --git a/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.AggregateCatalog.cs b/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.AggregateCatalog.cs
index 8c59ce57..d205f499 100644
--- a/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.AggregateCatalog.cs
+++ b/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.AggregateCatalog.cs
@@ -64,10 +64,12 @@ protected override void Dispose(bool disposing)
protected virtual new void OnChanged(ComposablePartCatalogChangeEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnChanging(ComposablePartCatalogChangeEventArgs e)
{
+ Contract.Requires(e != null);
}
#endregion
diff --git a/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.DirectoryCatalog.cs b/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.DirectoryCatalog.cs
index 82a35292..7dbb4d0e 100644
--- a/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.DirectoryCatalog.cs
+++ b/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.DirectoryCatalog.cs
@@ -63,10 +63,12 @@ protected override void Dispose(bool disposing)
protected virtual new void OnChanged(ComposablePartCatalogChangeEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnChanging(ComposablePartCatalogChangeEventArgs e)
{
+ Contract.Requires(e != null);
}
public void Refresh()
diff --git a/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.ExportProvider.cs b/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.ExportProvider.cs
index 519b9c60..0b6fe58a 100644
--- a/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.ExportProvider.cs
+++ b/Microsoft.Research/Contracts/System.ComponentModel.Composition/Sources/System.ComponentModel.Composition.Hosting.ExportProvider.cs
@@ -67,12 +67,16 @@ public Lazy GetExport(string contractName)
public T GetExportedValue(string contractName)
{
+ Contract.Ensures(Contract.Result() != null);
+ // because of ImportCardinality.ExactlyOne =>
+ // return this.GetExportedValueCore(contractName, ImportCardinality.ExactlyOne);
return default(T);
}
public T GetExportedValue()
{
- return default(T);
+ Contract.Ensures(Contract.Result() != null);
+ return this.GetExportedValue((string)null);
}
public T GetExportedValueOrDefault()
@@ -148,10 +152,12 @@ public IEnumerable> GetExports(Type type, Type metadataView
protected virtual new void OnExportsChanged(ExportsChangeEventArgs e)
{
+ Contract.Requires(e != null);
}
protected virtual new void OnExportsChanging(ExportsChangeEventArgs e)
{
+ Contract.Requires(e != null);
}
public bool TryGetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition, AtomicComposition atomicComposition, out IEnumerable exports)
diff --git a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Enumerable.cs b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Enumerable.cs
index b5b42415..4746ea3c 100644
--- a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Enumerable.cs
+++ b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Enumerable.cs
@@ -252,6 +252,7 @@ public static IEnumerable DefaultIfEmpty(this IEnumerable>() != null);
+ Contract.Ensures(Contract.Result>().Any());
return default(IEnumerable);
}
@@ -279,6 +280,7 @@ public static IEnumerable DefaultIfEmpty(this IEnumerable>() != null);
+ Contract.Ensures(Contract.Result>().Any());
return default(IEnumerable);
}
//
diff --git a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Expressions.Expression.cs b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Expressions.Expression.cs
index 18469db0..0b1ea971 100644
--- a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Expressions.Expression.cs
+++ b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Expressions.Expression.cs
@@ -5566,8 +5566,14 @@ public sealed class Expression
{
private Expression() { }
- // public TDelegate Compile();
- }
+#if !SILVERLIGHT
+ public TDelegate Compile()
+ {
+ Contract.Ensures(!ReferenceEquals(Contract.Result(), null));
+ return default(TDelegate);
+ }
+#endif
+ }
}
diff --git a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.ParallelEnumerable.cs b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.ParallelEnumerable.cs
index 01d0da88..e7b53a25 100644
--- a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.ParallelEnumerable.cs
+++ b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.ParallelEnumerable.cs
@@ -406,6 +406,7 @@ public static ParallelQuery DefaultIfEmpty(ParallelQuery>() != null);
+ Contract.Ensures(Contract.Result>().Any());
return default(ParallelQuery);
}
@@ -415,6 +416,7 @@ public static ParallelQuery DefaultIfEmpty(ParallelQuery>() != null);
+ Contract.Ensures(Contract.Result>().Any());
return default(ParallelQuery);
}
diff --git a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Queryable.cs b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Queryable.cs
index c59cd7fc..14484f40 100644
--- a/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Queryable.cs
+++ b/Microsoft.Research/Contracts/System.Core.Contracts/System.Linq.Queryable.cs
@@ -926,6 +926,7 @@ public static IQueryable DefaultIfEmpty(this IQueryable>() != null);
+ Contract.Ensures(Contract.Result>().Any());
return default(IQueryable);
}
//
@@ -956,6 +957,7 @@ public static IQueryable DefaultIfEmpty(this IQueryable>() != null);
+ Contract.Ensures(Contract.Result>().Any());
return default(IQueryable);
}
//
diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbConnectionStringBuilder.cs b/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbConnectionStringBuilder.cs
index 8c3700ce..88d35948 100644
--- a/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbConnectionStringBuilder.cs
+++ b/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbConnectionStringBuilder.cs
@@ -45,7 +45,14 @@ public string ConnectionString {
extern public virtual bool IsFixedSize { get; }
extern public virtual bool IsReadOnly { get; }
- // Exceptions:
+
+ // Property Value
+ // The value associated with the specified key. If the specified key is not found,
+ // trying to get it returns a null reference (Nothing in Visual Basic), and trying to set it creates a new element using the specified key.
+ // Passing a null (Nothing in Visual Basic) key throws an ArgumentNullException.
+ // Assigning a null value removes the key/value pair.
+ //
+ // Exceptions:
// System.ArgumentNullException:
// keyword is a null reference (Nothing in Visual Basic).
//
@@ -57,13 +64,11 @@ public virtual object this[string keyword]
{
get
{
- Contract.Ensures(Contract.Result