367 references to Contract
dotnet-svcutil-lib (135)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\ActionItem.cs (1)
36
Contract
.Assert(callback != null, "Cannot schedule a null callback");
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TaskHelpers.cs (3)
136
Contract
.Assert(task != null, "IAsyncResult must be an instance of Task<TResult>");
145
Contract
.Assert(task != null, "IAsyncResult must be an instance of Task");
256
Contract
.Assert(state != null, "Async state should be of type TaskCompletionSource<bool>");
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (2)
26
Contract
.Assert(timeout >= TimeSpan.Zero, "timeout must be non-negative");
179
Contract
.Assert(!_deadlineSet, "TimeoutHelper deadline set twice.");
FrameworkFork\System.ServiceModel\System\IdentityModel\Selectors\X509CertificateValidator.cs (1)
69
Contract
.Assert(useMachineContext == false, "CoreCLR does not have ctor allowing useMachineContext = true");
FrameworkFork\System.ServiceModel\System\ServiceModel\ActionNotSupportedException.cs (1)
18
Contract
.Assert(messageVersion.Addressing != AddressingVersion.None);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedWriteStream.cs (39)
47
Contract
.Assert(stream != Null, "stream!=Null");
48
Contract
.Assert(bufferSize > 0, "bufferSize>0");
49
Contract
.Assert(stream.CanWrite);
64
Contract
.Requires(_stream != null);
76
Contract
.Assert(_buffer != null);
77
Contract
.Assert(_bufferSize > 0);
156
Contract
.Assert(_writePos == 0);
184
Contract
.Assert(_writePos == 0);
192
Contract
.Assert(_writePos == 0);
202
Contract
.Assert(_buffer != null && _bufferSize >= _writePos,
212
Contract
.Assert(_buffer != null && _bufferSize >= _writePos,
266
Contract
.Assert(array != null);
267
Contract
.Assert(offset >= 0);
268
Contract
.Assert(count >= 0);
269
Contract
.Assert(count <= array.Length - offset);
334
Contract
.Assert(_writePos < _bufferSize);
351
Contract
.Assert(count == 0);
355
Contract
.Assert(count >= 0);
356
Contract
.Assert(_writePos == _bufferSize);
357
Contract
.Assert(_buffer != null);
364
Contract
.Assert(count == 0);
365
Contract
.Assert(_writePos < _bufferSize);
373
Contract
.Assert(_buffer != null);
374
Contract
.Assert(totalUserBytes >= _bufferSize);
397
Contract
.Assert(buffer != null);
398
Contract
.Assert(offset >= 0);
399
Contract
.Assert(count >= 0);
400
Contract
.Assert(count <= buffer.Length - offset);
417
Contract
.Assert(_writePos < _bufferSize);
426
Contract
.Assert(count == 0);
477
Contract
.Assert(count == 0);
481
Contract
.Assert(count >= 0);
482
Contract
.Assert(_writePos == _bufferSize);
483
Contract
.Assert(_buffer != null);
490
Contract
.Assert(count == 0);
491
Contract
.Assert(_writePos < _bufferSize);
500
Contract
.Assert(_buffer != null);
501
Contract
.Assert(totalUserBytes >= _bufferSize);
539
Contract
.Assert(_writePos < _bufferSize);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ClientWebSocketTransportDuplexSessionChannel.cs (2)
32
Contract
.Assert(channelFactory != null, "connection factory must be set");
192
Contract
.Assert(_connectionFactory != null, "Invalid call: CreateWebSocketWithFactory.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CommunicationObject.cs (6)
760
Contract
.Requires(false, "OnCloseAsync needs to be implemented on derived classes");
766
Contract
.Requires(false, "OnOpenAsync needs to be implemented on derived classes");
776
Contract
.Assert(communicationObject != null);
782
Contract
.Assert(communicationObject != null);
788
Contract
.Assert(communicationObject != null);
794
Contract
.Assert(communicationObject != null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Connection.cs (6)
458
Contract
.Assert(stream != null, "StreamConnection: Stream cannot be null.");
459
Contract
.Assert(innerStream != null, "StreamConnection: Inner stream cannot be null.");
552
Contract
.Requires(callback != null, "Cannot call BeginWrite without a callback");
553
Contract
.Requires(_writeCallback == null, "BeginWrite cannot be called twice");
609
Contract
.Requires(_writeResult == null, "StreamConnection: OnWrite called twice.");
716
Contract
.Requires(_readResult == null, "StreamConnection: OnRead called twice.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionBufferPool.cs (3)
30
Contract
.Assert(bufferSize >= 0, "bufferSize must be non-negative");
31
Contract
.Assert(batchCount > 0, "batchCount must be positive");
32
Contract
.Assert(maxFreeCount >= 0, "maxFreeCount must be non-negative");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionOrientedTransportChannelFactory.cs (1)
279
Contract
.Assert(_connectionPool != null, "ConnectionPool should always be found");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionPool.cs (1)
134
Contract
.Assert(result != null, "EndpointPool must be non-null at this point");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (7)
377
Contract
.Assert(!_asyncWritePending, "Called BeginWrite twice.");
438
Contract
.Assert(false, "SocketConnection.EndWrite called with no write pending.");
454
Contract
.Assert(eventArgs != null, "Argument 'eventArgs' cannot be NULL.");
460
Contract
.Assert(eventArgs.BytesTransferred == _asyncWriteEventArgs.Count, "The socket SendAsync did not send all the bytes.");
564
Contract
.Assert(_socket != null);
694
Contract
.Assert(eventArgs != null, "Argument 'eventArgs' cannot be NULL.");
741
Contract
.Assert(false, "SocketConnection.EndRead called with no read pending.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (1)
107
Contract
.Assert(false, "Streamed output should never be called in this channel.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (2)
540
Contract
.Assert(authScheme.IsSingleton(), "authenticationScheme used in an Http(s)ChannelFactory must be a singleton value.");
1233
Contract
.Assert(requestUri != null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelHelpers.cs (1)
128
Contract
.Assert(exception.InnerException != null, "InnerException must be set to be able to convert");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpRequestMessageExtensionMethods.cs (6)
25
Contract
.Assert(httpRequestMessage != null, "The 'httpRequestMessage' parameter should not be null.");
26
Contract
.Assert(message != null, "The 'message' parameter should not be null.");
35
Contract
.Assert(httpHeaders != null, "httpHeaders should not be null.");
48
Contract
.Assert(messageProperties != null, "The 'messageProperties' parameter should not be null.");
49
Contract
.Assert(properties != null, "The 'properties' parameter should not be null.");
70
Contract
.Assert(httpRequestMessage != null, "The 'httpRequestMessage' parameter should never be null.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpRequestMessageProperty.cs (1)
266
Contract
.Assert(httpRequestMessage != null, "The 'httpRequestMessage' property should never be null.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageHelper.cs (4)
27
Contract
.Assert(httpResponseMessage != null);
28
Contract
.Assert(httpResponseMessage.RequestMessage != null);
29
Contract
.Assert(factory != null);
60
Contract
.Assert(exception == null, "ProcessHttpAddressing should not set an exception after parsing a response message.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageProperty.cs (1)
293
Contract
.Assert(httpResponseMessage != null, "The 'httpResponseMessage' property should never be null.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpTransportBindingElement.cs (2)
437
Contract
.Assert(context.BindingParameters != null);
473
Contract
.Assert(context.Binding != null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageContent.cs (2)
97
Contract
.Assert(actionParams.Length <= 1, "action MUST only appear as a content type parameter at most 1 time");
210
Contract
.Assert(bufferManager != null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MethodCall.cs (2)
15
Contract
.Assert(args != null);
21
Contract
.Assert(methodBase != null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\QueuedObjectPool.cs (3)
43
Contract
.Assert(batchAllocCount <= maxFreeCount, "batchAllocCount cannot be greater than maxFreeCount");
75
Contract
.Assert(!_isClosed, "Cannot take an item from closed QueuedObjectPool");
111
Contract
.Assert(_objectQueue.Count == 0, "The object queue must be empty for new allocations");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ServiceChannelProxy.cs (2)
174
Contract
.Assert(asyncResult != null, "'asyncResult' MUST NOT be NULL.");
216
Contract
.Assert(asyncResult != null, "'asyncResult' MUST NOT be NULL.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (2)
47
Contract
.Assert(connectionBufferPool != null, "Argument connectionBufferPool cannot be null");
262
Contract
.Assert(timeoutErrorString != null, "Argument timeoutErrorString must not be null.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SslStreamSecurityUpgradeProvider.cs (1)
398
Contract
.Assert(certificate != null, "certificate MUST NOT be null");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TextMessageEncoder.cs (3)
580
Contract
.Assert(xmlWriter != null, "xmlWriter MUST NOT be null");
722
Contract
.Assert(xmlReader != null, "xmlReader MUST NOT be null");
762
Contract
.Assert(writer != null, "writer MUST NOT be null");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TimeoutStream.cs (2)
51
Contract
.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable");
78
Contract
.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (5)
188
Contract
.Assert(callback != null, "callback should not be null.");
203
Contract
.Assert(_pendingWritingMessageException == null, "'pendingWritingMessageException' MUST be NULL at this point.");
986
Contract
.Assert(value >= -1, "ReadTimeout should not be negative.");
1001
Contract
.Assert(value >= -1, "WriteTimeout should not be negative.");
1019
Contract
.Assert(_messageSource != null, "messageSource should not be null in read case.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WindowsStreamSecurityUpgradeProvider.cs (1)
40
Contract
.Assert(isClient, ".NET Core and .NET Native does not support server side");
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\CustomAttributeProvider.cs (3)
73
Contract
.Assert(false, "This should never execute.");
92
Contract
.Assert(false, "This should never execute.");
109
Contract
.Assert(false, "This should never execute.");
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\TypeLoader.cs (5)
504
Contract
.Assert(type != null);
505
Contract
.Assert(methodInfo != null);
519
Contract
.Assert(method1 != null);
520
Contract
.Assert(method2 != null);
1332
Contract
.Assert(memberInfo is FieldInfo);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\PerSessionInstanceContextProvider.cs (1)
28
Contract
.Assert((serviceChannel != null), "System.ServiceModel.Dispatcher.PerSessionInstanceContextProvider.GetExistingInstanceContext(), serviceChannel != null");
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ProxyOperationRuntime.cs (6)
276
Contract
.Assert(methodCall != null);
277
Contract
.Assert(methodCall.MethodBase != null);
288
Contract
.Assert(methodCall != null);
289
Contract
.Assert(methodCall.MethodBase != null);
300
Contract
.Assert(methodCall != null);
301
Contract
.Assert(methodCall.MethodBase != null);
FrameworkFork\System.ServiceModel\System\ServiceModel\MessageHeaderException.cs (1)
57
Contract
.Assert(messageVersion.Addressing == AddressingVersion.WSAddressing10);
FrameworkFork\System.ServiceModel\System\ServiceModel\NetTcpSecurity.cs (1)
27
Contract
.Assert(SecurityModeHelper.IsDefined(mode),
FrameworkFork\System.ServiceModel\System\ServiceModel\ServiceModelStringsVersion1.cs (1)
507
Contract
.Assert(index >= 0 && index < this.Count, "check index");
FrameworkFork\System.ServiceModel\System\ServiceModel\TimeSpanHelper.cs (3)
15
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
21
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
27
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
Microsoft.AspNetCore.Http (21)
src\Http\Shared\CookieHeaderParserShared.cs (6)
110
Contract
.Requires(startIndex <= input.Length); // it's OK if index == value.Length.
142
Contract
.Requires(offset >= 0);
184
Contract
.Requires(offset >= 0);
185
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - offset)));
src\Shared\HttpRuleParser.cs (15)
56
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
70
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
113
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
114
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
165
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
219
Contract
.Requires(input != null);
220
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
267
Contract
.Assert(false, "'NotParsed' is unexpected: We started nested expression " +
277
Contract
.Assert(false, "Unknown enum result: " + nestedResult);
Microsoft.AspNetCore.Mvc.Core (15)
src\Shared\HttpRuleParser.cs (15)
56
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
70
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
113
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
114
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
165
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
219
Contract
.Requires(input != null);
220
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
267
Contract
.Assert(false, "'NotParsed' is unexpected: We started nested expression " +
277
Contract
.Assert(false, "Unknown enum result: " + nestedResult);
Microsoft.AspNetCore.Routing (15)
src\Shared\HttpRuleParser.cs (15)
56
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
70
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
113
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
114
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
165
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
219
Contract
.Requires(input != null);
220
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
267
Contract
.Assert(false, "'NotParsed' is unexpected: We started nested expression " +
277
Contract
.Assert(false, "Unknown enum result: " + nestedResult);
Microsoft.AspNetCore.Server.HttpSys (3)
RequestProcessing\ClientCertLoader.cs (3)
53
Contract
.Assert(Task.IsCompleted);
62
Contract
.Assert(Task.IsCompleted);
71
Contract
.Assert(Task.IsCompleted);
Microsoft.AspNetCore.TestHost (3)
ClientHandler.cs (2)
205
Contract
.Assert(success, "Bad trailer");
224
Contract
.Assert(success, "Bad header");
ResponseBodyPipeWriter.cs (1)
45
Contract
.Requires(innerException != null);
Microsoft.AspNetCore.WebSockets.Tests (1)
BufferStream.cs (1)
311
Contract
.Requires(innerException != null);
Microsoft.Build (3)
Collections\RetrievableEntryHashSet\RetrievableEntryHashSet.cs (3)
170
Contract
.EndContractBlock();
626
Contract
.EndContractBlock();
660
Contract
.EndContractBlock();
Microsoft.Cci.Extensions (40)
Differs\Differences.cs (3)
13
Contract
.Requires(id != null);
14
Contract
.Requires(message != null);
26
Contract
.Requires(obj != null);
Differs\ElementDiffer.cs (1)
59
Contract
.Assert(_mapping.ElementCount <= 2);
Differs\ElementDifferenceFactory.cs (1)
28
Contract
.Requires(container != null);
Differs\ListMerger.cs (2)
76
Contract
.Assert(findIndex0 == -1 && findIndex1 == -1);
77
Contract
.Assert(!list0[list0Index].Equals(list1[list1Index]));
Experimental\APIClosureTypeReferenceVisitor.cs (1)
62
Contract
.Assert(type == type.UnWrap());
Experimental\TypeReferenceSearcher.cs (1)
110
Contract
.Assert(type == type.UnWrap());
Experimental\TypeReferenceVisitor.cs (1)
62
Contract
.Assert(type == type.UnWrap());
Extensions\CSharp\CSharpCciExtensions.cs (3)
98
Contract
.Requires(baseType != null);
99
Contract
.Requires(type != null);
1005
Contract
.Requires(member != null);
Extensions\DocIdExtensions.cs (2)
65
Contract
.Requires(reference != null);
83
Contract
.Assert(false, string.Format("Fell through cases in TypeExtensions.RefDocId() Type of reference: {0}", reference.GetType()));
Extensions\TypeExtensions.cs (6)
136
Contract
.Requires(reference != null);
137
Contract
.Requires(!(reference is Dummy));
245
Contract
.Requires(reference != null);
263
Contract
.Assert(false, String.Format("Fell through cases in TypeExtensions.FullName() Type of reference: {0}", reference.GetType()));
269
Contract
.Requires(reference != null);
411
Contract
.Assert(reference is INamedTypeReference
HostEnvironment.cs (3)
193
Contract
.Requires(probeDir != null);
194
Contract
.Requires(referencedAssembly != null);
304
Contract
.Assert(this.UnifyToLibPath);
Mappings\AttributesMapping.cs (3)
56
Contract
.Assert(index != 0);
82
Contract
.Requires(attributes != null);
83
Contract
.Requires(comparer != null);
Mappings\ElementMapping.cs (1)
24
Contract
.Requires(settings.ElementCount >= 0 && settings.ElementCount <= 2);
Traversers\DependencyTraverser.cs (1)
193
Contract
.Assert(_definitionStack.Count != 0);
Traversers\DifferenceTraverser.cs (2)
25
Contract
.Requires(oldAssemblies != null);
26
Contract
.Requires(newAssemblies != null);
Traversers\MappingsTypeMemberTraverser.cs (1)
22
Contract
.Requires(settings != null);
Traversers\ResolveAllReferencesTraverser.cs (1)
99
Contract
.Assert(!(aliasForType.AliasedType is Dummy), "The aliased type should not be a dummy");
Writers\CSharp\CSDeclarationWriter.cs (1)
48
Contract
.Requires(writer != null);
Writers\CSharp\CSDeclarationWriter.Methods.cs (1)
181
Contract
.Assert(method is not IGenericMethodInstance, "Currently don't support generic method instances");
Writers\CSharp\CSDeclarationWriter.Types.cs (2)
65
Contract
.Assert(type.IsDelegate);
81
Contract
.Assert(!(type is IGenericTypeInstance), "Currently don't support generic type instances if we hit this then add support");
Writers\Syntax\HtmlSyntaxWriter.cs (1)
56
Contract
.Assert(disposeAction != null);
Writers\Syntax\IndentionSyntaxWriter.cs (1)
22
Contract
.Requires(writer != null);
Writers\Syntax\OpenXmlSyntaxWriter.cs (1)
59
Contract
.Assert(disposeAction != null);
Microsoft.DotNet.AsmDiff (4)
DiffCSharpWriter.cs (4)
126
Contract
.Assert(this.Settings.GroupByAssembly);
275
Contract
.Assert(element[1] != null);
281
Contract
.Assert(element[0] != null);
483
Contract
.Assert(p1.Key == p2.Key);
Microsoft.ML.Core (3)
SearchSpace\ChoiceAttribute.cs (3)
23
Contract
.Assert(candidatesType.Count() == 1, "multiple candidates type detected");
34
Contract
.Assert(candidatesType.Count() == 1, "multiple candidates type detected");
35
Contract
.Assert(candidatesType.First() == defaultValue.GetType(), "candidates type doesn't match with defaultValue type");
Microsoft.ML.GenAI.Core (10)
Module\Attention.cs (10)
112
Contract
.Assert(this._hiddenSize % (this._headDim * this._numHeads) == 0, "hidden_size must be divisible by num_heads");
188
Contract
.Assert(attnWeights.shape.Length == 4);
189
Contract
.Assert(attnWeights.shape[0] == bsz);
190
Contract
.Assert(attnWeights.shape[1] == this._numHeads);
191
Contract
.Assert(attnWeights.shape[2] == qLen);
192
Contract
.Assert(attnWeights.shape[3] == kvSeqLen);
197
Contract
.Assert(attentionMask.shape.Length == 4);
198
Contract
.Assert(attentionMask.shape[0] == bsz);
199
Contract
.Assert(attentionMask.shape[1] == 1);
200
Contract
.Assert(attentionMask.shape[2] == qLen);
Microsoft.ML.GenAI.Phi (2)
Module\Phi2Attention.cs (1)
70
Contract
.Assert(this._hiddenSize % (this._headDim * this._numAttentionHeads) == 0, "hidden_size must be divisible by num_attention_heads");
Module\Phi2Model.cs (1)
111
Contract
.Assert(seqLen == queryLength, "seqLen must be equal to queryLength");
Microsoft.ML.ImageAnalytics (1)
ImageLoader.cs (1)
345
Contract
.Assert(srcSpan.Length == dstSpan.Length);
Microsoft.ML.SearchSpace (16)
Option\ChoiceOption.cs (4)
28
Contract
.Assert(choices.Length > 0 && choices.Length < 1074, "the length of choices must be (0, 1074)");
30
Contract
.Assert(distinctChoices.Count() == choices.Length, "choices must not contain repeated values");
69
Contract
.Assert(x >= 0, $"{param} not contains");
77
Contract
.Assert(values.Length >= 0, "values length must be greater than 0");
Option\UniformNumericOption.cs (5)
27
Contract
.Assert(max > min, "max must be larger than min.");
28
Contract
.Assert(min > 0 || logBase == false, "min must be larger than 0 if logBase is true.");
60
Contract
.Assert(x <= Max && x >= Min, $"{x} is not within [{Min}, {Max}]");
78
Contract
.Assert(values.Length == 1, "values length must be 1");
80
Contract
.Assert(value <= 1 && value >= 0, $"{value} must be between [0,1]");
Parameter.cs (1)
360
Contract
.Assert(ParameterType == ParameterType.Object, "parameter is not object type.");
SearchSpace.cs (6)
111
Contract
.Assert(feature.Length == FeatureSpaceDim, "input feature doesn't match");
206
Contract
.Assert(attributes.Count() <= 1, $"{field.Name} can only define one of the choice|range|option attribute");
253
Contract
.Assert(attributes.Count() <= 1, $"{property.Name} can only define one of the choice|range|option attribute");
291
Contract
.Assert(type == typeof(bool), $"[Option:{optionName}] BooleanChoice can only apply to property or field which type is bool");
297
Contract
.Assert(type != typeof(int) && type != typeof(short) && type != typeof(long), $"[Option:{optionName}] UniformDoubleOption or UniformSingleOption can't apply to property or field which type is int or short or long");
304
Contract
.Assert(supportTypes.Contains(type) || type.IsEnum, $"[Option:{optionName}] ChoiceAttribute can only apply to enum or the following types {string.Join(",", supportTypes.Select(x => x.Name))}");
Microsoft.Net.Http.Headers (54)
CacheControlHeaderValue.cs (1)
520
Contract
.Requires(startIndex >= 0);
ContentDispositionHeaderValue.cs (5)
276
Contract
.Requires(startIndex >= 0);
316
Contract
.Requires((input.Length > 0) && (startIndex < input.Length));
527
Contract
.Assert(value != null);
536
Contract
.Assert(input != null);
576
Contract
.Assert(input != null);
ContentRangeHeaderValue.cs (1)
229
Contract
.Requires(startIndex >= 0);
EntityTagHeaderValue.cs (3)
212
Contract
.Requires(startIndex >= 0);
258
Contract
.Assert(startIndex == 0);
259
Contract
.Assert(!isWeak);
HeaderUtilities.cs (4)
117
Contract
.Assert(xItem != null);
144
Contract
.Assert(
Contract
.ForAll(alreadyFound, value => { return value; }),
156
Contract
.Requires(startIndex <= input.Length); // it's OK if index == value.Length.
HttpHeaderParser.cs (3)
35
Contract
.Requires((value == null) || ((index >= 0) && (index <= value.Length)));
59
Contract
.Assert(_supportsMultipleValues);
118
Contract
.Assert(_supportsMultipleValues);
MediaTypeHeaderValue.cs (2)
562
Contract
.Requires(startIndex >= 0);
606
Contract
.Requires((input.Length > 0) && (startIndex < input.Length));
NameValueHeaderValue.cs (5)
118
Contract
.Assert(_name != null);
284
Contract
.Assert(destination != null);
338
Contract
.Requires(startIndex >= 0);
394
Contract
.Requires(startIndex >= 0);
436
Contract
.Requires(name.Length > 0);
RangeConditionHeaderValue.cs (1)
135
Contract
.Requires(startIndex >= 0);
RangeHeaderValue.cs (2)
154
Contract
.Requires(startIndex >= 0);
192
Contract
.Assert(current == input.Length, "GetRangeItemListLength() should consume the whole string or fail.");
RangeItemHeaderValue.cs (4)
108
Contract
.Requires(startIndex >= 0);
109
Contract
.Ensures((
Contract
.Result<int>() == 0) || (rangeCollection.Count > 0),
156
Contract
.Requires(startIndex >= 0);
SetCookieHeaderValue.cs (1)
475
Contract
.Requires(startIndex >= 0);
src\Http\Shared\CookieHeaderParserShared.cs (6)
110
Contract
.Requires(startIndex <= input.Length); // it's OK if index == value.Length.
142
Contract
.Requires(offset >= 0);
184
Contract
.Requires(offset >= 0);
185
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - offset)));
src\Shared\HttpRuleParser.cs (15)
56
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
70
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
113
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
114
Contract
.Ensures((
Contract
.Result<int>() >= 0) && (
Contract
.Result<int>() <= (input.Length - startIndex)));
165
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
219
Contract
.Requires(input != null);
220
Contract
.Requires((startIndex >= 0) && (startIndex < input.Length));
267
Contract
.Assert(false, "'NotParsed' is unexpected: We started nested expression " +
277
Contract
.Assert(false, "Unknown enum result: " + nestedResult);
StringWithQualityHeaderValue.cs (1)
187
Contract
.Requires(startIndex >= 0);
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
150
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.
Contract
))]
netstandard (1)
netstandard.cs (1)
631
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.
Contract
))]
PrepareTests (1)
MinimizeUtil.cs (1)
174
Contract
.Assert(!File.Exists(file));
PresentationCore (7)
src\Microsoft.DotNet.Wpf\src\Shared\Telemetry\Managed\EventSourceActivity.cs (7)
5
using Contract = System.Diagnostics.Contracts.
Contract
;
104
Contract
.Requires<ArgumentNullException>(eventSource != null, nameof(eventSource));
143
Contract
.Requires<ArgumentNullException>(parentActivity != null, nameof(parentActivity));
176
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
207
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
237
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
256
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
PresentationFramework (7)
src\Microsoft.DotNet.Wpf\src\Shared\Telemetry\Managed\EventSourceActivity.cs (7)
5
using Contract = System.Diagnostics.Contracts.
Contract
;
104
Contract
.Requires<ArgumentNullException>(eventSource != null, nameof(eventSource));
143
Contract
.Requires<ArgumentNullException>(parentActivity != null, nameof(parentActivity));
176
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
207
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
237
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
256
Contract
.Requires<ArgumentNullException>(eventName != null, nameof(eventName));
System.Diagnostics.Contracts (1)
artifacts\obj\System.Diagnostics.Contracts\Debug\net10.0\System.Diagnostics.Contracts.Forwards.cs (1)
3
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.
Contract
))]
System.Private.CoreLib (2)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Contracts\Contracts.cs (1)
623
Assembly thisAssembly = typeof(
Contract
).Assembly; // In case we refactor mscorlib, use Contract class instead of Object.
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ContractHelper.cs (1)
122
Contract
.Assume(false, "Unreachable code");
System.ServiceModel.Federation (4)
System\Runtime\TaskHelpers.cs (2)
131
Contract
.Assert(task != null, "IAsyncResult must be an instance of Task<TResult>");
140
Contract
.Assert(task != null, "IAsyncResult must be an instance of Task");
System\Runtime\TimeoutHelper.cs (2)
19
Contract
.Assert(timeout >= TimeSpan.Zero, "timeout must be non-negative");
139
Contract
.Assert(!_deadlineSet, "TimeoutHelper deadline set twice.");
System.ServiceModel.NetFramingBase (10)
System\ServiceModel\Channels\Connection.cs (2)
285
Contract
.Assert(stream != null, "StreamConnection: Stream cannot be null.");
286
Contract
.Assert(innerStream != null, "StreamConnection: Inner stream cannot be null.");
System\ServiceModel\Channels\ConnectionPool.cs (1)
133
Contract
.Assert(result != null, "EndpointPool must be non-null at this point");
System\ServiceModel\Channels\FramingChannels.cs (1)
77
Contract
.Assert(false, "Streamed output should never be called in this channel.");
System\ServiceModel\Channels\NetFramingTransportChannelFactory.cs (1)
309
Contract
.Assert(_connectionPool != null, "ConnectionPool should always be found");
System\ServiceModel\Channels\SingletonConnectionReader.cs (1)
31
Contract
.Assert(connection != null);
System\ServiceModel\Channels\StreamedFramingRequestChannel.cs (1)
160
Contract
.Assert(connectionPoolHelper != null);
System\ServiceModel\TimeSpanHelper.cs (3)
14
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
20
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
26
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
System.ServiceModel.NetNamedPipe (3)
System\ServiceModel\TimeSpanHelper.cs (3)
14
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
20
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
26
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
System.ServiceModel.UnixDomainSocket (4)
System\ServiceModel\TimeSpanHelper.cs (3)
14
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
20
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
26
Contract
.Assert(value == TimeSpan.Parse(text, CultureInfo.InvariantCulture), "");
System\ServiceModel\UnixDomainSocketSecurity.cs (1)
28
Contract
.Assert(UnixDomainSocketSecurityModeHelper.IsDefined(mode),