297 references to ThrowIfTrue
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
StringCopyPaste\AbstractPasteProcessor.cs (1)
117
Contract.
ThrowIfTrue
(StringExpressionBeforePasteInfo.ContentSpans.IsEmpty);
StringCopyPaste\StringCopyPasteHelpers.cs (1)
565
Contract.
ThrowIfTrue
(spans.Length == 0);
Microsoft.CodeAnalysis.CSharp.Features (23)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
77
Contract.
ThrowIfTrue
(localFunction.Body is null && localFunction.ExpressionBody is null);
ConvertToExtension\ConvertToExtensionCodeRefactoringProvider.cs (3)
199
Contract.
ThrowIfTrue
(allExtensionMethods.IsEmpty);
223
Contract.
ThrowIfTrue
(allExtensionMethods.IsEmpty);
257
Contract.
ThrowIfTrue
(group.IsEmpty);
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
49
Contract.
ThrowIfTrue
(result.IsDefault);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
145
Contract.
ThrowIfTrue
(characters.IsDefaultOrEmpty);
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (1)
122
Contract.
ThrowIfTrue
(string.IsNullOrWhiteSpace(implementationDetails.Message));
ExtractMethod\CSharpMethodExtractor.cs (1)
127
Contract.
ThrowIfTrue
(memberNode.Kind() == SyntaxKind.NamespaceDeclaration);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
41
Contract.
ThrowIfTrue
(statementsOrFieldToInsert.IsDefaultOrEmpty);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (3)
317
Contract.
ThrowIfTrue
(AnalyzerResult.MethodTypeParametersInDeclaration.IsEmpty);
874
Contract.
ThrowIfTrue
(variableInfos.IsEmpty);
891
Contract.
ThrowIfTrue
(variableInfos.IsEmpty && !needsControlFlowValue);
ExtractMethod\CSharpSelectionResult.cs (2)
71
Contract.
ThrowIfTrue
(IsExtractMethodOnExpression);
82
Contract.
ThrowIfTrue
(IsExtractMethodOnExpression);
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
39
Contract.
ThrowIfTrue
(IsExtractMethodOnExpression);
SignatureHelp\GenericNamePartiallyWrittenSignatureHelpProvider.cs (1)
32
Contract.
ThrowIfTrue
(nextToken.Kind() == 0);
SignatureHelp\LightweightOverloadResolution.cs (1)
175
Contract.
ThrowIfTrue
(argumentToParameterMap.Count != arguments.Count);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
358
Contract.
ThrowIfTrue
(useSpread && arguments.Count != 1);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
1193
Contract.
ThrowIfTrue
(arguments.Count != 1);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
53
Contract.
ThrowIfTrue
(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
53
Contract.
ThrowIfTrue
(questionToken.Kind() != SyntaxKind.QuestionToken);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
469
Contract.
ThrowIfTrue
(expressions.Length >= 2 && match.UseSpread);
StringIndentation\CSharpStringIndentationService.cs (1)
178
Contract.
ThrowIfTrue
(lastLine.LineNumber - firstLine.LineNumber < 2);
Microsoft.CodeAnalysis.CSharp.Workspaces (16)
CodeGeneration\CSharpSyntaxGenerator.cs (2)
3125
Contract.
ThrowIfTrue
(ReferenceEquals(root, node));
3146
Contract.
ThrowIfTrue
(ReferenceEquals(root, declaration));
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
274
Contract.
ThrowIfTrue
(node is TypeDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
36
Contract.
ThrowIfTrue
(trivia.Kind() == SyntaxKind.EndOfLineTrivia);
37
Contract.
ThrowIfTrue
(trivia.Kind() == SyntaxKind.SkippedTokensTrivia);
38
Contract.
ThrowIfTrue
(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (3)
47
Contract.
ThrowIfTrue
(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
48
Contract.
ThrowIfTrue
(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
78
Contract.
ThrowIfTrue
(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
183
Contract.
ThrowIfTrue
(castNode.WalkUpParentheses().ContainsDiagnostics);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
22
Contract.
ThrowIfTrue
(endToken.Kind() == SyntaxKind.None);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
74
Contract.
ThrowIfTrue
(token.Kind() == SyntaxKind.None);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (4)
948
Contract.
ThrowIfTrue
(previousToken.HasValue && previousToken.Value != operatorToken);
1116
Contract.
ThrowIfTrue
(previousToken.HasValue && previousToken.Value != coalesceExpression.OperatorToken);
1906
Contract.
ThrowIfTrue
(previousToken.HasValue && previousToken.Value != prefixUnaryExpression.OperatorToken);
1962
Contract.
ThrowIfTrue
(previousToken.HasValue && previousToken.Value != awaitExpression.AwaitKeyword);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Workspaces\EditorTestWorkspace.cs (3)
165
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
175
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
185
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
Microsoft.CodeAnalysis.ExternalAccess.FSharp (6)
Internal\Editor\FSharpSmartIndentProvider.cs (1)
42
Contract.
ThrowIfTrue
(service == null && legacyService == null);
Internal\NavigateTo\FSharpNavigateToSearchService.cs (2)
58
Contract.
ThrowIfTrue
(projects.IsEmpty);
59
Contract.
ThrowIfTrue
(projects.Select(p => p.Language).Distinct().Count() != 1);
SignatureHelp\FSharpSignatureHelpItems.cs (2)
68
Contract.
ThrowIfTrue
(items.IsEmpty());
69
Contract.
ThrowIfTrue
(selectedItem.HasValue && selectedItem.Value >= items.Count);
SignatureHelp\FSharpSignatureHelpTriggerInfo.cs (1)
16
Contract.
ThrowIfTrue
(triggerReason == FSharpSignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null);
Microsoft.CodeAnalysis.Features (52)
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
120
Contract.
ThrowIfTrue
(dotAwaitContext == DotAwaitContext.None);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
96
Contract.
ThrowIfTrue
(quotedPath[0] != '"');
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (2)
71
Contract.
ThrowIfTrue
(placeholderIndex < 0);
345
Contract.
ThrowIfTrue
(placeholderIndex < 0);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.ProjectStates.cs (1)
79
Contract.
ThrowIfTrue
(newHostAnalyzers.Count > 0);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
516
Contract.
ThrowIfTrue
(newActiveStatementSpans.IsDefault);
6483
Contract.
ThrowIfTrue
(oldCapture.IsThis);
EditAndContinue\ActiveStatementExceptionRegions.cs (1)
23
Contract.
ThrowIfTrue
(spans.IsDefault);
EditAndContinue\DebuggingSession.cs (1)
547
Contract.
ThrowIfTrue
(solutionUpdate.ModuleUpdates.Updates.IsEmpty && solutionUpdate.ProjectsToRebuild.IsEmpty);
EditAndContinue\EditAndContinueService.cs (1)
145
Contract.
ThrowIfTrue
(captureAllMatchingDocuments && !captureMatchingDocuments.IsEmpty);
EditAndContinue\EditSession.cs (2)
726
Contract.
ThrowIfTrue
(analysis.ActiveStatements.IsDefault);
1325
Contract.
ThrowIfTrue
(syntaxError != null);
EmbeddedLanguages\AbstractEmbeddedLanguageFeatureService.cs (1)
118
Contract.
ThrowIfTrue
(services.IsDefaultOrEmpty);
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
143
Contract.
ThrowIfTrue
(fields.Length == 0);
Extensions\ExtensionFolder.cs (2)
117
Contract.
ThrowIfTrue
(!Monitor.IsEntered(_extensionMessageHandlerService._gate));
140
Contract.
ThrowIfTrue
(!Monitor.IsEntered(_extensionMessageHandlerService._gate));
Extensions\ExtensionMessageHandlerService.cs (1)
68
Contract.
ThrowIfTrue
(!Monitor.IsEntered(_gate));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingIdleProcessor.cs (1)
82
Contract.
ThrowIfTrue
(_isPaused_doNotAccessDirectly);
ExternalAccess\VSTypeScript\Api\VSTypeScriptDiagnosticData.cs (1)
41
Contract.
ThrowIfTrue
(useMapped);
ExternalAccess\VSTypeScript\VSTypeScriptNavigateToSearchService.cs (2)
60
Contract.
ThrowIfTrue
(projects.IsEmpty);
61
Contract.
ThrowIfTrue
(projects.Select(p => p.Language).Distinct().Count() != 1);
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
29
Contract.
ThrowIfTrue
(textSpan.IsEmpty);
ExtractMethod\MethodExtractor.Analyzer.cs (1)
363
Contract.
ThrowIfTrue
(variable.UseAsReturnValue);
ExtractMethod\MethodExtractor.CodeGenerator.cs (1)
297
Contract.
ThrowIfTrue
(AnalyzerResult.GetVariablesToSplitOrMoveOutToCallSite().Any(v => v.UseAsReturnValue));
ExtractMethod\OperationStatus.cs (1)
20
Contract.
ThrowIfTrue
(reasons.IsDefault);
ExtractMethod\SelectionResult.cs (3)
108
Contract.
ThrowIfTrue
(IsExtractMethodOnExpression);
116
Contract.
ThrowIfTrue
(IsExtractMethodOnExpression);
209
Contract.
ThrowIfTrue
(IsExtractMethodOnExpression);
FindUsages\DefinitionItem.cs (2)
232
Contract.
ThrowIfTrue
(sourceSpans.IsDefault);
233
Contract.
ThrowIfTrue
(metadataLocations.IsDefault);
FindUsages\DefinitionItemFactory.cs (1)
192
Contract.
ThrowIfTrue
(namespaceSymbol.ConstituentNamespaces.IsEmpty);
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (1)
694
Contract.
ThrowIfTrue
(symbol.TypeParameterKind == TypeParameterKind.Cref);
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (1)
289
Contract.
ThrowIfTrue
(_openedDocumentIds.ContainsKey(fileInfo));
NavigateTo\AbstractNavigateToSearchService.CachedDocumentSearch.cs (2)
72
Contract.
ThrowIfTrue
(projects.IsEmpty);
73
Contract.
ThrowIfTrue
(projects.Select(p => p.Language).Distinct().Count() != 1);
NavigateTo\AbstractNavigateToSearchService.GeneratedDocumentSearch.cs (2)
33
Contract.
ThrowIfTrue
(projects.IsEmpty);
34
Contract.
ThrowIfTrue
(projects.Select(p => p.Language).Distinct().Count() != 1);
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (2)
158
Contract.
ThrowIfTrue
(projects.IsEmpty);
159
Contract.
ThrowIfTrue
(projects.Select(p => p.Language).Distinct().Count() != 1);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (1)
392
Contract.
ThrowIfTrue
(_openedDocumentIds.Contains(info.DocumentId));
QuickInfo\Presentation\TaggedTextExtensions.cs (1)
211
Contract.
ThrowIfTrue
(_lines.Count == 0);
Rename\SymbolicRenameInfo.cs (3)
63
Contract.
ThrowIfTrue
(this.IsError);
90
Contract.
ThrowIfTrue
(this.IsError);
97
Contract.
ThrowIfTrue
(this.IsError);
SignatureHelp\SignatureHelpItems.cs (2)
70
Contract.
ThrowIfTrue
(items.IsEmpty());
71
Contract.
ThrowIfTrue
(selectedItem.HasValue && selectedItem.Value >= items.Count);
SignatureHelp\SignatureHelpTriggerInfo.cs (1)
15
Contract.
ThrowIfTrue
(triggerReason == SignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null);
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (2)
212
Contract.
ThrowIfTrue
(additionalLocations.IsEmpty());
213
Contract.
ThrowIfTrue
(tagIndices.IsEmpty());
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
160
Contract.
ThrowIfTrue
(seenInvocation && seenIndexAssignment);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
229
Contract.
ThrowIfTrue
(arguments.Count == 0);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
193
Contract.
ThrowIfTrue
(field == null || property == null);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\SourceMarkers.cs (1)
111
Contract.
ThrowIfTrue
(result.Any(span => span == default));
Microsoft.CodeAnalysis.LanguageServer (4)
BrokeredServices\WrappedServiceBroker.cs (1)
29
Contract.
ThrowIfTrue
(_serviceBrokerTask.Task.IsCompleted);
Logging\RoslynLogger.cs (1)
32
Contract.
ThrowIfTrue
(_instance is not null);
Logging\ServerLoggerFactory.cs (1)
26
Contract.
ThrowIfTrue
(_loggerFactory is not null);
Testing\TestRunner.TestRunHandler.cs (1)
82
Contract.
ThrowIfTrue
(_isComplete);
Microsoft.CodeAnalysis.LanguageServer.Protocol (8)
Extensions\Extensions.cs (1)
42
Contract.
ThrowIfTrue
(document is SourceGeneratedDocument);
Extensions\ProtocolConversions.cs (1)
181
Contract.
ThrowIfTrue
(position < 1);
Handler\Completion\CompletionResultFactory.cs (3)
515
Contract.
ThrowIfTrue
(item.IsComplexTextEdit);
659
Contract.
ThrowIfTrue
(lspItem.InsertText != null);
660
Contract.
ThrowIfTrue
(lspItem.TextEdit != null);
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
194
Contract.
ThrowIfTrue
(numLinesInSpan < 1);
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
197
Contract.
ThrowIfTrue
(triplesIndex != triples.Length);
LspServices\LspServices.cs (1)
82
Contract.
ThrowIfTrue
(existing.Metadata.ServerKind == WellKnownLspServerKinds.Any);
Microsoft.CodeAnalysis.Remote.ServiceHub (25)
Host\AssetProvider.cs (5)
40
Contract.
ThrowIfTrue
(checksum == Checksum.Null);
53
Contract.
ThrowIfTrue
(builder.Count != 1);
247
Contract.
ThrowIfTrue
(checksums.Contains(Checksum.Null));
299
Contract.
ThrowIfTrue
(missingChecksumsMemory.Length == 0);
304
Contract.
ThrowIfTrue
(missingChecksumsMemory.Span.IndexOf(Checksum.Null) >= 0);
Host\RemoteSolutionCache.cs (2)
91
Contract.
ThrowIfTrue
(_cacheNodes.Count > _totalHistory);
95
Contract.
ThrowIfTrue
(_cacheNodes.Count > _totalHistory + 1);
Host\RemoteWorkspace.cs (3)
94
Contract.
ThrowIfTrue
(solutionChecksum == Checksum.Null);
128
Contract.
ThrowIfTrue
(inFlightSolution.InFlightCount < 1);
144
Contract.
ThrowIfTrue
(inFlightSolution.InFlightCount < 1);
Host\RemoteWorkspace.InFlightSolution.cs (3)
110
Contract.
ThrowIfTrue
(this._cancellationTokenSource_doNotAccessDirectly.IsCancellationRequested);
146
Contract.
ThrowIfTrue
(InFlightCount < 1);
160
Contract.
ThrowIfTrue
(InFlightCount < 1);
Host\RemoteWorkspace.SolutionCreator.cs (6)
205
Contract.
ThrowIfTrue
(oldProjectStateChecksums.ProjectId != projectId);
206
Contract.
ThrowIfTrue
(oldChecksum != oldProjectStateChecksums.Checksum);
218
Contract.
ThrowIfTrue
(checksum != newProjectStateChecksum.Checksum);
308
Contract.
ThrowIfTrue
(isConeSync);
323
Contract.
ThrowIfTrue
(oldProjectChecksums.Checksum == newProjectChecksums.Checksum);
523
Contract.
ThrowIfTrue
(
Host\RemoteWorkspace_SolutionCaching.cs (5)
52
Contract.
ThrowIfTrue
(solution.InFlightCount < 1);
73
Contract.
ThrowIfTrue
(solution.InFlightCount < 1);
77
Contract.
ThrowIfTrue
(solution.InFlightCount < 2);
112
Contract.
ThrowIfTrue
(solution.InFlightCount < 1);
113
Contract.
ThrowIfTrue
(solutionChecksum != solution.SolutionChecksum);
Host\TestUtils.cs (1)
202
Contract.
ThrowIfTrue
(solutionChecksums.ProjectCone != null);
Microsoft.CodeAnalysis.Remote.Workspaces (12)
AbstractAssetProviderExtensions.cs (1)
71
Contract.
ThrowIfTrue
(checksumToAsset.Count != checksumSet.Count);
RemoteHostAssetReader.cs (1)
103
Contract.
ThrowIfTrue
(sentinelByte != RemoteHostAssetWriter.MessageSentinelByte);
RemoteHostAssetWriter.cs (2)
114
Contract.
ThrowIfTrue
(foundChecksumCount != _checksums.Length);
183
Contract.
ThrowIfTrue
(length > int.MaxValue);
SolutionAssetStorage.cs (3)
83
Contract.
ThrowIfTrue
(scope.RefCount <= 0);
100
Contract.
ThrowIfTrue
(existingScope != scope);
102
Contract.
ThrowIfTrue
(scope.RefCount <= 0);
SolutionAssetStorage.Scope.cs (5)
53
Contract.
ThrowIfTrue
(checksumsToFind.Contains(Checksum.Null));
57
Contract.
ThrowIfTrue
(checksumsToFind.Count > 0);
99
Contract.
ThrowIfTrue
(checksum == Checksum.Null);
107
Contract.
ThrowIfTrue
(asset != null); // We should only find one asset
108
Contract.
ThrowIfTrue
(checksum != foundChecksum);
Microsoft.CodeAnalysis.Workspaces (131)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (5)
101
Contract.
ThrowIfTrue
(commonLeftWidth > oldRootWidth);
102
Contract.
ThrowIfTrue
(commonLeftWidth > newRootWidth);
103
Contract.
ThrowIfTrue
(commonRightWidth > oldRootWidth);
104
Contract.
ThrowIfTrue
(commonRightWidth > newRootWidth);
178
Contract.
ThrowIfTrue
(oldRoot.IsIncrementallyIdenticalTo(newRoot));
CodeCleanup\AbstractCodeCleanerService.cs (5)
239
Contract.
ThrowIfTrue
(spanMarkerType == SpanMarkerType.EndOfFile);
240
Contract.
ThrowIfTrue
(previousToken.RawKind == 0);
255
Contract.
ThrowIfTrue
(spanMarkerType == SpanMarkerType.BeginningOfFile);
256
Contract.
ThrowIfTrue
(nextToken.RawKind == 0);
371
Contract.
ThrowIfTrue
(startToken.RawKind == 0 || endToken.RawKind == 0);
CodeFixesAndRefactorings\FixAllLogger.cs (1)
94
Contract.
ThrowIfTrue
(completed && timedOut);
Diagnostics\AnalysisResultPair.cs (1)
21
Contract.
ThrowIfTrue
(projectAnalysisResult is null && hostAnalysisResult is null);
Diagnostics\CompilationWithAnalyzersPair.cs (1)
27
Contract.
ThrowIfTrue
(projectCompilationWithAnalyzers is null && hostCompilationWithAnalyzers is null);
Diagnostics\DiagnosticAnalysisResultBuilder.cs (1)
45
Contract.
ThrowIfTrue
(Project.SupportsCompilation);
Editing\SyntaxGenerator.cs (1)
1387
Contract.
ThrowIfTrue
(ReferenceEquals(root, node));
FindSymbols\SymbolFinder.FindReferencesServerCallback.cs (1)
42
Contract.
ThrowIfTrue
(dehydrated.Symbols.Count == 0);
FindSymbols\SymbolFinder_Helpers.cs (1)
125
Contract.
ThrowIfTrue
(equivalentTypesWithDifferingAssemblies.Count == 0);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (2)
129
Contract.
ThrowIfTrue
((uint)accessibility > Max4BitValue);
130
Contract.
ThrowIfTrue
((uint)kind > Max5BitValue);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (2)
56
Contract.
ThrowIfTrue
(newDocumentsAndHashes.Count == 0);
95
Contract.
ThrowIfTrue
(newDocumentsAndHashes.Count < 2);
Options\DocumentOptionSet.cs (1)
78
Contract.
ThrowIfTrue
(internallyDefinedOption.Type == typeof(NamingStylePreferences));
PatternMatching\PatternMatcher.cs (1)
152
Contract.
ThrowIfTrue
(patternChunk.SimilarityChecker.IsDefault);
Remote\RemoteServiceCallbackDispatcher.cs (1)
25
Contract.
ThrowIfTrue
(callbackInstances?.TryRemove(Id, out _) == false);
Rename\LightweightRenameLocations.cs (3)
39
Contract.
ThrowIfTrue
(locations.IsDefault);
40
Contract.
ThrowIfTrue
(implicitLocations.IsDefault);
41
Contract.
ThrowIfTrue
(referencedSymbols.IsDefault);
Rename\Renamer.cs (2)
151
Contract.
ThrowIfTrue
(string.IsNullOrEmpty(newName));
193
Contract.
ThrowIfTrue
(string.IsNullOrEmpty(newName));
Rename\SymbolicRenameLocations.cs (3)
42
Contract.
ThrowIfTrue
(locations.IsDefault);
43
Contract.
ThrowIfTrue
(implicitLocations.IsDefault);
44
Contract.
ThrowIfTrue
(referencedSymbols.IsDefault);
Serialization\SerializedPortableExecutableReference.cs (1)
35
Contract.
ThrowIfTrue
(storageHandles.IsDefault);
Serialization\SerializerService_Reference.cs (2)
363
Contract.
ThrowIfTrue
(handles.Count == 0);
446
Contract.
ThrowIfTrue
(length != storageHandle.Identifier.Size);
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
88
Contract.
ThrowIfTrue
(start < text.Lines.GetLinePosition(0));
89
Contract.
ThrowIfTrue
(end > text.Lines.GetLinePosition(text.Length));
Shared\Extensions\SourceTextExtensions.cs (7)
200
Contract.
ThrowIfTrue
(buffer.Length != CharArrayLength);
256
Contract.
ThrowIfTrue
(chunkSize != CharArrayLength);
269
Contract.
ThrowIfTrue
(length > CharArrayLength);
273
Contract.
ThrowIfTrue
(currentChunk.Length != CharArrayLength);
276
Contract.
ThrowIfTrue
(i < numberOfChunks - 1 && currentChunkLength != CharArrayLength);
285
Contract.
ThrowIfTrue
(chunksArray.Any(static (c, s) => c.Length != s, CharArrayLength));
369
Contract.
ThrowIfTrue
(Position > Length);
Shared\Utilities\BloomFilter_Serialization.cs (1)
28
Contract.
ThrowIfTrue
(bitArray.Length % 8 != 0);
src\Dependencies\Collections\Extensions\FixedSizeArrayBuilder.cs (1)
62
Contract.
ThrowIfTrue
(condition, lineNumber, filePath);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
237
Contract.
ThrowIfTrue
(leftMaxEndValue < 0 && rightMaxEndValue < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.NodeEnumerator.cs (2)
77
Contract.
ThrowIfTrue
(_currentNodeHasValue);
78
Contract.
ThrowIfTrue
(_stack.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (1)
27
Contract.
ThrowIfTrue
(nodesAndTokens.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
105
Contract.
ThrowIfTrue
(b1 != b2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (2)
102
Contract.
ThrowIfTrue
(semanticModel.ParentModel.IsSpeculativeSemanticModel);
103
Contract.
ThrowIfTrue
(semanticModel.ParentModel.ParentModel != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
179
Contract.
ThrowIfTrue
(node1.RawKind == 0 || node2.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
94
Contract.
ThrowIfTrue
(treeData.Root.IsInvalidTokenRange(startToken, endToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
476
Contract.
ThrowIfTrue
(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
22
Contract.
ThrowIfTrue
(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (1)
25
Contract.
ThrowIfTrue
(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (3)
17
Contract.
ThrowIfTrue
(anchorToken.RawKind == 0);
18
Contract.
ThrowIfTrue
(textSpan.Start < 0 || textSpan.Length < 0);
20
Contract.
ThrowIfTrue
(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (6)
18
Contract.
ThrowIfTrue
(textSpan.Start < 0 || textSpan.Length < 0);
19
Contract.
ThrowIfTrue
(startToken.RawKind == 0);
20
Contract.
ThrowIfTrue
(endToken.RawKind == 0);
40
Contract.
ThrowIfTrue
(textSpan.Start < 0 || textSpan.Length < 0);
41
Contract.
ThrowIfTrue
(startToken.RawKind == 0);
42
Contract.
ThrowIfTrue
(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (3)
21
Contract.
ThrowIfTrue
(textSpan.Start < 0 || textSpan.Length < 0);
22
Contract.
ThrowIfTrue
(startToken.RawKind == 0);
23
Contract.
ThrowIfTrue
(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
78
Contract.
ThrowIfTrue
(token1 == default && token2 == default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer`1.cs (1)
58
Contract.
ThrowIfTrue
(RoslynString.IsNullOrEmpty(editorConfigStringForValue));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (3)
22
Contract.
ThrowIfTrue
(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
61
Contract.
ThrowIfTrue
(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
257
Contract.
ThrowIfTrue
(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (1)
90
Contract.
ThrowIfTrue
(typeArguments.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (1)
74
Contract.
ThrowIfTrue
(parameterTypes.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (1)
68
Contract.
ThrowIfTrue
(typeArguments.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (2)
417
Contract.
ThrowIfTrue
(_methodSymbolStack.Count == 0);
433
Contract.
ThrowIfTrue
(_contextualSymbolStack.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
517
Contract.
ThrowIfTrue
(_methodSymbolStack.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (6)
162
Contract.
ThrowIfTrue
(_asynchronousComputationCancellationSource != null &&
166
Contract.
ThrowIfTrue
(_requests != null &&
171
Contract.
ThrowIfTrue
(_requests != null &&
175
Contract.
ThrowIfTrue
(_cachedResult != null &&
180
Contract.
ThrowIfTrue
(_asynchronousComputeFunction == null && _synchronousComputeFunction != null);
377
Contract.
ThrowIfTrue
(_computationActive);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (6)
84
Contract.
ThrowIfTrue
(textSpan.IsEmpty);
148
Contract.
ThrowIfTrue
(token.RawKind == 0);
169
Contract.
ThrowIfTrue
(token1.RawKind == 0 && token2.RawKind == 0);
170
Contract.
ThrowIfTrue
(token1.Equals(token2));
289
Contract.
ThrowIfTrue
(nextToken.RawKind == 0);
315
Contract.
ThrowIfTrue
(previousToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
148
Contract.
ThrowIfTrue
(typeof(TFromEnum).GetEnumUnderlyingType() != typeof(TToEnum).GetEnumUnderlyingType());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
200
Contract.
ThrowIfTrue
(availableIndices != null && availableIndices.Count != declarationList.Count + 1);
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (3)
152
Contract.
ThrowIfTrue
(optional.HasValue && optional.Value == null);
290
Contract.
ThrowIfTrue
(exception != null);
307
Contract.
ThrowIfTrue
(exception != null);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (1)
133
Contract.
ThrowIfTrue
(id == -1);
Storage\SQLite\v2\SQLitePersistentStorageService.cs (1)
63
Contract.
ThrowIfTrue
(string.IsNullOrWhiteSpace(workingFolderPath));
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (1)
636
Contract.
ThrowIfTrue
(folders.IsDefault);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (1)
855
Contract.
ThrowIfTrue
(oldAnalyzerFilePath != newAnalyzerFilePath);
Workspace\Solution\Checksum.cs (1)
88
Contract.
ThrowIfTrue
(span.Length < HashSize);
Workspace\Solution\ChecksumsAndIds.cs (3)
23
Contract.
ThrowIfTrue
(ids.Length != checksums.Children.Length);
75
Contract.
ThrowIfTrue
(ids.Length != attributeChecksums.Children.Length);
76
Contract.
ThrowIfTrue
(ids.Length != textChecksums.Children.Length);
Workspace\Solution\DocumentState.cs (1)
401
Contract.
ThrowIfTrue
(ReferenceEquals(newAttributes, Attributes));
Workspace\Solution\ProjectState.cs (2)
982
Contract.
ThrowIfTrue
(oldDocuments.IsEmpty);
1008
Contract.
ThrowIfTrue
(oldDocuments.IsEmpty);
Workspace\Solution\Solution.cs (1)
1560
Contract.
ThrowIfTrue
(solution._documentIdToFrozenSolution.Count != 0);
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (3)
94
Contract.
ThrowIfTrue
(pendingTranslationActions is null);
105
Contract.
ThrowIfTrue
(this.CompilationWithoutGeneratedDocuments.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
205
Contract.
ThrowIfTrue
(compilationWithoutGeneratedDocuments.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
Workspace\Solution\SolutionCompilationState.cs (4)
77
Contract.
ThrowIfTrue
(projectCone != null);
107
Contract.
ThrowIfTrue
(_projectIdToTrackerMap.Any(kvp => kvp.Key != kvp.Value.ProjectState.Id));
1395
Contract.
ThrowIfTrue
(sourceText is null && syntaxNode is null);
1396
Contract.
ThrowIfTrue
(sourceText is not null && syntaxNode is not null);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (3)
136
Contract.
ThrowIfTrue
(forkedTrackerState is FinalCompilationTrackerState);
407
Contract.
ThrowIfTrue
(inProgressState.PendingTranslationActions.IsEmpty);
478
Contract.
ThrowIfTrue
(inProgressState.PendingTranslationActions.Count > 0);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (1)
178
Contract.
ThrowIfTrue
(generatedSources.Length != documentsToAddOrUpdate.Count);
Workspace\Solution\SolutionState.cs (2)
1264
Contract.
ThrowIfTrue
(documentId.ProjectId == relatedProjectIdHint);
1293
Contract.
ThrowIfTrue
(relatedProject == projectState);
Workspace\Solution\SourceGeneratedDocumentState.cs (2)
62
Contract.
ThrowIfTrue
(generatedSourceText is null && syntaxNode is null);
63
Contract.
ThrowIfTrue
(generatedSourceText is not null && syntaxNode is not null);
Workspace\Solution\TextDocumentStates.cs (1)
227
Contract.
ThrowIfTrue
(!ignoreUnchangedContent && ignoreUnchangeableDocuments);
Workspace\Solution\VersionSource\LoadableTextAndVersionSource.cs (1)
88
Contract.
ThrowIfTrue
(_gate.CurrentCount != 0);
Workspace\Solution\VersionSource\RecoverableTextAndVersion.cs (1)
160
Contract.
ThrowIfTrue
(source is LoadableTextAndVersionSource { CacheResult: true });
Workspace\Solution\VersionSource\RecoverableTextAndVersion.RecoverableText.cs (1)
130
Contract.
ThrowIfTrue
(Gate.CurrentCount != 0);
Workspace\Workspace.cs (2)
354
Contract.
ThrowIfTrue
(relatedDocumentId == addedDocumentId);
357
Contract.
ThrowIfTrue
(relatedDocumentId.ProjectId == addedDocumentId.ProjectId);
Microsoft.CodeAnalysis.Workspaces.MSBuild (3)
src\Workspaces\MSBuild\BuildHost\Rpc\Contracts\MonoMSBuildDiscovery.cs (3)
71
Contract.
ThrowIfTrue
(PlatformInformation.IsWindows);
95
Contract.
ThrowIfTrue
(PlatformInformation.IsWindows);
132
Contract.
ThrowIfTrue
(PlatformInformation.IsWindows);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (1)
173
Contract.
ThrowIfTrue
(responseJson.Contains("\r") || responseJson.Contains("\n"));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (5)
Workspaces\TestWorkspace_XmlConsumption.cs (1)
653
Contract.
ThrowIfTrue
(cursorPosition != null);
Workspaces\TestWorkspace`1.cs (4)
471
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
481
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
491
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
501
Contract.
ThrowIfTrue
(testDocument.IsSourceGenerated);
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\OnTypeRename\OnTypeRenameHandler.cs (1)
88
Contract.
ThrowIfTrue
(result.Ranges.IsDefault);
Roslyn.VisualStudio.Next.UnitTests (4)
Services\ServiceHubServicesTests.cs (1)
431
Contract.
ThrowIfTrue
(throwIfCalled);
Services\ServiceHubServicesTests_ExtensionMessageHandler.cs (3)
732
Contract.
ThrowIfTrue
(unloadCalled);
737
Contract.
ThrowIfTrue
(unloadCalled);
741
Contract.
ThrowIfTrue
(unloadCalled);