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