173 references to ThrowIfFalse
Microsoft.CodeAnalysis.Workspaces (173)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (2)
135Contract.ThrowIfFalse(currentOld.FullSpan.Start == currentNew.FullSpan.Start); 190Contract.ThrowIfFalse((oldRoot.FullSpan.End - currentOld.FullSpan.End) ==
CodeActions\CodeAction.cs (1)
196Contract.ThrowIfFalse(provider is CodeFixProvider or CodeRefactoringProvider);
CodeActions\CodeAction_Cleanup.cs (1)
49Contract.ThrowIfFalse(document.SupportsSyntaxTree);
CodeCleanup\AbstractCodeCleanerService.cs (1)
213Contract.ThrowIfFalse(hasMultiplePreviousToken || hasMultipleNextToken);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
57Contract.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (1)
79Contract.ThrowIfFalse(
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (1)
84Contract.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
Diagnostics\CompilationWithAnalyzersPair.cs (2)
26Contract.ThrowIfFalse(projectCompilationWithAnalyzers.AnalysisOptions.ReportSuppressedDiagnostics == hostCompilationWithAnalyzers.AnalysisOptions.ReportSuppressedDiagnostics); 27Contract.ThrowIfFalse(projectCompilationWithAnalyzers.AnalysisOptions.ConcurrentAnalysis == hostCompilationWithAnalyzers.AnalysisOptions.ConcurrentAnalysis);
Diagnostics\DocumentAnalysisScope.cs (1)
56Contract.ThrowIfFalse(TextDocument is AdditionalDocument);
FindSymbols\FindReferences\DependentProjectsFinder.cs (2)
312Contract.ThrowIfFalse(project.SupportsCompilation); 325Contract.ThrowIfFalse(project.SupportsCompilation);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
591Contract.ThrowIfFalse(notNullOriginalUnreducedSymbol2.GetOriginalUnreducedDefinition().Equals(notNullOriginalUnreducedSymbol2));
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (1)
198Contract.ThrowIfFalse(symbolToGroup.ContainsKey(symbol));
FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (1)
25Contract.ThrowIfFalse(x.Document == y.Document);
FindSymbols\Shared\AbstractSyntaxIndex.cs (1)
122Contract.ThrowIfFalse(document.SupportsSyntaxTree);
FindSymbols\SymbolFinder_Helpers.cs (3)
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));
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (1)
25Contract.ThrowIfFalse(fixAllScope is FixAllScope.ContainingMember or FixAllScope.ContainingType);
Notification\AbstractGlobalOperationNotificationService.cs (3)
36Contract.ThrowIfFalse(_registrations.Count == 0); 69Contract.ThrowIfFalse(_operations.Count == 1); 82Contract.ThrowIfFalse(result);
Remote\ExportRemoteServiceCallbackDispatcherAttribute.cs (1)
20Contract.ThrowIfFalse(serviceInterface.IsInterface);
Rename\RenameUtilities.cs (1)
101Contract.ThrowIfFalse(isSubset);
Serialization\SerializableSourceText.cs (1)
181Contract.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
Serialization\SerializerService.cs (2)
206Contract.ThrowIfFalse(count <= 2); 214Contract.ThrowIfFalse(language is LanguageNames.CSharp or LanguageNames.VisualBasic);
Serialization\SerializerService_Reference.cs (6)
168Contract.ThrowIfFalse(TryGetAnalyzerImageReferenceFromGuid(guid, out var analyzerImageReference)); 276Contract.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile); 393Contract.ThrowIfFalse(metadataKind == MetadataImageKind.Module); 405Contract.ThrowIfFalse(metadataKind == MetadataImageKind.Module); 415Contract.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile); 453Contract.ThrowIfFalse(storageHandle.Identifier.Size == unmanagedStream.Length);
Shared\Extensions\IMethodSymbolExtensions.cs (1)
21Contract.ThrowIfFalse(delegateType.TypeKind == TypeKind.Delegate);
Shared\Extensions\SourceTextExtensions.cs (2)
222Contract.ThrowIfFalse(offset == length); 281Contract.ThrowIfFalse(offset == length);
Shared\TestHooks\AsynchronousOperationListener.cs (3)
114Contract.ThrowIfFalse(_gate.LockHeldByMe()); 120Contract.ThrowIfFalse(_gate.LockHeldByMe()); 185Contract.ThrowIfFalse(TrackActiveTokens);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
248Contract.ThrowIfFalse(rightMaxEndValue > leftMaxEndValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
167Contract.ThrowIfFalse(context.FilterSpan.HasValue); 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\ISymbolExtensions.cs (1)
549Contract.ThrowIfFalse(symbol.IsNormalAnonymousType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (4)
209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 210Contract.ThrowIfFalse(tabSize > 0); 218Contract.ThrowIfFalse(column >= 0); 219Contract.ThrowIfFalse(tabSize > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
299Contract.ThrowIfFalse(nodes.Any());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (1)
414Contract.ThrowIfFalse(intervals.Length == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (5)
52Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 85Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 123Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 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 (1)
76Contract.ThrowIfFalse(line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.cs (3)
92Contract.ThrowIfFalse(space >= 0); 111Contract.ThrowIfFalse(lineBreaks >= 0); 112Contract.ThrowIfFalse(indentation >= 0);
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\TokenData.cs (2)
31Contract.ThrowIfFalse((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount)); 64Contract.ThrowIfFalse(this.TokenStream == other.TokenStream);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenPairWithOperations.cs (1)
30Contract.ThrowIfFalse(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (6)
138Contract.ThrowIfFalse(0 <= index && index < this.TokenCount); 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);
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 (1)
18Contract.ThrowIfFalse(root.GetFirstToken(includeZeroWidth: true).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\IndentBlockOperation.cs (4)
17Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask)); 36Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask)); 38Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask)); 39Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
76Contract.ThrowIfFalse(lineBreaks >= 0); 77Contract.ThrowIfFalse(spaces >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
66Contract.ThrowIfFalse(locations.All(loc => loc.IsInSource));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (2)
418Contract.ThrowIfFalse(Equals(method, _methodSymbolStack[^1])); 434Contract.ThrowIfFalse(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
525Contract.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\Utilities\AsyncLazy`1.cs (1)
152Contract.ThrowIfFalse(Monitor.IsEntered(asyncLazy.SyncObject));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (4)
49Contract.ThrowIfFalse(spans.Count > 0); 124Contract.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart); 286Contract.ThrowIfFalse(backwardPosition < parentNode.FullSpan.End); 312Contract.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
172=> Contract.ThrowIfFalse(LockHeldByMe());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (2)
381Contract.ThrowIfFalse(task.IsCompleted); 397Contract.ThrowIfFalse(task.IsCompleted);
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_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\Simplification\AbstractSimplificationService.cs (1)
185Contract.ThrowIfFalse(nodesAndTokensToReduce.Any());
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)
91Contract.ThrowIfFalse(Encoding.UTF8.GetBytes(charsPtr, value.Length, bytesPtr, utf8ByteCount) == utf8ByteCount);
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (3)
166Contract.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ConcurrentScheduler); 225Contract.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ExclusiveScheduler); 364Contract.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_FlushWrites.cs (1)
35Contract.ThrowIfFalse(TaskScheduler.Current == this.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (2)
49Contract.ThrowIfFalse( 68Contract.ThrowIfFalse(TaskScheduler.Current == this.Scheduler.ExclusiveScheduler);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
33Contract.ThrowIfFalse(mappedSpanResults.Length == textChanges.Length);
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (1)
466Contract.ThrowIfFalse(_documentIdToDynamicFileInfoProvider.TryGetValue(documentId, out var fileInfoProvider));
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (10)
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);
Workspace\Solution\Checksum.cs (1)
57Contract.ThrowIfFalse(MemoryMarshal.TryRead(checksum, out Checksum result));
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\DocumentState.cs (3)
49Contract.ThrowIfFalse(ParseOptions is null == TreeSource is null); 341Contract.ThrowIfFalse(SupportsSyntaxTree); 674Contract.ThrowIfFalse(existingId == id);
Workspace\Solution\ProjectCone.cs (1)
22Contract.ThrowIfFalse(projectIds.Contains(rootProjectId));
Workspace\Solution\ProjectDependencyGraph.cs (1)
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\ProjectState.cs (2)
966Contract.ThrowIfFalse(oldDocuments.Length == newDocuments.Length); 992Contract.ThrowIfFalse(oldDocuments.Length == newDocuments.Length);
Workspace\Solution\SolutionCompilationState.cs (1)
110Contract.ThrowIfFalse(this.SolutionState.ProjectStates
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (2)
133Contract.ThrowIfFalse(forkedTrackerState is null or InProgressState); 539Contract.ThrowIfFalse(creationPolicy.SkeletonReferenceCreationPolicy is SkeletonReferenceCreationPolicy.CreateIfAbsent or SkeletonReferenceCreationPolicy.DoNotCreate);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (1)
418Contract.ThrowIfFalse(additionalTexts.Length == projectState.AdditionalDocumentStates.Count);
Workspace\Solution\SolutionState.cs (5)
154Contract.ThrowIfFalse(ProjectStates.Count == ProjectIds.Count); 155Contract.ThrowIfFalse(ProjectStates.Count == _dependencyGraph.ProjectIds.Count); 468Contract.ThrowIfFalse(amount is -1 or +1); 497Contract.ThrowIfFalse(newCount == 0); 1154Contract.ThrowIfFalse(ProjectStates.ContainsKey(projectId));
Workspace\Solution\SourceGeneratedDocumentIdentity.cs (1)
28Contract.ThrowIfFalse(documentId.IsSourceGenerated);
Workspace\Solution\StateChecksums.cs (12)
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); 445Contract.ThrowIfFalse(result.Checksum == checksum); 460Contract.ThrowIfFalse(this == stateChecksum);
Workspace\Solution\VersionSource\RecoverableTextAndVersion.cs (1)
193Contract.ThrowIfFalse(_storageHandle == null); // Cannot save more than once
Workspace\TextExtensions.cs (1)
90Contract.ThrowIfFalse(solution.ContainsAnalyzerConfigDocument(id));
Workspace\Workspace_Editor.cs (6)
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));