Skip to content

Commit 4bf6dfa

Browse files
committed
Removes all traces of MS Code Contracts.
1 parent 8f48e3f commit 4bf6dfa

File tree

126 files changed

+43
-3445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+43
-3445
lines changed

samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>
87
</PropertyGroup>
98
<Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" />
109
<PropertyGroup>
@@ -50,36 +49,6 @@
5049
<DefineConstants>DEBUG;TRACE</DefineConstants>
5150
<ErrorReport>prompt</ErrorReport>
5251
<WarningLevel>4</WarningLevel>
53-
<CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
54-
<CodeContractsCustomRewriterAssembly>
55-
</CodeContractsCustomRewriterAssembly>
56-
<CodeContractsCustomRewriterClass>
57-
</CodeContractsCustomRewriterClass>
58-
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
59-
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
60-
<CodeContractsBuildReferenceAssembly>False</CodeContractsBuildReferenceAssembly>
61-
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
62-
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
63-
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
64-
<CodeContractsLibPaths>
65-
</CodeContractsLibPaths>
66-
<CodeContractsPlatformPath>
67-
</CodeContractsPlatformPath>
68-
<CodeContractsExtraAnalysisOptions>
69-
</CodeContractsExtraAnalysisOptions>
70-
<CodeContractsBaseLineFile>
71-
</CodeContractsBaseLineFile>
72-
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
73-
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
74-
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
75-
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
76-
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
77-
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
78-
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
79-
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
80-
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
81-
<CodeContractsExtraRewriteOptions />
82-
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
8352
</PropertyGroup>
8453
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
8554
<DebugType>pdbonly</DebugType>

src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<IsWebBootstrapper>false</IsWebBootstrapper>
2929
<UseApplicationTrust>false</UseApplicationTrust>
3030
<BootstrapperEnabled>true</BootstrapperEnabled>
31-
<CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>
3231
<TargetFrameworkProfile />
3332
</PropertyGroup>
3433
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -39,35 +38,7 @@
3938
<DefineConstants>DEBUG;TRACE</DefineConstants>
4039
<ErrorReport>prompt</ErrorReport>
4140
<WarningLevel>4</WarningLevel>
42-
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
43-
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
44-
<CodeContractsRuntimeThrowOnFailure>False</CodeContractsRuntimeThrowOnFailure>
45-
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
46-
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
47-
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
48-
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
49-
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
50-
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
51-
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
52-
<CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
53-
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
54-
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
55-
<CodeContractsCustomRewriterAssembly>
56-
</CodeContractsCustomRewriterAssembly>
57-
<CodeContractsCustomRewriterClass>
58-
</CodeContractsCustomRewriterClass>
59-
<CodeContractsLibPaths>
60-
</CodeContractsLibPaths>
61-
<CodeContractsPlatformPath>
62-
</CodeContractsPlatformPath>
63-
<CodeContractsExtraAnalysisOptions>
64-
</CodeContractsExtraAnalysisOptions>
65-
<CodeContractsBaseLineFile>
66-
</CodeContractsBaseLineFile>
67-
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
68-
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
6941
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
70-
<CodeContractsExtraRewriteOptions />
7142
</PropertyGroup>
7243
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
7344
<DebugType>pdbonly</DebugType>

src/DotNetOpenAuth.Core/Configuration/HostNameOrRegexCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected override ConfigurationElement CreateNewElement() {
6363
/// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
6464
/// </returns>
6565
protected override object GetElementKey(ConfigurationElement element) {
66-
Contract.Assume(element != null); // this should be Contract.Requires in base class.
66+
Requires.NotNull(element, "element");
6767
return ((HostNameElement)element).Name ?? string.Empty;
6868
}
6969
}

src/DotNetOpenAuth.Core/Configuration/TypeConfigurationCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected override ConfigurationElement CreateNewElement() {
6868
/// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
6969
/// </returns>
7070
protected override object GetElementKey(ConfigurationElement element) {
71-
Contract.Assume(element != null); // this should be Contract.Requires in base class.
71+
Requires.NotNull(element, "element");
7272
TypeConfigurationElement<T> typedElement = (TypeConfigurationElement<T>)element;
7373
return (!string.IsNullOrEmpty(typedElement.TypeName) ? typedElement.TypeName : typedElement.XamlSource) ?? string.Empty;
7474
}

src/DotNetOpenAuth.Core/Messaging/Bindings/AsymmetricCryptoKeyStoreWrapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ private class CachedCryptoKey : CryptoKey {
138138
/// <param name="decrypted">The decrypted key.</param>
139139
internal CachedCryptoKey(CryptoKey encrypted, CryptoKey decrypted)
140140
: base(decrypted.Key, decrypted.ExpiresUtc) {
141-
Contract.Requires(encrypted != null);
142-
Contract.Requires(decrypted != null);
143-
Contract.Requires(encrypted.ExpiresUtc == decrypted.ExpiresUtc);
141+
Requires.NotNull(encrypted, "encrypted");
142+
Requires.NotNull(decrypted, "decrypted");
143+
Requires.True(encrypted.ExpiresUtc == decrypted.ExpiresUtc);
144144

145145
this.EncryptedKey = encrypted.Key;
146146
}

src/DotNetOpenAuth.Core/Messaging/DataBag.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected DataBag()
4242
/// </summary>
4343
/// <param name="version">The DataBag version.</param>
4444
protected DataBag(Version version) {
45-
Contract.Requires(version != null);
45+
Requires.NotNull(version, "version");
4646
this.version = version;
4747
}
4848

src/DotNetOpenAuth.Core/Messaging/IStreamSerializingDataBag.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ namespace DotNetOpenAuth.Messaging {
1212
/// <summary>
1313
/// An interface implemented by <see cref="DataBag"/>-derived types that support binary serialization.
1414
/// </summary>
15-
[ContractClass(typeof(IStreamSerializingDataBaContract))]
1615
internal interface IStreamSerializingDataBag {
1716
/// <summary>
1817
/// Serializes the instance to the specified stream.
@@ -26,30 +25,4 @@ internal interface IStreamSerializingDataBag {
2625
/// <param name="stream">The stream.</param>
2726
void Deserialize(Stream stream);
2827
}
29-
30-
/// <summary>
31-
/// Code Contract for the <see cref="IStreamSerializingDataBag"/> interface.
32-
/// </summary>
33-
[ContractClassFor(typeof(IStreamSerializingDataBag))]
34-
internal abstract class IStreamSerializingDataBaContract : IStreamSerializingDataBag {
35-
/// <summary>
36-
/// Serializes the instance to the specified stream.
37-
/// </summary>
38-
/// <param name="stream">The stream.</param>
39-
void IStreamSerializingDataBag.Serialize(Stream stream) {
40-
Contract.Requires(stream != null);
41-
Contract.Requires(stream.CanWrite);
42-
throw new NotImplementedException();
43-
}
44-
45-
/// <summary>
46-
/// Initializes the fields on this instance from the specified stream.
47-
/// </summary>
48-
/// <param name="stream">The stream.</param>
49-
void IStreamSerializingDataBag.Deserialize(Stream stream) {
50-
Contract.Requires(stream != null);
51-
Contract.Requires(stream.CanRead);
52-
throw new NotImplementedException();
53-
}
54-
}
5528
}

src/DotNetOpenAuth.Core/Reporting.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ internal static ReportingElement Configuration {
170170
/// <param name="category">The category within the event. Null and empty strings are allowed, but considered the same.</param>
171171
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "PersistentCounter instances are stored in a table for later use.")]
172172
internal static void RecordEventOccurrence(string eventName, string category) {
173-
Contract.Requires(!string.IsNullOrEmpty(eventName));
173+
Requires.NotNullOrEmpty(eventName, "eventName");
174174

175175
// In release builds, just quietly return.
176176
if (string.IsNullOrEmpty(eventName)) {
@@ -196,7 +196,7 @@ internal static void RecordEventOccurrence(string eventName, string category) {
196196
/// <param name="eventNameByObjectType">The object whose type name is the event name to record.</param>
197197
/// <param name="category">The category within the event. Null and empty strings are allowed, but considered the same.</param>
198198
internal static void RecordEventOccurrence(object eventNameByObjectType, string category) {
199-
Contract.Requires(eventNameByObjectType != null);
199+
Requires.NotNull(eventNameByObjectType, "eventNameByObjectType");
200200

201201
// In release builds, just quietly return.
202202
if (eventNameByObjectType == null) {
@@ -213,7 +213,7 @@ internal static void RecordEventOccurrence(object eventNameByObjectType, string
213213
/// </summary>
214214
/// <param name="feature">The feature.</param>
215215
internal static void RecordFeatureUse(string feature) {
216-
Contract.Requires(!string.IsNullOrEmpty(feature));
216+
Requires.NotNullOrEmpty(feature, "feature");
217217

218218
// In release builds, just quietly return.
219219
if (string.IsNullOrEmpty(feature)) {
@@ -231,7 +231,7 @@ internal static void RecordFeatureUse(string feature) {
231231
/// </summary>
232232
/// <param name="value">The object whose type is the feature to set as used.</param>
233233
internal static void RecordFeatureUse(object value) {
234-
Contract.Requires(value != null);
234+
Requires.NotNull(value, "value");
235235

236236
// In release builds, just quietly return.
237237
if (value == null) {
@@ -250,7 +250,7 @@ internal static void RecordFeatureUse(object value) {
250250
/// <param name="value">The object whose type is the feature to set as used.</param>
251251
/// <param name="dependency1">Some dependency used by <paramref name="value"/>.</param>
252252
internal static void RecordFeatureAndDependencyUse(object value, object dependency1) {
253-
Contract.Requires(value != null);
253+
Requires.NotNull(value, "value");
254254

255255
// In release builds, just quietly return.
256256
if (value == null) {
@@ -274,7 +274,7 @@ internal static void RecordFeatureAndDependencyUse(object value, object dependen
274274
/// <param name="dependency1">Some dependency used by <paramref name="value"/>.</param>
275275
/// <param name="dependency2">Some dependency used by <paramref name="value"/>.</param>
276276
internal static void RecordFeatureAndDependencyUse(object value, object dependency1, object dependency2) {
277-
Contract.Requires(value != null);
277+
Requires.NotNull(value, "value");
278278

279279
// In release builds, just quietly return.
280280
if (value == null) {
@@ -298,7 +298,7 @@ internal static void RecordFeatureAndDependencyUse(object value, object dependen
298298
/// </summary>
299299
/// <param name="request">The request.</param>
300300
internal static void RecordRequestStatistics(HttpRequestBase request) {
301-
Contract.Requires(request != null);
301+
Requires.NotNull(request, "request");
302302

303303
// In release builds, just quietly return.
304304
if (request == null) {

src/DotNetOpenAuth.Core/Util.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ internal static object ToStringDeferred<K, V>(this IEnumerable<KeyValuePair<K, V
103103
return new DelayedToString<IEnumerable<KeyValuePair<K, V>>>(
104104
pairs,
105105
p => {
106-
////Contract.Requires(pairs != null); // CC: anonymous method can't handle it
107-
ErrorUtilities.VerifyArgumentNotNull(pairs, "pairs");
106+
Requires.NotNull(pairs, "pairs");
108107
var dictionary = pairs as IDictionary<K, V>;
109108
var messageDictionary = pairs as MessageDictionary;
110109
StringBuilder sb = new StringBuilder(dictionary != null ? dictionary.Count * 40 : 200);

src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ internal bool IsPrivateAssociation {
5858
/// </summary>
5959
/// <param name="stream">The stream.</param>
6060
public void Serialize(Stream stream) {
61+
Requires.NotNull(stream, "stream");
62+
Requires.True(stream.CanWrite, "stream");
63+
6164
var writer = new BinaryWriter(stream);
6265
writer.Write(this.IsPrivateAssociation);
6366
writer.WriteBuffer(this.Secret);
@@ -70,6 +73,9 @@ public void Serialize(Stream stream) {
7073
/// </summary>
7174
/// <param name="stream">The stream.</param>
7275
public void Deserialize(Stream stream) {
76+
Requires.NotNull(stream, "stream");
77+
Requires.True(stream.CanRead, "stream");
78+
7379
var reader = new BinaryReader(stream);
7480
this.IsPrivateAssociation = reader.ReadBoolean();
7581
this.Secret = reader.ReadBuffer(256);

0 commit comments

Comments
 (0)