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