593 references to Contract
Microsoft.CodeAnalysis.Workspaces (593)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (7)
101
Contract
.ThrowIfTrue(commonLeftWidth > oldRootWidth);
102
Contract
.ThrowIfTrue(commonLeftWidth > newRootWidth);
103
Contract
.ThrowIfTrue(commonRightWidth > oldRootWidth);
104
Contract
.ThrowIfTrue(commonRightWidth > newRootWidth);
135
Contract
.ThrowIfFalse(currentOld.FullSpan.Start == currentNew.FullSpan.Start);
178
Contract
.ThrowIfTrue(oldRoot.IsIncrementallyIdenticalTo(newRoot));
190
Contract
.ThrowIfFalse((oldRoot.FullSpan.End - currentOld.FullSpan.End) ==
CodeActions\CodeAction.cs (1)
196
Contract
.ThrowIfFalse(provider is CodeFixProvider or CodeRefactoringProvider);
CodeActions\CodeAction_Cleanup.cs (2)
49
Contract
.ThrowIfFalse(document.SupportsSyntaxTree);
156
Contract
.ThrowIfFalse(document.SupportsSyntaxTree, "GetDocumentIdsAndOptionsAsync should only be returning documents that support syntax");
CodeCleanup\AbstractCodeCleanerService.cs (7)
213
Contract
.ThrowIfFalse(hasMultiplePreviousToken || hasMultipleNextToken);
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);
668
Contract
.ThrowIfNull(annotation.Data);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
57
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or
CodeFixes\FixAllOccurrences\FixAllContext.cs (1)
314
Contract
.ThrowIfNull(project);
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (1)
79
Contract
.ThrowIfFalse(
CodeFixesAndRefactorings\FixAllLogger.cs (1)
95
Contract
.ThrowIfTrue(completed && timedOut);
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (1)
84
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
CodeRefactorings\FixAllOccurences\FixAllState.cs (2)
96
Contract
.ThrowIfNull(Document);
107
Contract
.ThrowIfNull(Document);
Diagnostics\CompilationWithAnalyzersPair.cs (3)
26
Contract
.ThrowIfFalse(projectCompilationWithAnalyzers.AnalysisOptions.ReportSuppressedDiagnostics == hostCompilationWithAnalyzers.AnalysisOptions.ReportSuppressedDiagnostics);
27
Contract
.ThrowIfFalse(projectCompilationWithAnalyzers.AnalysisOptions.ConcurrentAnalysis == hostCompilationWithAnalyzers.AnalysisOptions.ConcurrentAnalysis);
31
Contract
.ThrowIfTrue(projectCompilationWithAnalyzers is null && hostCompilationWithAnalyzers is null);
Diagnostics\DiagnosticAnalysisResult.cs (5)
219
Contract
.ThrowIfNull(_syntaxLocals);
220
Contract
.ThrowIfNull(_semanticLocals);
221
Contract
.ThrowIfNull(_nonLocals);
222
Contract
.ThrowIfTrue(_others.IsDefault);
249
Contract
.ThrowIfNull(map);
Diagnostics\DiagnosticAnalysisResultBuilder.cs (1)
46
Contract
.ThrowIfTrue(Project.SupportsCompilation);
Diagnostics\DiagnosticDataLocation.cs (1)
62
Contract
.ThrowIfNull(unmappedFileSpan.Path);
Diagnostics\DocumentAnalysisScope.cs (1)
56
Contract
.ThrowIfFalse(TextDocument is AdditionalDocument);
Diagnostics\HostDiagnosticAnalyzers.cs (1)
182
Contract
.ThrowIfNull(language);
Editing\SyntaxEditor.cs (2)
254
Contract
.Fail($"GetCurrentNode returned null with the following node: {OriginalNode}");
286
Contract
.ThrowIfNull(node);
Editing\SyntaxGenerator.cs (4)
1023
Contract
.ThrowIfNull(attribute.AttributeClass);
1384
Contract
.ThrowIfTrue(ReferenceEquals(root, node));
1535
Contract
.ThrowIfNull(currentFirst);
1914
Contract
.ThrowIfNull(name);
ErrorReporting\InfoBarUI.cs (1)
20
Contract
.ThrowIfNull(title);
FindSymbols\Declarations\DeclarationFinder.cs (3)
28
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
78
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
85
Contract
.ThrowIfNull(info);
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (2)
28
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
33
Contract
.ThrowIfNull(query.Name);
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (2)
122
Contract
.ThrowIfNull(index);
125
Contract
.ThrowIfNull(_stringValue);
FindSymbols\FindReferences\DependentProjectsFinder.cs (4)
309
Contract
.ThrowIfNull(symbolOrigination.assembly);
310
Contract
.ThrowIfNull(project);
311
Contract
.ThrowIfFalse(project.SupportsCompilation);
324
Contract
.ThrowIfFalse(project.SupportsCompilation);
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
347
Contract
.ThrowIfNull(symbolTreeInfo);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
591
Contract
.ThrowIfFalse(notNullOriginalUnreducedSymbol2.GetOriginalUnreducedDefinition().Equals(notNullOriginalUnreducedSymbol2));
FindSymbols\FindReferences\Finders\AbstractTypeParameterSymbolReferenceFinder.cs (1)
61
Contract
.ThrowIfNull(token.Parent?.Parent);
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (1)
47
Contract
.ThrowIfNull(underlyingNamedType);
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (1)
60
Contract
.ThrowIfNull(symbol.DeclaringMethod);
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (3)
188
Contract
.ThrowIfFalse(linkedSymbols.Contains(symbol), "Linked symbols did not contain the very symbol we started with.");
191
Contract
.ThrowIfFalse(group.Symbols.Contains(symbol), "Symbol group did not contain the very symbol we started with.");
198
Contract
.ThrowIfFalse(symbolToGroup.ContainsKey(symbol));
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (2)
130
Contract
.ThrowIfNull(searchSymbol);
242
Contract
.ThrowIfFalse(projects.Count == 1, "Only a single project should be passed in");
FindSymbols\IStreamingFindReferencesProgress.cs (1)
36
Contract
.ThrowIfTrue(symbols.IsDefaultOrEmpty, "Symbols should be non empty");
FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (1)
25
Contract
.ThrowIfFalse(x.Document == y.Document);
FindSymbols\Shared\AbstractSyntaxIndex.cs (3)
33
Contract
.ThrowIfNull(index);
58
Contract
.ThrowIfFalse(index != null || loadOnly == true, "Result can only be null if 'loadOnly: true' was passed.");
122
Contract
.ThrowIfFalse(document.SupportsSyntaxTree);
FindSymbols\SymbolFinder.FindReferencesServerCallback.cs (1)
44
Contract
.ThrowIfTrue(dehydrated.Symbols.Count == 0);
FindSymbols\SymbolFinder_Helpers.cs (5)
130
Contract
.ThrowIfNull(equivalentTypesWithDifferingAssemblies);
131
Contract
.ThrowIfTrue(equivalentTypesWithDifferingAssemblies.Count == 0);
134
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => !SymbolEquivalenceComparer.Instance.Equals(kvp.Key.ContainingAssembly, kvp.Value.ContainingAssembly)));
137
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Key.ContainingType == null));
138
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Value.ContainingType == null));
FindSymbols\SymbolTree\MetadataInfo.cs (1)
31
Contract
.ThrowIfNull(info);
FindSymbols\SymbolTree\SymbolTreeInfo.cs (4)
123
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
135
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
147
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
153
Contract
.ThrowIfNull(queryName);
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
136
Contract
.ThrowIfTrue(info.Checksum != checksum, "How could the info stored for a particular PEReference now have a different checksum?");
FindSymbols\SymbolTree\SymbolTreeInfo_Serialization.cs (1)
57
Contract
.ThrowIfNull(result);
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (4)
179
Contract
.ThrowIfNull(info);
180
Contract
.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
201
Contract
.ThrowIfNull(info);
202
Contract
.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
87
Contract
.ThrowIfNull(node);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (2)
127
Contract
.ThrowIfTrue((uint)accessibility > Max4BitValue);
128
Contract
.ThrowIfTrue((uint)kind > Max5BitValue);
Formatting\AbstractFormattingService.cs (1)
20
Contract
.ThrowIfNull(syntaxFormattingOptions);
Formatting\Formatter.cs (1)
137
Contract
.ThrowIfNull(formattingOptions);
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (2)
25
Contract
.ThrowIfFalse(fixAllScope is FixAllScope.ContainingMember or FixAllScope.ContainingType);
53
Contract
.ThrowIfNull(documentForLocation);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
35
Contract
.ThrowIfNull(filePath);
55
Contract
.ThrowIfTrue(newDocumentsAndHashes.Count == 0);
61
Contract
.ThrowIfTrue(relatedDocuments.Length == 1, "We should have skipped non-linked files in the prior loop.");
95
Contract
.ThrowIfTrue(newDocumentsAndHashes.Count < 2);
Notification\AbstractGlobalOperationNotificationService.cs (4)
36
Contract
.ThrowIfFalse(_registrations.Count == 0);
37
Contract
.ThrowIfFalse(_operations.Count == 0, $"Non-disposed operations: {string.Join(", ", _operations)}");
69
Contract
.ThrowIfFalse(_operations.Count == 1);
82
Contract
.ThrowIfFalse(result);
Options\DocumentOptionSet.cs (1)
78
Contract
.ThrowIfTrue(internallyDefinedOption.Type == typeof(NamingStylePreferences));
PatternMatching\PatternMatcher.cs (1)
151
Contract
.ThrowIfTrue(patternChunk.SimilarityChecker.IsDefault);
Remote\ExportRemoteServiceCallbackDispatcherAttribute.cs (1)
20
Contract
.ThrowIfFalse(serviceInterface.IsInterface);
Remote\IRemoteKeepAliveService.cs (1)
74
Contract
.Fail("Should have been disposed!");
Remote\RemoteArguments.cs (1)
63
Contract
.ThrowIfNull(project, WorkspacesResources.Symbols_project_could_not_be_found_in_the_provided_solution);
Remote\RemoteServiceCallbackDispatcher.cs (2)
25
Contract
.ThrowIfTrue(callbackInstances?.TryRemove(Id, out _) == false);
47
Contract
.ThrowIfFalse(_callbackInstances.TryGetValue(callbackId, out var instance));
Remote\RemoteServiceCallbackDispatchers.cs (1)
24
Contract
.ThrowIfNull(serviceInterface);
Rename\ConflictEngine\ConflictResolver.cs (6)
191
Contract
.ThrowIfNull(implicitUsageConflict.SourceTree);
215
Contract
.ThrowIfNull(implicitConflict.SourceTree);
241
Contract
.ThrowIfNull(projectOpt);
293
Contract
.ThrowIfNull(projectOpt);
308
Contract
.ThrowIfNull(languageConflict.SourceTree);
335
Contract
.ThrowIfNull(oldLocation.SourceTree);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
160
Contract
.ThrowIfTrue(conflictLocations.Count != 0, "We're the first phase, so we should have no conflict locations yet");
Rename\ConflictEngine\MutableConflictResolution.cs (1)
105
Contract
.ThrowIfNull(directory);
Rename\IRemoteRenamerService.cs (2)
123
Contract
.ThrowIfNull(serializableLocations);
190
Contract
.ThrowIfNull(Resolution);
Rename\LightweightRenameLocations.cs (5)
40
Contract
.ThrowIfTrue(locations.IsDefault);
41
Contract
.ThrowIfTrue(implicitLocations.IsDefault);
42
Contract
.ThrowIfTrue(referencedSymbols.IsDefault);
76
Contract
.ThrowIfNull(solution);
77
Contract
.ThrowIfNull(symbol);
Rename\Renamer.cs (6)
152
Contract
.ThrowIfNull(solution);
153
Contract
.ThrowIfNull(symbol);
154
Contract
.ThrowIfTrue(string.IsNullOrEmpty(newName));
197
Contract
.ThrowIfNull(solution);
198
Contract
.ThrowIfNull(symbol);
199
Contract
.ThrowIfTrue(string.IsNullOrEmpty(newName));
Rename\RenameUtilities.cs (4)
101
Contract
.ThrowIfFalse(isSubset);
313
Contract
.ThrowIfNull(definitionSymbol);
324
Contract
.ThrowIfNull(symbol);
325
Contract
.ThrowIfNull(solution);
Rename\SymbolicRenameLocations.cs (4)
43
Contract
.ThrowIfTrue(locations.IsDefault);
44
Contract
.ThrowIfTrue(implicitLocations.IsDefault);
45
Contract
.ThrowIfTrue(referencedSymbols.IsDefault);
61
Contract
.ThrowIfNull(symbol);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
273
Contract
.ThrowIfNull(aliasLocation.SourceTree);
292
Contract
.ThrowIfNull(aliasLocation.SourceTree);
Rename\SymbolicRenameLocations.SearchResult.cs (1)
24
Contract
.ThrowIfNull(locations);
Serialization\SerializableSourceText.cs (1)
176
Contract
.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
Serialization\SerializedPortableExecutableReference.cs (1)
35
Contract
.ThrowIfTrue(storageHandles.IsDefault);
Serialization\SerializerService.cs (2)
206
Contract
.ThrowIfFalse(count <= 2);
214
Contract
.ThrowIfFalse(language is LanguageNames.CSharp or LanguageNames.VisualBasic);
Serialization\SerializerService_Reference.cs (10)
77
Contract
.ThrowIfFalse(TryGetAnalyzerImageReferenceGuid(analyzerImageReference, out var guid), "AnalyzerImageReferences are only supported during testing");
146
Contract
.ThrowIfFalse(TryGetAnalyzerImageReferenceGuid(analyzerImageReference, out var guid), "AnalyzerImageReferences are only supported during testing");
168
Contract
.ThrowIfFalse(TryGetAnalyzerImageReferenceFromGuid(guid, out var analyzerImageReference));
276
Contract
.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
356
Contract
.ThrowIfTrue(handles.Count == 0);
393
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
405
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
415
Contract
.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
439
Contract
.ThrowIfTrue(length != storageHandle.Identifier.Size);
453
Contract
.ThrowIfFalse(storageHandle.Identifier.Size == unmanagedStream.Length);
Shared\Extensions\DocumentExtensions.cs (1)
18
Contract
.ThrowIfNull(result);
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
89
Contract
.ThrowIfTrue(start < text.Lines.GetLinePosition(0));
90
Contract
.ThrowIfTrue(end > text.Lines.GetLinePosition(text.Length));
Shared\Extensions\IMethodSymbolExtensions.cs (1)
21
Contract
.ThrowIfFalse(delegateType.TypeKind == TypeKind.Delegate);
Shared\Extensions\ISymbolExtensions.cs (1)
364
Contract
.ThrowIfNull(candidate);
Shared\Extensions\SourceTextExtensions.cs (9)
199
Contract
.ThrowIfTrue(buffer.Length != CharArrayLength);
222
Contract
.ThrowIfFalse(offset == length);
255
Contract
.ThrowIfTrue(chunkSize != CharArrayLength);
268
Contract
.ThrowIfTrue(length > CharArrayLength);
272
Contract
.ThrowIfTrue(currentChunk.Length != CharArrayLength);
275
Contract
.ThrowIfTrue(i < numberOfChunks - 1 && currentChunkLength != CharArrayLength);
281
Contract
.ThrowIfFalse(offset == length);
284
Contract
.ThrowIfTrue(chunksArray.Any(static (c, s) => c.Length != s, CharArrayLength));
368
Contract
.ThrowIfTrue(Position > Length);
Shared\Extensions\TelemetryExtensions.cs (1)
18
Contract
.ThrowIfNull(type.FullName);
Shared\TestHooks\AsynchronousOperationListener.cs (3)
114
Contract
.ThrowIfFalse(_gate.LockHeldByMe());
120
Contract
.ThrowIfFalse(_gate.LockHeldByMe());
185
Contract
.ThrowIfFalse(TrackActiveTokens);
Shared\Utilities\BloomFilter_Serialization.cs (1)
28
Contract
.ThrowIfTrue(bitArray.Length % 8 != 0);
Shared\Utilities\ExtensionOrderer.Graph.cs (1)
21
Contract
.ThrowIfNull(name);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (2)
237
Contract
.ThrowIfTrue(leftMaxEndValue < 0 && rightMaxEndValue < 0);
248
Contract
.ThrowIfFalse(rightMaxEndValue > leftMaxEndValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.NodeEnumerator.cs (2)
78
Contract
.ThrowIfTrue(_currentNodeHasValue);
79
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\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
72
Contract
.ThrowIfFalse(surrogateChar == 0 || rune == Rune.ReplacementChar,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (4)
166
Contract
.ThrowIfNull(context.FilterTree);
167
Contract
.ThrowIfFalse(context.FilterSpan.HasValue);
178
Contract
.ThrowIfNull(context.FilterTree);
179
Contract
.ThrowIfFalse(context.FilterSpan.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalyzerConfigOptionsExtensions.cs (1)
23
Contract
.ThrowIfFalse(option.Definition.IsEditorConfigOption);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (3)
331
Contract
.ThrowIfNull(classOrStructType);
332
Contract
.ThrowIfNull(interfacesOrAbstractClasses);
333
Contract
.ThrowIfNull(isImplemented);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
498
Contract
.ThrowIfFalse(symbol.IsNormalAnonymousType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (7)
88
Contract
.ThrowIfNull(symbol);
89
Contract
.ThrowIfNull(within);
177
Contract
.ThrowIfNull(type);
215
Contract
.ThrowIfNull(assembly);
252
Contract
.ThrowIfNull(containingType);
429
Contract
.ThrowIfNull(withinType);
430
Contract
.ThrowIfNull(originalContainingType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
15
Contract
.ThrowIfNull(location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
108
Contract
.ThrowIfTrue(b1 != b2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (3)
109
Contract
.ThrowIfNull(semanticModel.ParentModel);
110
Contract
.ThrowIfTrue(semanticModel.ParentModel.IsSpeculativeSemanticModel);
111
Contract
.ThrowIfTrue(semanticModel.ParentModel.ParentModel != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
19
Contract
.ThrowIfNull(text);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StackExtensions.cs (2)
49
Contract
.ThrowIfNull(stack);
50
Contract
.ThrowIfNull(range);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (10)
16
Contract
.ThrowIfNull(line);
31
Contract
.ThrowIfNull(line);
46
Contract
.ThrowIfNull(lineText);
57
Contract
.ThrowIfNull(lineText);
208
Contract
.ThrowIfNull(line);
209
Contract
.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length);
210
Contract
.ThrowIfFalse(tabSize > 0);
217
Contract
.ThrowIfNull(line);
218
Contract
.ThrowIfFalse(column >= 0);
219
Contract
.ThrowIfFalse(tabSize > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (4)
107
Contract
.ThrowIfNull(node);
179
Contract
.ThrowIfTrue(node1.RawKind == 0 || node2.RawKind == 0);
298
Contract
.ThrowIfNull(nodes);
299
Contract
.ThrowIfFalse(nodes.Any());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
41
Contract
.ThrowIfTrue(token1.RawKind == 0 || token2.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (2)
69
Contract
.ThrowIfNull(syntaxTree);
131
Contract
.ThrowIfNull(syntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
34
Contract
.ThrowIfNull(formattingRules);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (4)
58
Contract
.ThrowIfNull(engine);
59
Contract
.ThrowIfNull(tokenStream);
125
Contract
.ThrowIfNull(operations);
414
Contract
.ThrowIfFalse(intervals.Length == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (3)
35
Contract
.ThrowIfNull(tokenStream);
36
Contract
.ThrowIfNull(formattingRules);
37
Contract
.ThrowIfNull(rootNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (2)
32
Contract
.ThrowIfNull(node);
33
Contract
.ThrowIfNull(formattingResults);
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\AbstractFormatEngine.OperationApplier.cs (6)
52
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
85
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
123
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
262
Contract
.ThrowIfNull(previousChangesMap);
451
Contract
.ThrowIfFalse(triviaInfo.SecondTokenIsFirstTokenOnLine);
478
Contract
.ThrowIfFalse(baseToken.RawKind != 0 && startToken.RawKind != 0 && endToken.RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.AbstractComplexTrivia.cs (3)
23
Contract
.ThrowIfNull(treeInfo);
76
Contract
.ThrowIfFalse(line > 0);
133
Contract
.ThrowIfFalse(list.Count > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.cs (4)
31
Contract
.ThrowIfNull(treeInfo);
92
Contract
.ThrowIfFalse(space >= 0);
111
Contract
.ThrowIfFalse(lineBreaks >= 0);
112
Contract
.ThrowIfFalse(indentation >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.ModifiedWhitespace.cs (1)
27
Contract
.ThrowIfNull(original);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (2)
27
Contract
.ThrowIfFalse(space >= 0);
57
Contract
.ThrowIfFalse(line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
34
Contract
.ThrowIfNull(formattingRules);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (4)
30
Contract
.ThrowIfNull(tokenStream);
31
Contract
.ThrowIfFalse((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount));
64
Contract
.ThrowIfFalse(this.TokenStream == other.TokenStream);
84
Contract
.ThrowIfNull(commonRoot);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenPairWithOperations.cs (2)
28
Contract
.ThrowIfNull(tokenStream);
30
Contract
.ThrowIfFalse(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (10)
138
Contract
.ThrowIfFalse(0 <= index && index < this.TokenCount);
237
Contract
.ThrowIfNull(data);
243
Contract
.ThrowIfNull(data);
249
Contract
.ThrowIfNull(data);
250
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
429
Contract
.ThrowIfFalse(this.FormatBeginningOfTree);
441
Contract
.ThrowIfFalse(this.FormatEndOfTree);
453
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
465
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
478
Contract
.ThrowIfTrue(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
41
Contract
.ThrowIfNull(root);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Debug.cs (1)
19
Contract
.ThrowIfFalse(text == _debugNodeData.GetTextBetween(token1, token2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (2)
18
Contract
.ThrowIfFalse(root.GetFirstToken(includeZeroWidth: true).RawKind != 0);
23
Contract
.ThrowIfTrue(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (2)
20
Contract
.ThrowIfNull(text);
26
Contract
.ThrowIfTrue(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.StructuredTrivia.cs (1)
22
Contract
.ThrowIfFalse(trivia.HasStructure);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
184
Contract
.ThrowIfFalse(lines.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AdjustNewLinesOperation.cs (3)
16
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.ForceLines || line > 0);
17
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.PreserveLines || line >= 0);
18
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.ForceLinesIfOnSingleLine || line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AdjustSpacesOperation.cs (1)
16
Contract
.ThrowIfFalse(space >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
18
Contract
.ThrowIfNull(tokens);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (3)
18
Contract
.ThrowIfTrue(anchorToken.RawKind == 0);
19
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
21
Contract
.ThrowIfTrue(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (10)
17
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));
19
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
20
Contract
.ThrowIfTrue(startToken.RawKind == 0);
21
Contract
.ThrowIfTrue(endToken.RawKind == 0);
36
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));
38
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask));
39
Contract
.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);
41
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
42
Contract
.ThrowIfTrue(startToken.RawKind == 0);
43
Contract
.ThrowIfTrue(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (3)
22
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
23
Contract
.ThrowIfTrue(startToken.RawKind == 0);
24
Contract
.ThrowIfTrue(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
72
Contract
.ThrowIfNull(context);
73
Contract
.ThrowIfNull(formattingRules);
74
Contract
.ThrowIfNull(originalString);
76
Contract
.ThrowIfFalse(lineBreaks >= 0);
77
Contract
.ThrowIfFalse(spaces >= 0);
79
Contract
.ThrowIfTrue(token1 == default && token2 == default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
21
Contract
.ThrowIfNull(s_currentLogger);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer`1.cs (1)
55
Contract
.ThrowIfTrue(RoslynString.IsNullOrEmpty(editorConfigStringForValue));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
91
Contract
.ThrowIfNull(option.PublicOption);
97
Contract
.ThrowIfNull(option.PublicOption);
103
Contract
.ThrowIfNull(option.PublicOption);
109
Contract
.ThrowIfNull(option.PublicOption);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
52
Contract
.ThrowIfNull(documentationComment);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
29
Contract
.ThrowIfNull(node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (5)
22
Contract
.ThrowIfFalse(IsBodyLevelSymbol(symbol));
23
Contract
.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
62
Contract
.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
66
Contract
.ThrowIfFalse(locations.All(loc => loc.IsInSource));
258
Contract
.ThrowIfTrue(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BuiltinOperatorSymbolKey.cs (1)
48
Contract
.ThrowIfNull(returnTypeSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (2)
86
Contract
.ThrowIfFalse(typeArguments.IsDefault);
91
Contract
.ThrowIfTrue(typeArguments.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
71
Contract
.ThrowIfFalse(parameterTypes.IsDefault);
76
Contract
.ThrowIfTrue(parameterTypes.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (2)
64
Contract
.ThrowIfFalse(typeArguments.IsDefault);
70
Contract
.ThrowIfTrue(typeArguments.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (5)
126
Contract
.ThrowIfNull(result);
417
Contract
.ThrowIfTrue(_methodSymbolStack.Count == 0);
418
Contract
.ThrowIfFalse(Equals(method, _methodSymbolStack[^1]));
433
Contract
.ThrowIfTrue(_contextualSymbolStack.Count == 0);
434
Contract
.ThrowIfFalse(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
518
Contract
.ThrowIfTrue(_methodSymbolStack.Count == 0);
519
Contract
.ThrowIfFalse(method.Equals(_methodSymbolStack[^1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
15
Contract
.ThrowIfFalse(symbol.TypeParameterKind == TypeParameterKind.Method);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\TestHooks\TaskExtensions.cs (2)
53
Contract
.ThrowIfNull(task, nameof(task));
90
Contract
.ThrowIfNull(task, nameof(task));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (1)
103
Contract
.ThrowIfNull(ra.Data);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (12)
115
Contract
.ThrowIfNull(asynchronousComputeFunction);
139
Contract
.ThrowIfTrue(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!");
152
Contract
.ThrowIfFalse(Monitor.IsEntered(asyncLazy.SyncObject));
161
Contract
.ThrowIfTrue(_asynchronousComputationCancellationSource != null &&
165
Contract
.ThrowIfTrue(_requests != null &&
170
Contract
.ThrowIfTrue(_requests != null &&
174
Contract
.ThrowIfTrue(_cachedResult != null &&
179
Contract
.ThrowIfTrue(_asynchronousComputeFunction == null && _synchronousComputeFunction != null);
259
Contract
.ThrowIfNull(_synchronousComputeFunction);
311
Contract
.ThrowIfNull(_cachedResult, $"We called {nameof(CompleteWithTask)} with a result, there should be a cached result.");
376
Contract
.ThrowIfTrue(_computationActive);
377
Contract
.ThrowIfNull(_asynchronousComputeFunction);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (7)
53
Contract
.ThrowIfNull(concatenatedLowerCaseWords, nameof(_concatenatedLowerCaseWords));
54
Contract
.ThrowIfTrue(nodes.IsDefault, $"{nameof(nodes)}.{nameof(nodes.IsDefault)}");
55
Contract
.ThrowIfTrue(edges.IsDefault, $"{nameof(edges)}.{nameof(edges.IsDefault)}");
66
Contract
.ThrowIfNull(value, nameof(value));
67
Contract
.ThrowIfNull(_concatenatedLowerCaseWords, nameof(_concatenatedLowerCaseWords));
68
Contract
.ThrowIfTrue(_nodes.IsDefault, $"{nameof(_nodes)}.{nameof(_nodes.IsDefault)}");
69
Contract
.ThrowIfTrue(_edges.IsDefault, $"{nameof(_edges)}.{nameof(_edges.IsDefault)}");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (15)
48
Contract
.ThrowIfNull(root);
49
Contract
.ThrowIfFalse(spans.Count > 0);
84
Contract
.ThrowIfNull(root);
85
Contract
.ThrowIfTrue(textSpan.IsEmpty);
124
Contract
.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart);
148
Contract
.ThrowIfNull(tree);
149
Contract
.ThrowIfTrue(token.RawKind == 0);
170
Contract
.ThrowIfTrue(token1.RawKind == 0 && token2.RawKind == 0);
171
Contract
.ThrowIfTrue(token1.Equals(token2));
286
Contract
.ThrowIfFalse(backwardPosition < parentNode.FullSpan.End);
290
Contract
.ThrowIfTrue(nextToken.RawKind == 0);
311
Contract
.ThrowIfNull(parentNode);
312
Contract
.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition);
316
Contract
.ThrowIfTrue(previousToken.RawKind == 0);
360
Contract
.ThrowIfNull(root);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\FixedSizeArrayBuilder.cs (5)
52
Contract
.ThrowIfTrue(_index + values.Length > _values.Length);
59
Contract
.ThrowIfTrue(_index + values.Count > _values.Length);
66
Contract
.ThrowIfTrue(_index + values.Count > _values.Length);
73
Contract
.ThrowIfTrue(_index + values.Count > _values.Length);
107
Contract
.ThrowIfTrue(_index != _values.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
172
=>
Contract
.ThrowIfFalse(LockHeldByMe());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ReferenceCountedDisposable.cs (1)
292
Contract
.ThrowIfNull(weakInstance);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (8)
89
Contract
.ThrowIfNull(continuationAction, nameof(continuationAction));
108
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
122
Contract
.ThrowIfNull(continuationAction, nameof(continuationAction));
154
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
199
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
318
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
381
Contract
.ThrowIfFalse(task.IsCompleted);
397
Contract
.ThrowIfFalse(task.IsCompleted);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ValueTaskExtensions.cs (1)
21
Contract
.ThrowIfFalse(task.IsCompleted, message);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (5)
80
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
121
Contract
.ThrowIfNull(finalNode);
151
Contract
.ThrowIfNull(field.ConstantValue);
174
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
190
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
181
Contract
.ThrowIfNull(attribute);
199
Contract
.ThrowIfTrue(availableIndices != null && availableIndices.Count != declarationList.Count + 1);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationOptionsProviders.cs (1)
43
Contract
.ThrowIfNull(document.Project.ParseOptions);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\SyntaxAnnotationExtensions.cs (1)
18
Contract
.ThrowIfFalse(symbol is CodeGenerationSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
135
Contract
.ThrowIfFalse(document.SupportsSemanticModel);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
422
Contract
.ThrowIfNull(type);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
554
Contract
.ThrowIfFalse(syntaxFacts.IsNotPattern(pattern));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (2)
50
Contract
.ThrowIfFalse(textDocument is AdditionalDocument);
59
Contract
.ThrowIfFalse(textDocument is AnalyzerConfigDocument);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
36
Contract
.ThrowIfNull(firstNonWhitespacePos);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
185
Contract
.ThrowIfFalse(nodesAndTokensToReduce.Any());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (1)
66
Contract
.ThrowIfNull(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
74
Contract
.ThrowIfFalse(Id == oldDocument.Id);
Storage\SQLite\v2\Interop\SqlConnection.cs (2)
55
Contract
.ThrowIfFalse(wrote == length);
316
Contract
.ThrowIfFalse(MemoryMarshal.TryRead(bytes, out Checksum result));
Storage\SQLite\v2\Interop\SqlStatement.cs (1)
84
Contract
.ThrowIfFalse(Encoding.UTF8.GetBytes(value.AsSpan(), bytes) == utf8ByteCount);
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (6)
152
Contract
.ThrowIfTrue(optional.HasValue && optional.Value == null);
166
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ConcurrentScheduler);
225
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ExclusiveScheduler);
290
Contract
.ThrowIfTrue(exception != null);
307
Contract
.ThrowIfTrue(exception != null);
364
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage.cs (3)
100
Contract
.ThrowIfNull(solutionKey.FilePath);
148
Contract
.ThrowIfNull(directoryName);
158
Contract
.ThrowIfNull(directory);
Storage\SQLite\v2\SQLitePersistentStorage_FlushWrites.cs (1)
35
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (3)
49
Contract
.ThrowIfFalse(
68
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Scheduler.ExclusiveScheduler);
134
Contract
.ThrowIfTrue(id == -1);
Storage\SQLite\v2\SQLitePersistentStorageService.cs (1)
64
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath));
TemporaryStorage\TemporaryStorageService.cs (2)
176
Contract
.ThrowIfNull(storageIdentifier.Name, $"{nameof(GetStreamHandle)} should only be called for VS on Windows (where named memory mapped files as supported)");
187
Contract
.ThrowIfNull(storageIdentifier.Name, $"{nameof(GetTextHandle)} should only be called for VS on Windows (where named memory mapped files as supported)");
Utilities\Documentation\XmlDocumentationProvider.cs (2)
106
Contract
.ThrowIfNull(xmlDocCommentBytes);
155
Contract
.ThrowIfNull(filePath);
Utilities\TaskQueue.cs (2)
24
Contract
.ThrowIfNull(operationListener);
25
Contract
.ThrowIfNull(taskScheduler);
Workspace\DocumentActiveContextChangedEventArgs.cs (4)
22
Contract
.ThrowIfNull(solution);
23
Contract
.ThrowIfNull(sourceTextContainer);
24
Contract
.ThrowIfNull(oldActiveContextDocumentId);
25
Contract
.ThrowIfNull(newActiveContextDocumentId);
Workspace\DocumentEventArgs.cs (1)
18
Contract
.ThrowIfNull(document);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
33
Contract
.ThrowIfFalse(mappedSpanResults.Length == textChanges.Length);
Workspace\Host\EventListener\EventListenerTracker.cs (1)
30
Contract
.ThrowIfNull(workspace.Kind);
Workspace\Host\PersistentStorage\IPersistentStorageConfiguration.cs (1)
54
Contract
.ThrowIfNull(fileName);
Workspace\IsolatedAnalyzerReferenceSet.Core.cs (4)
110
Contract
.ThrowIfTrue(s_gate.CurrentCount != 0, "Lock must be held");
152
Contract
.ThrowIfTrue(_analyzerReferences.ContainsKey(checksum));
153
Contract
.ThrowIfTrue(s_gate.CurrentCount != 0, "Lock must be held");
178
Contract
.ThrowIfTrue(HasConflict(filePath, mvid));
Workspace\ProjectSystem\FileWatchedPortableExecutableReferenceFactory.cs (1)
160
Contract
.ThrowIfFalse(newRefCount >= 0, "Ref count cannot be negative");
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (5)
200
Contract
.ThrowIfNull(documentInfo.FilePath);
466
Contract
.ThrowIfFalse(_documentIdToDynamicFileInfoProvider.TryGetValue(documentId, out var fileInfoProvider));
481
Contract
.ThrowIfNull(fileInfo, "We previously received a dynamic file for this path, and we're responding to a change, so we expect to get a new one.");
576
Contract
.ThrowIfNull(documentInfo.FilePath, "We shouldn't be adding documents without file paths.");
612
Contract
.ThrowIfTrue(folders.IsDefault);
Workspace\ProjectSystem\ProjectSystemProject.cs (4)
772
Contract
.ThrowIfTrue(analyzersRemoved.Count == 0 && analyzersAdded.Count == 0, "Should only be called when there is work to do");
956
Contract
.ThrowIfNull(providerForFileInfo);
1395
Contract
.ThrowIfNull(originalMetadataReferences);
1396
Contract
.ThrowIfNull(originalAnalyzerReferences);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (13)
207
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
214
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
308
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
355
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
383
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
422
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
447
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
451
Contract
.ThrowIfFalse(_projectUpdateState.ProjectReferenceInfos.Count == 0);
452
Contract
.ThrowIfFalse(_projectToMaxSupportedLangVersionMap.Count == 0);
453
Contract
.ThrowIfFalse(_projectToDependencyNodeTargetIdentifier.Count == 0);
603
Contract
.ThrowIfNull(projectWithMetadataReference);
604
Contract
.ThrowIfNull(referencedProject);
850
Contract
.ThrowIfTrue(oldAnalyzerFilePath != newAnalyzerFilePath);
Workspace\ProjectSystem\ProjectSystemProjectOptionsProcessor.cs (1)
231
Contract
.ThrowIfNull(sender);
Workspace\Solution\Checksum.cs (2)
57
Contract
.ThrowIfFalse(MemoryMarshal.TryRead(checksum, out Checksum result));
88
Contract
.ThrowIfTrue(span.Length < HashSize);
Workspace\Solution\ChecksumCollection.cs (3)
70
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksums));
82
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksums));
97
Contract
.ThrowIfFalse(values.Count == checksums.Children.Length);
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\Document.cs (2)
357
Contract
.ThrowIfNull(result);
558
Contract
.ThrowIfNull(_cachedOptions);
Workspace\Solution\DocumentState.cs (8)
49
Contract
.ThrowIfFalse(ParseOptions is null == TreeSource is null);
74
Contract
.ThrowIfNull(options);
174
Contract
.ThrowIfNull(tree);
246
Contract
.ThrowIfNull(newTree);
341
Contract
.ThrowIfFalse(SupportsSyntaxTree);
403
Contract
.ThrowIfTrue(ReferenceEquals(newAttributes, Attributes));
518
Contract
.ThrowIfNull(ParseOptions);
674
Contract
.ThrowIfFalse(existingId == id);
Workspace\Solution\DocumentState_LinkedFileReuse.cs (1)
78
Contract
.ThrowIfNull(siblingTreeSource);
Workspace\Solution\Project.cs (2)
36
Contract
.ThrowIfNull(solution);
37
Contract
.ThrowIfNull(projectState);
Workspace\Solution\ProjectCone.cs (1)
22
Contract
.ThrowIfFalse(projectIds.Contains(rootProjectId));
Workspace\Solution\ProjectDependencyGraph.cs (3)
96
Contract
.ThrowIfNull(transitiveReferencesMap);
97
Contract
.ThrowIfNull(reverseTransitiveReferencesMap);
133
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_AddProjectReference.cs (1)
17
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveAllProjectReferences.cs (1)
15
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveProject.cs (1)
14
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveProjectReference.cs (2)
15
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
16
Contract
.ThrowIfFalse(_referencesMap[projectId].Contains(referencedProjectId));
Workspace\Solution\ProjectReference.cs (1)
21
Contract
.ThrowIfNull(projectId);
Workspace\Solution\ProjectState.cs (7)
97
Contract
.ThrowIfNull(projectInfo);
98
Contract
.ThrowIfNull(languageServices);
355
Contract
.ThrowIfNull(projectDirectory);
965
Contract
.ThrowIfTrue(oldDocuments.IsEmpty);
966
Contract
.ThrowIfFalse(oldDocuments.Length == newDocuments.Length);
991
Contract
.ThrowIfTrue(oldDocuments.IsEmpty);
992
Contract
.ThrowIfFalse(oldDocuments.Length == newDocuments.Length);
Workspace\Solution\Solution.cs (7)
95
Contract
.ThrowIfTrue(this.WorkspaceKind == CodeAnalysis.WorkspaceKind.RemoteWorkspace, "Access .Workspace off of a RemoteWorkspace Solution is not supported.");
157
Contract
.ThrowIfNull(state);
251
Contract
.ThrowIfNull(documentId);
266
Contract
.ThrowIfNull(documentId);
328
Contract
.ThrowIfNull(generatedDocument, "The call to GetDocumentState found a SourceGeneratedDocumentState, so we should have found it now.");
1543
Contract
.ThrowIfTrue(solution._documentIdToFrozenSolution.Count != 0);
1624
Contract
.ThrowIfNull(newDocumentState, "Because we just froze this document, it should always exist.");
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (5)
94
Contract
.ThrowIfTrue(pendingTranslationActions is null);
105
Contract
.ThrowIfTrue(this.CompilationWithoutGeneratedDocuments.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
182
Contract
.ThrowIfNull(finalCompilationWithGeneratedDocuments);
205
Contract
.ThrowIfTrue(compilationWithoutGeneratedDocuments.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
272
Contract
.ThrowIfNull(projectId);
Workspace\Solution\SolutionCompilationState.cs (7)
77
Contract
.ThrowIfTrue(projectCone != null);
107
Contract
.ThrowIfTrue(_projectIdToTrackerMap.Any(kvp => kvp.Key != kvp.Value.ProjectState.Id));
110
Contract
.ThrowIfFalse(this.SolutionState.ProjectStates
1092
Contract
.ThrowIfNull(projectState);
1289
Contract
.ThrowIfFalse(trackerMap.TryGetValue(projectId, out var existingTracker));
1322
Contract
.ThrowIfFalse(FrozenSourceGeneratedDocumentStates == null, $"We shouldn't be calling {nameof(WithFrozenSourceGeneratedDocuments)} on a solution with frozen source generated documents.");
1477
Contract
.ThrowIfFalse(newIdToProjectStateMapBuilder.ContainsKey(projectId));
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (8)
63
Contract
.ThrowIfNull(project);
132
Contract
.ThrowIfTrue(forkedTrackerState is FinalCompilationTrackerState);
133
Contract
.ThrowIfFalse(forkedTrackerState is null or InProgressState);
202
Contract
.ThrowIfNull(compilation);
403
Contract
.ThrowIfTrue(inProgressState.PendingTranslationActions.IsEmpty);
474
Contract
.ThrowIfTrue(inProgressState.PendingTranslationActions.Count > 0);
539
Contract
.ThrowIfFalse(creationPolicy.SkeletonReferenceCreationPolicy is SkeletonReferenceCreationPolicy.CreateIfAbsent or SkeletonReferenceCreationPolicy.DoNotCreate);
986
/// This is just the same as <see cref="
Contract
.ThrowIfFalse(bool, string, int, string)"/> but throws a custom exception type to make this easier to find in telemetry since the exception type
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (11)
123
Contract
.ThrowIfFalse(documentId.IsSourceGenerated);
176
Contract
.ThrowIfTrue(generatedSources.Length != documentsToAddOrUpdate.Count);
184
Contract
.ThrowIfFalse(documentId.IsSourceGenerated);
203
Contract
.ThrowIfTrue(generatedDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
210
Contract
.ThrowIfTrue(existingDocument.Identity != documentIdentity, "Identities must match!");
211
Contract
.ThrowIfTrue(existingDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
245
Contract
.ThrowIfNull(generatorDriver);
268
Contract
.ThrowIfNull(generatorDriver);
412
Contract
.ThrowIfNull(stateMember);
414
Contract
.ThrowIfNull(additionalTextsMember);
418
Contract
.ThrowIfFalse(additionalTexts.Length == projectState.AdditionalDocumentStates.Count);
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
82
Contract
.ThrowIfNull(syntaxTree);
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (1)
243
Contract
.ThrowIfNull(this.NewProjectState.CompilationOptions);
Workspace\Solution\SolutionCompilationState_Checksum.cs (2)
76
Contract
.ThrowIfNull(projectId);
86
Contract
.ThrowIfNull(projectCone);
Workspace\Solution\SolutionCompilationState_SourceGenerators.cs (2)
68
Contract
.ThrowIfFalse(projectState.SupportsCompilation);
74
Contract
.ThrowIfNull(map);
Workspace\Solution\SolutionState.cs (10)
154
Contract
.ThrowIfFalse(ProjectStates.Count == ProjectIds.Count);
155
Contract
.ThrowIfFalse(ProjectStates.Count == _dependencyGraph.ProjectIds.Count);
316
Contract
.ThrowIfNull(result);
325
Contract
.ThrowIfTrue(projectInfos.HasDuplicates(static p => p.Id), "Duplicate ProjectId provided");
426
Contract
.ThrowIfTrue(projectIds.HasDuplicates(), "Duplicate ProjectId provided");
468
Contract
.ThrowIfFalse(amount is -1 or +1);
497
Contract
.ThrowIfFalse(newCount == 0);
1154
Contract
.ThrowIfFalse(ProjectStates.ContainsKey(projectId));
1239
Contract
.ThrowIfTrue(documentId.ProjectId == relatedProjectIdHint);
1267
Contract
.ThrowIfTrue(relatedProject == projectState);
Workspace\Solution\SolutionState_Checksum.cs (1)
75
Contract
.ThrowIfNull(projectId);
Workspace\Solution\SourceGeneratedDocumentIdentity.cs (1)
28
Contract
.ThrowIfFalse(documentId.IsSourceGenerated);
Workspace\Solution\StateChecksums.cs (14)
31
Contract
.ThrowIfFalse(frozenSourceGeneratedDocumentIdentities.HasValue == frozenSourceGeneratedDocuments.HasValue);
32
Contract
.ThrowIfFalse(frozenSourceGeneratedDocumentIdentities?.Count == frozenSourceGeneratedDocuments?.Length);
112
Contract
.ThrowIfFalse(result.Checksum == checksum);
143
Contract
.ThrowIfFalse(FrozenSourceGeneratedDocumentIdentities.HasValue);
144
Contract
.ThrowIfFalse(FrozenSourceGeneratedDocuments.HasValue);
168
Contract
.ThrowIfFalse(compilationState.FrozenSourceGeneratedDocumentStates.TryGetState(documentId, out var state));
182
Contract
.ThrowIfFalse(compilationState.FrozenSourceGeneratedDocumentStates.TryGetState(id, out var state));
196
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(out var solutionChecksums));
202
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(projectCone.RootProjectId, out var solutionChecksums));
274
Contract
.ThrowIfFalse(result.Checksum == checksum);
314
Contract
.ThrowIfTrue(
445
Contract
.ThrowIfFalse(result.Checksum == checksum);
459
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksum));
460
Contract
.ThrowIfFalse(this == stateChecksum);
Workspace\Solution\TextDocument.cs (2)
27
Contract
.ThrowIfNull(project);
28
Contract
.ThrowIfNull(state);
Workspace\Solution\TextDocumentStates.cs (1)
224
Contract
.ThrowIfTrue(!ignoreUnchangedContent && ignoreUnchangeableDocuments);
Workspace\Solution\VersionSource\LoadableTextAndVersionSource.cs (1)
88
Contract
.ThrowIfTrue(_gate.CurrentCount != 0);
Workspace\Solution\VersionSource\RecoverableTextAndVersion.cs (4)
160
Contract
.ThrowIfTrue(source is LoadableTextAndVersionSource { CacheResult: true });
173
Contract
.ThrowIfNull(_storageHandle);
183
Contract
.ThrowIfNull(_storageHandle);
193
Contract
.ThrowIfFalse(_storageHandle == null); // Cannot save more than once
Workspace\Solution\VersionSource\RecoverableTextAndVersion.RecoverableText.cs (1)
134
Contract
.ThrowIfTrue(Gate.CurrentCount != 0);
Workspace\TextExtensions.cs (1)
90
Contract
.ThrowIfFalse(solution.ContainsAnalyzerConfigDocument(id));
Workspace\Workspace.cs (9)
345
Contract
.ThrowIfTrue(relatedDocumentId == addedDocumentId);
348
Contract
.ThrowIfTrue(relatedDocumentId.ProjectId == addedDocumentId.ProjectId);
495
Contract
.ThrowIfNull(transformation);
1287
Contract
.ThrowIfNull(newDocument);
1660
Contract
.ThrowIfNull(projectChanges.OldProject.CompilationOptions);
1661
Contract
.ThrowIfNull(projectChanges.NewProject.CompilationOptions);
1990
Contract
.ThrowIfTrue(changes.GetAddedProjects().Any());
1991
Contract
.ThrowIfTrue(changes.GetRemovedProjects().Any());
1992
Contract
.ThrowIfTrue(changes.GetProjectChanges().Any());
Workspace\Workspace_Editor.cs (7)
271
Contract
.ThrowIfNull(currentContextId, "The document is open, so we should have had some context ID.");
473
Contract
.ThrowIfFalse(_openSourceGeneratedDocumentIdentities.Remove(document.Id));
800
Contract
.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
808
Contract
.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
826
Contract
.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
830
Contract
.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
854
Contract
.ThrowIfFalse(doc.TryGetText(out var text));