560 references to ThrowIfFalse
Microsoft.CodeAnalysis.CSharp.EditorFeatures (6)
StringCopyPaste\AbstractPasteProcessor.cs (2)
145Contract.ThrowIfFalse(IsAnyRawStringExpression(StringExpressionBeforePaste)); 160Contract.ThrowIfFalse(IsAnyRawStringExpression(StringExpressionBeforePaste));
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
94Contract.ThrowIfFalse(_threadingContext.HasMainThread);
StringCopyPaste\StringCopyPasteCommandHandler_CutCopy.cs (1)
49Contract.ThrowIfFalse(_threadingContext.HasMainThread);
StringCopyPaste\StringInfo.cs (2)
134Contract.ThrowIfFalse(SyntaxFacts.IsNewLine(text[rawStart])); 149Contract.ThrowIfFalse(SyntaxFacts.IsNewLine(text[rawEnd - 1]));
Microsoft.CodeAnalysis.CSharp.Features (41)
ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
105Contract.ThrowIfFalse(_assignmentTarget is IdentifierNameSyntax);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (2)
198Contract.ThrowIfFalse(span.IntersectsWith(token.Span)); 199Contract.ThrowIfFalse(token.Kind() == SyntaxKind.StringLiteralToken);
CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
53Contract.ThrowIfFalse(nodes.Any());
CSharpUpgradeProjectCodeFixProvider.cs (2)
95Contract.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion)); 109Contract.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion));
CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
59Contract.ThrowIfFalse(CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.GetWhenTrueAssignment(
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
1167Contract.ThrowIfFalse(node.Parent is (kind:
EditAndContinue\SyntaxComparer.cs (1)
914Contract.ThrowIfFalse(rightName.HasValue == leftName.HasValue);
ExtractMethod\CSharpMethodExtractor.cs (1)
40Contract.ThrowIfFalse(originalSpanStart >= 0);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (9)
52Contract.ThrowIfFalse(_firstStatementOrFieldToReplace.Parent == _lastStatementOrFieldToReplace.Parent 72Contract.ThrowIfFalse(variable.Initializer == null); 305Contract.ThrowIfFalse(firstIndex >= 0); 308Contract.ThrowIfFalse(lastIndex >= 0); 310Contract.ThrowIfFalse(firstIndex <= lastIndex); 333Contract.ThrowIfFalse(firstMemberIndex >= 0); 336Contract.ThrowIfFalse(lastMemberIndex >= 0); 338Contract.ThrowIfFalse(firstMemberIndex <= lastMemberIndex); 377Contract.ThrowIfFalse(_firstStatementOrFieldToReplace == _lastStatementOrFieldToReplace);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (3)
88Contract.ThrowIfFalse(SemanticDocument == selectionResult.SemanticDocument); 133Contract.ThrowIfFalse(firstStatementToRemove.Parent == lastStatementToRemove.Parent 218Contract.ThrowIfFalse(declStatement.Parent.IsStatementContainerNode());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (2)
101Contract.ThrowIfFalse(IsExtractMethodOnExpression(CSharpSelectionResult)); 162Contract.ThrowIfFalse(container.IsStatementContainerNode() ||
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs (2)
50Contract.ThrowIfFalse(CSharpSyntaxFacts.Instance.AreStatementsInSameContainer(firstUnderContainer, lastUnderContainer)); 113Contract.ThrowIfFalse(node.IsStatementContainerNode());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.SingleStatementCodeGenerator.cs (1)
49Contract.ThrowIfFalse(IsExtractMethodOnSingleStatement(CSharpSelectionResult));
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
129Contract.ThrowIfFalse(keyValuePair.Value.Count > 0);
ExtractMethod\CSharpSelectionResult.cs (4)
128Contract.ThrowIfFalse(CSharpSyntaxFacts.Instance.AreStatementsInSameContainer(statement, firstStatementUnderContainer)); 135Contract.ThrowIfFalse(SelectionInExpression); 173Contract.ThrowIfFalse(last.IsParentKind(SyntaxKind.GlobalStatement)); 174Contract.ThrowIfFalse(last.Parent.IsParentKind(SyntaxKind.CompilationUnit));
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
42Contract.ThrowIfFalse(SelectionInExpression);
ExtractMethod\CSharpSelectionValidator.cs (1)
509Contract.ThrowIfFalse(line.LineNumber > 0);
InlineHints\CSharpInlineTypeHintsService.cs (1)
135Contract.ThrowIfFalse(displayAllOverride);
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (2)
303Contract.ThrowIfFalse(openBracket.Parent is BracketedArgumentListSyntax && 345Contract.ThrowIfFalse(openBracket.Parent is ArrayRankSpecifierSyntax && openBracket.Parent.Parent is ArrayTypeSyntax);
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
164Contract.ThrowIfFalse(lessThanToken.Parent is TypeArgumentListSyntax && lessThanToken.Parent.Parent is GenericNameSyntax);
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
68Contract.ThrowIfFalse(includeInstance || includeStatic);
Structure\CSharpStructureHelpers.cs (1)
143Contract.ThrowIfFalse(comment.IsSingleLineComment() || comment.IsMultiLineComment());
UseUtf8StringLiteralCodeFixProvider.cs (1)
150Contract.ThrowIfFalse(UseUtf8StringLiteralDiagnosticAnalyzer.TryConvertToUtf8String(builder, initializer.ElementValues));
Microsoft.CodeAnalysis.CSharp.Workspaces (17)
BlockSyntaxExtensions.cs (1)
110Contract.ThrowIfFalse(preference == ExpressionBodyPreference.WhenOnSingleLine);
CSharpTriviaFormatter.cs (1)
225Contract.ThrowIfFalse(multilineCommentTrivia.Count == 1);
CSharpVirtualCharService.cs (3)
140Contract.ThrowIfFalse(tokenText is [.., 'u' or 'U', '8']); 146Contract.ThrowIfFalse(tokenText[0] == '"'); 151Contract.ThrowIfFalse(tokenText[endIndexExclusive - 1] == '"');
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (2)
41Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 45Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken);
NullableSyntaxAnnotationEx.cs (2)
29Contract.ThrowIfFalse(ReferenceEquals(Oblivious, NullableSyntaxAnnotation.Oblivious)); 30Contract.ThrowIfFalse(ReferenceEquals(AnnotatedOrNotAnnotated, NullableSyntaxAnnotation.AnnotatedOrNotAnnotated));
SemanticModelReuse\CSharpSemanticModelReuseLanguageService.cs (2)
35Contract.ThrowIfFalse(accessor.Parent is AccessorListSyntax); 36Contract.ThrowIfFalse(accessor.Parent.Parent is BasePropertyDeclarationSyntax);
Simplification\CSharpSimplificationService.cs (1)
175Contract.ThrowIfFalse(SpeculationAnalyzer.CanSpeculateOnNode(nodeToSpeculate));
TriviaDataFactory.Analyzer.cs (1)
128Contract.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind()));
TriviaDataFactory.ComplexTrivia.cs (1)
63Contract.ThrowIfFalse(triviaList.Count > 0);
TriviaDataFactory.cs (1)
108Contract.ThrowIfFalse(space >= -1);
TriviaDataFactory.ModifiedComplexTrivia.cs (2)
74Contract.ThrowIfFalse(this.SecondTokenIsFirstTokenOnLine); 80Contract.ThrowIfFalse(triviaList.Count > 0);
Microsoft.CodeAnalysis.EditorFeatures (32)
CodeDefinitionWindow\DefinitionContextTracker.cs (4)
71Contract.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread); 85Contract.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread); 100Contract.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread); 107Contract.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
Diagnostics\DiagnosticsSquiggleTaggerProvider.cs (2)
131Contract.ThrowIfFalse(tag1 is RoslynErrorTag); 132Contract.ThrowIfFalse(tag2 is RoslynErrorTag);
Diagnostics\DiagnosticsSuggestionTaggerProvider.cs (2)
67Contract.ThrowIfFalse(tag1 is RoslynErrorTag); 68Contract.ThrowIfFalse(tag2 is RoslynErrorTag);
EditAndContinue\ActiveStatementTrackingService.cs (2)
270Contract.ThrowIfFalse(oldSpan.Flags == newSpan.Flags); 271Contract.ThrowIfFalse(oldSpan.Ordinal == newSpan.Ordinal);
EditorConfigSettings\Data\CodeStyleSetting`1.cs (1)
35Contract.ThrowIfFalse(possibleValues.Length == valueDescriptions.Length);
FindUsages\BufferedFindUsagesContext.cs (1)
62Contract.ThrowIfFalse(_gate.CurrentCount == 0);
InlineRename\AbstractEditorInlineRenameService.InlineRenameReplacementInfo.cs (1)
20Contract.ThrowIfFalse(conflicts.IsSuccessful);
InlineRename\InlineRenameSession.cs (1)
225Contract.ThrowIfFalse(document.TryGetText(out var text));
InlineRename\UndoManagerServiceFactory.cs (1)
54Contract.ThrowIfFalse(textUndoHistoryService.TryGetTextUndoHistory(workspace, subjectBuffer, out var undoHistory));
IntelliSense\AbstractController.cs (1)
110Contract.ThrowIfFalse(IsSessionActive);
IntelliSense\Helpers.cs (1)
262Contract.ThrowIfFalse(lines.Count > 0);
IntelliSense\Session.cs (1)
44Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));
Interactive\InteractiveSession.cs (1)
122Contract.ThrowIfFalse(result.InitializationResult != null);
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (1)
387Contract.ThrowIfFalse(_refCount >= 0);
Shared\Extensions\IThreadingContextExtensions.cs (1)
13=> Contract.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
Shared\Utilities\ForegroundThreadAffinitizedObject.cs (2)
32Contract.ThrowIfFalse(threadingContext.HasMainThread); 55Contract.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
Shared\Utilities\VirtualTreePoint.cs (2)
22Contract.ThrowIfFalse(position >= 0 && position <= tree.Length); 23Contract.ThrowIfFalse(virtualSpaces >= 0);
Structure\AbstractStructureTaggerProvider.cs (2)
229Contract.ThrowIfFalse(tag1 is StructureTag); 230Contract.ThrowIfFalse(tag2 is StructureTag);
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ReferenceCounting.cs (3)
40Contract.ThrowIfFalse(_taggers >= 0); 51Contract.ThrowIfFalse(_taggers > 0); 84=> Contract.ThrowIfFalse(Thread.CurrentThread == _thread);
Workspaces\AbstractTextBufferVisibilityTracker.cs (2)
106Contract.ThrowIfFalse(_subjectBufferToCallbacks.TryGetValue(subjectBuffer, out var data)); 107Contract.ThrowIfFalse(data.Callbacks.Contains(callback));
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (6)
Controller.Session.cs (1)
33Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));
Controller.Session_SetModelSelectedItem.cs (1)
39Contract.ThrowIfFalse(model.Items.Contains(selectedItem));
Preview\ICocoaDifferenceViewerExtensions.cs (2)
117Contract.ThrowIfFalse(IsNormal(_width)); 121Contract.ThrowIfFalse(IsNormal(_height));
Preview\PreviewFactoryService.cs (1)
66Contract.ThrowIfFalse(mode == DifferenceViewMode.Inline);
SignatureHelpPresenter.SignatureHelpPresenterSession.cs (1)
166Contract.ThrowIfFalse(_signatureMap.TryGetKey((Signature)eventArgs.NewSelectedSignature, out var helpItem));
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (9)
Workspaces\TestHostDocument.cs (1)
195Contract.ThrowIfFalse(project.Id == this.Id.ProjectId);
Workspaces\TestWorkspace.cs (7)
693Contract.ThrowIfFalse(IsDocumentOpen(documentId)); 711Contract.ThrowIfFalse(IsDocumentOpen(documentId)); 729Contract.ThrowIfFalse(IsDocumentOpen(documentId)); 738Contract.ThrowIfFalse(testDocument.IsSourceGenerated); 746Contract.ThrowIfFalse(testDocument.IsSourceGenerated); 747Contract.ThrowIfFalse(IsDocumentOpen(documentId)); 829Contract.ThrowIfFalse(threadingContext.HasMainThread && threadingContext.JoinableTaskContext.IsOnMainThread);
Workspaces\TestWorkspace_XmlCreation.cs (1)
130Contract.ThrowIfFalse(options.SpecificDiagnosticOptions.IsEmpty);
Microsoft.CodeAnalysis.EditorFeatures.Text (3)
Extensions.SnapshotSourceText.cs (2)
103Contract.ThrowIfFalse(editorSnapshot.TextBuffer == container.GetTextBuffer()); 247Contract.ThrowIfFalse(snapshot == editorSnapshot);
Shared\Extensions\ITextSnapshotLineExtensions.cs (1)
73Contract.ThrowIfFalse(startIndex >= 0);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (18)
Adornments\AbstractAdornmentManager.cs (4)
79Contract.ThrowIfFalse(textView.VisualElement.Dispatcher.CheckAccess()); 110Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess()); 205Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess()); 233Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
BackgroundWorkIndicator\BackgroundWorkIndicatorContext.cs (1)
264Contract.ThrowIfFalse(_scopes.Contains(scope));
BackgroundWorkIndicator\BackgroundWorkIndicatorScope.cs (1)
44Contract.ThrowIfFalse(Monitor.IsEntered(_context.Gate));
InlineDiagnostics\InlineDiagnosticsAdornmentManager.cs (3)
58Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess()); 83Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess()); 109Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
Interactive\InteractiveGlobalUndoServiceFactory.cs (1)
65Contract.ThrowIfFalse(_undoHistoryRegistry.TryGetHistory(textBuffer, out var textUndoHistory));
IWpfDifferenceViewerExtensions.cs (2)
120Contract.ThrowIfFalse(IsNormal(_width)); 124Contract.ThrowIfFalse(IsNormal(_height));
LineSeparators\LineSeparatorAdornmentManager.cs (1)
27Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
Preview\PreviewFactoryService.cs (1)
73Contract.ThrowIfFalse(mode == DifferenceViewMode.Inline);
SignatureHelp\Controller.Session.cs (1)
33Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));
SignatureHelp\Controller.Session_SetModelSelectedItem.cs (1)
39Contract.ThrowIfFalse(model.Items.Contains(selectedItem));
SignatureHelp\Presentation\SignatureHelpPresenter.SignatureHelpPresenterSession.cs (1)
166Contract.ThrowIfFalse(_signatureMap.TryGetKey((Signature)eventArgs.NewSelectedSignature, out var helpItem));
StringIndentation\StringIndentationAdornmentManager.cs (1)
35Contract.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
CodeFixes\CodeFixServiceTests.vb (2)
238Contract.ThrowIfFalse(context.Document.Project.Language = LanguageNames.CSharp) 263Contract.ThrowIfFalse(context.Document.Project.Language = LanguageNames.CSharp)
IntelliSense\SignatureHelpControllerTests.vb (1)
264Roslyn.Utilities.Contract.ThrowIfFalse(s_controllerMocksMap.TryGetValue(controller, result))
Microsoft.CodeAnalysis.ExternalAccess.Razor (3)
RazorCSharpFormattingInteractionService.cs (3)
41Contract.ThrowIfFalse(document.Project.Language is LanguageNames.CSharp); 67Contract.ThrowIfFalse(root.Language is LanguageNames.CSharp); 77Contract.ThrowIfFalse(root.Language is LanguageNames.CSharp);
Microsoft.CodeAnalysis.Features (84)
AbstractForEachCastDiagnosticAnalyzer.cs (1)
67Contract.ThrowIfFalse(option.Value is ForEachExplicitCastInSourcePreference.Always or ForEachExplicitCastInSourcePreference.WhenStronglyTyped);
AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
501Contract.ThrowIfFalse(node.GetRequiredParent().Parent is TExpressionStatementSyntax);
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (1)
28Contract.ThrowIfFalse(fixData.Kind == AddImportFixKind.ReferenceAssemblySymbol);
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (1)
42Contract.ThrowIfFalse(fixData.Kind == AddImportFixKind.PackageSymbol);
AddImport\CodeActions\MetadataSymbolReferenceCodeAction.cs (1)
25Contract.ThrowIfFalse(fixData.Kind == AddImportFixKind.MetadataSymbol);
AddImport\CodeActions\ParentInstallPackageCodeAction.cs (1)
47Contract.ThrowIfFalse(fixData.Kind == AddImportFixKind.PackageSymbol);
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (1)
35Contract.ThrowIfFalse(fixData.Kind == AddImportFixKind.ProjectSymbol);
AddImport\SearchScopes\ProjectSearchScope.cs (1)
25Contract.ThrowIfFalse(project.SupportsCompilation);
CodeFixes\Configuration\ConfigurationUpdater.cs (1)
167Contract.ThrowIfFalse(!string.IsNullOrEmpty(category));
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (1)
238Contract.ThrowIfFalse(batchOfFixes.Any());
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (3)
148Contract.ThrowIfFalse(!diagnostic.IsSuppressed); 167Contract.ThrowIfFalse(diagnostic.Location.IsInSource); 189Contract.ThrowIfFalse(!diagnostic.Location.IsInSource);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (2)
182Contract.ThrowIfFalse(indexOfTriviaToRemoveOrToggle >= 0); 189Contract.ThrowIfFalse(triviaToToggle != default);
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
199Contract.ThrowIfFalse(dotToken.HasValue);
Completion\Providers\Snippets\SnippetCompletionItem.cs (3)
47Contract.ThrowIfFalse(item.Properties.TryGetValue(SnippetIdentifierKey, out var text)); 53Contract.ThrowIfFalse(item.Properties.TryGetValue("Position", out var text)); 54Contract.ThrowIfFalse(int.TryParse(text, out var num));
DiagnosticHelper.cs (1)
197Contract.ThrowIfFalse(indices.All(idx => idx >= 0 && idx < additionalLocationsLength));
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (10)
813Contract.ThrowIfFalse(newExceptionRegions[i].IsDefault); 825Contract.ThrowIfFalse(hasPartner); 862Contract.ThrowIfFalse(statementPart == -1); 2977Contract.ThrowIfFalse(newSymbol is INamedTypeSymbol || IsGlobalMain(newSymbol)); 3024Contract.ThrowIfFalse(editKind == SemanticEditKind.Insert); 3114Contract.ThrowIfFalse(editKind is SemanticEditKind.Update or SemanticEditKind.Insert); 3256Contract.ThrowIfFalse(IsConstructorWithMemberInitializers(oldDeclaration) == IsConstructorWithMemberInitializers(newDeclaration)); 3257Contract.ThrowIfFalse(IsDeclarationWithInitializer(oldDeclaration) == IsDeclarationWithInitializer(newDeclaration)); 4939Contract.ThrowIfFalse(oldCtor is IMethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.StaticConstructor }); 5031Contract.ThrowIfFalse(isStatic || oldCtor != null);
EditAndContinue\CommittedSolution.cs (1)
143Contract.ThrowIfFalse(currentDocument == null || documentId == currentDocument.Id);
EditAndContinue\DocumentActiveStatementChanges.cs (2)
22Contract.ThrowIfFalse(oldSpans.Length == newStatements.Length); 23Contract.ThrowIfFalse(oldSpans.Length == newExceptionRegions.Length);
EmbeddedLanguages\RegularExpressions\RegexParser.cs (1)
883Contract.ThrowIfFalse(comment.HasValue);
EmbeddedLanguages\StackFrame\StackFrameParser.cs (2)
90Contract.ThrowIfFalse(_lexer.Position == _lexer.Text.Length); 91Contract.ThrowIfFalse(eolToken.Kind == StackFrameKind.EndOfFrame);
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
320Contract.ThrowIfFalse(resolution.IsSuccessful);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingIdleProcessor.cs (1)
59Contract.ThrowIfFalse(_processorTask == null);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
82Contract.ThrowIfFalse(item.DocumentId != null);
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
216Contract.ThrowIfFalse(remainingResults.Count == 0);
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
37Contract.ThrowIfFalse(textSpan.Contains(tokens[TriviaLocation.AfterBeginningOfSpan].Span) && textSpan.Contains(tokens[TriviaLocation.BeforeEndOfSpan].Span));
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (1)
115Contract.ThrowIfFalse(
ExtractMethod\MethodExtractor.Analyzer.cs (2)
92Contract.ThrowIfFalse(unused.Count == 0); 864Contract.ThrowIfFalse(parameters.Count == arguments.Count);
ExtractMethod\MethodExtractor.CodeGenerator.cs (5)
44Contract.ThrowIfFalse(insertionPoint.SemanticDocument == analyzerResult.SemanticDocument); 249Contract.ThrowIfFalse(AnalyzerResult.GetVariablesToSplitOrMoveOutToCallSite(cancellationToken).Single(v => v.ReturnBehavior == ReturnBehavior.Initialization) != null); 258Contract.ThrowIfFalse(variable.ReturnBehavior == ReturnBehavior.Assignment); 296Contract.ThrowIfFalse(variableToUseAsReturnValue.ReturnBehavior is ReturnBehavior.Assignment or 309Contract.ThrowIfFalse(variable.GetDeclarationBehavior(cancellationToken) is DeclarationBehavior.MoveOut or
ExtractMethod\MethodExtractor.VariableInfo.cs (3)
38Contract.ThrowIfFalse(!_useAsReturnValue || _variableStyle.ReturnStyle.ReturnBehavior != ReturnBehavior.None); 99Contract.ThrowIfFalse(variable.CanBeUsedAsReturnValue); 100Contract.ThrowIfFalse(variable.ParameterModifier is ParameterBehavior.Out or ParameterBehavior.Ref);
ExtractMethod\MethodExtractor.VariableSymbol.cs (14)
136Contract.ThrowIfFalse(_parameterSymbol.Ordinal != other._parameterSymbol.Ordinal); 212Contract.ThrowIfFalse(_localSymbol.Locations.Length == 1); 213Contract.ThrowIfFalse(other._localSymbol.Locations.Length == 1); 214Contract.ThrowIfFalse(_localSymbol.Locations[0].IsInSource); 215Contract.ThrowIfFalse(other._localSymbol.Locations[0].IsInSource); 216Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceTree == other._localSymbol.Locations[0].SourceTree); 217Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceSpan.Start != other._localSymbol.Locations[0].SourceSpan.Start); 234Contract.ThrowIfFalse(_localSymbol.Locations.Length == 1); 235Contract.ThrowIfFalse(_localSymbol.Locations[0].IsInSource); 242Contract.ThrowIfFalse(token.Span.Equals(span)); 326Contract.ThrowIfFalse(locationLeft.IsInSource); 327Contract.ThrowIfFalse(locationRight.IsInSource); 328Contract.ThrowIfFalse(locationLeft.SourceTree == locationRight.SourceTree); 329Contract.ThrowIfFalse(locationLeft.SourceSpan.Start != locationRight.SourceSpan.Start);
FindUsages\DefinitionItem.cs (2)
158Contract.ThrowIfFalse(Properties.ContainsKey(MetadataSymbolOriginatingProjectIdGuid)); 159Contract.ThrowIfFalse(Properties.ContainsKey(MetadataSymbolOriginatingProjectIdDebugName));
FindUsages\IRemoteFindUsagesService.cs (1)
154Contract.ThrowIfFalse(_idToDefinition.ContainsKey(definitionId));
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
74Contract.ThrowIfFalse(document.Project.Solution == generateTypeOptionsResult.Project.Solution);
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (2)
320Contract.ThrowIfFalse(symbolGroup.Length > 0); 329Contract.ThrowIfFalse(symbolGroup.Length > 0);
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (2)
252Contract.ThrowIfFalse(threadingService.IsOnMainThread); 345Contract.ThrowIfFalse(_openedDocumentIds.IsEmpty);
MetadataAsSource\MetadataAsSourceFileService.cs (1)
123Contract.ThrowIfFalse(threadingService.IsOnMainThread);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (1)
355Contract.ThrowIfFalse(threadingService.IsOnMainThread);
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
491Contract.ThrowIfFalse(x.Document == y.Document);
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (1)
437Contract.ThrowIfFalse(x.location.Document == y.location.Document);
Snippets\AbstractSnippetService.cs (1)
39Contract.ThrowIfFalse(_identifierToProviderMap.ContainsKey(snippetIdentifier));
SolutionCrawler\IdleProcessor.cs (1)
59Contract.ThrowIfFalse(_processorTask == null);
SolutionCrawler\WorkCoordinator.HighPriorityProcessor.cs (1)
144Contract.ThrowIfFalse(GetNextWorkItem(out var workItem, out var documentCancellation));
SolutionCrawler\WorkCoordinator.NormalPriorityProcessor.cs (1)
81Contract.ThrowIfFalse(item.DocumentId != null);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
143Contract.ThrowIfFalse(resolution.IsSuccessful);
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
312Contract.ThrowIfFalse(comma.IsToken);
Microsoft.CodeAnalysis.LanguageServer.Protocol (30)
Extensions\ProtocolConversions.cs (2)
115Contract.ThrowIfFalse(char.TryParse(context.TriggerCharacter, out var triggerChar)); 127Contract.ThrowIfFalse(char.TryParse(context.TriggerCharacter, out var triggerChar));
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (3)
49Contract.ThrowIfFalse(diagnostics.All(d => d.DocumentId != null)); 57Contract.ThrowIfFalse(diagnostics.All(d => d.DocumentId != null)); 72Contract.ThrowIfFalse(diagnostics.All(d => d.DocumentId == null));
Features\Diagnostics\DocumentAnalysisExecutor.cs (1)
67Contract.ThrowIfFalse(AnalysisScope.Analyzers.Contains(analyzer));
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (3)
154Contract.ThrowIfFalse(project.SupportsCompilation); 192Contract.ThrowIfFalse(project.TryGetCompilation(out var compilation2)); 193Contract.ThrowIfFalse(compilation1 == compilation2);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ActiveFileState.cs (1)
65Contract.ThrowIfFalse(data.OldItems.IsDefault);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.AnalysisData.cs (1)
124Contract.ThrowIfFalse(project.Id == result.ProjectId);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.CompilationManager.cs (1)
89Contract.ThrowIfFalse(compilation.Analyzers.SetEquals(stateSets.Select(s => s.Analyzer).Where(a => !a.IsWorkspaceDiagnosticAnalyzer())));
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.cs (4)
167Contract.ThrowIfFalse(project.Solution.Workspace == Workspace); 181Contract.ThrowIfFalse(solution == null || solution.Workspace == Workspace); 194Contract.ThrowIfFalse(document.Project.Solution.Workspace == Workspace); 208Contract.ThrowIfFalse(solution == null || solution.Workspace == Workspace);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (1)
319Contract.ThrowIfFalse(member.FullSpan.Start == oldSpan.Start);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.InMemoryStorage.cs (1)
67=> Contract.ThrowIfFalse(key.key is DocumentId or ProjectId);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs (1)
73Contract.ThrowIfFalse(!compilationWithAnalyzers.Analyzers.IsEmpty);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs (6)
56Contract.ThrowIfFalse(lastResult.ProjectId == project.Id); 117Contract.ThrowIfFalse(lastResult.ProjectId == document.Project.Id); 158Contract.ThrowIfFalse(lastResult.ProjectId == project.Id); 242Contract.ThrowIfFalse(state.DocumentId == document.Id); 352Contract.ThrowIfFalse(document == null || document.Project == project); 413Contract.ThrowIfFalse(document == null || document.Project == project);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.cs (1)
301Contract.ThrowIfFalse(set.Add((stateSet.Language, stateSet.StateName)));
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (1)
222Contract.ThrowIfFalse(kind == AnalysisKind.NonLocal);
Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
287Contract.ThrowIfFalse(diagnostics.IsEmpty);
Handler\InlineCompletions\XmlSnippetParser.CodeSnippet.cs (1)
276Contract.ThrowIfFalse(snippetParts.Any());
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
302Contract.ThrowIfFalse(tokenLength > 0);
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator (1)
Graph\Edge.cs (1)
42Contract.ThrowIfFalse(IsEdgeLabelOneToMany(label));
Microsoft.CodeAnalysis.Remote.ServiceHub (27)
AbstractWorkspaceTelemetryService.cs (1)
26Contract.ThrowIfFalse(CurrentSession is null);
Host\RemoteWorkspace.InFlightSolution.cs (9)
59Contract.ThrowIfFalse(workspace._gate.CurrentCount == 0); 81Contract.ThrowIfFalse(_workspace._gate.CurrentCount == 0); 90Contract.ThrowIfFalse(_workspace._gate.CurrentCount == 0); 109Contract.ThrowIfFalse(_workspace._gate.CurrentCount == 0); 146Contract.ThrowIfFalse(_workspace._gate.CurrentCount == 0); 160Contract.ThrowIfFalse(_workspace._gate.CurrentCount == 0); 170Contract.ThrowIfFalse(_workspace._solutionChecksumToSolution.TryGetValue(SolutionChecksum, out var existingSolution)); 171Contract.ThrowIfFalse(existingSolution == this); 174Contract.ThrowIfFalse(_workspace._solutionChecksumToSolution.Remove(SolutionChecksum));
Host\RemoteWorkspace.SolutionCreator.cs (11)
71Contract.ThrowIfFalse(solution.Id == newSolutionInfo.Id && solution.FilePath == newSolutionInfo.FilePath); 299Contract.ThrowIfFalse(project.State.ProjectInfo.Attributes.Id == newProjectAttributes.Id); 300Contract.ThrowIfFalse(project.State.ProjectInfo.Attributes.Language == newProjectAttributes.Language); 301Contract.ThrowIfFalse(project.State.ProjectInfo.Attributes.IsSubmission == newProjectAttributes.IsSubmission); 477Contract.ThrowIfFalse(document.State.Attributes.Id == newDocumentInfo.Id); 478Contract.ThrowIfFalse(document.State.Attributes.Name == newDocumentInfo.Name); 479Contract.ThrowIfFalse(document.State.Attributes.FilePath == newDocumentInfo.FilePath); 480Contract.ThrowIfFalse(document.State.Attributes.IsGenerated == newDocumentInfo.IsGenerated); 481Contract.ThrowIfFalse(document.State.Attributes.DesignTimeOnly == newDocumentInfo.DesignTimeOnly); 486Contract.ThrowIfFalse(document is Document); 493Contract.ThrowIfFalse(document is Document);
Host\RemoteWorkspace_SolutionCaching.cs (4)
44Contract.ThrowIfFalse(_gate.CurrentCount == 0); 67Contract.ThrowIfFalse(_gate.CurrentCount == 0); 93Contract.ThrowIfFalse(solution.InFlightCount == 1); 103Contract.ThrowIfFalse(_gate.CurrentCount == 0);
Services\ProcessTelemetry\RemoteWorkspaceConfigurationService.cs (1)
34Contract.ThrowIfFalse(_options == null);
TelemetryLogger.cs (1)
141Contract.ThrowIfFalse(_pendingScopes.TryRemove(blockId, out var scope));
Microsoft.CodeAnalysis.Remote.Workspaces (16)
BrokeredServiceConnection.cs (7)
68Contract.ThrowIfFalse((callbackDispatcher == null) == (serviceDescriptor.ClientInterface == null)); 137Contract.ThrowIfFalse(_callbackDispatcher is not null); 154Contract.ThrowIfFalse(_callbackDispatcher is not null); 238Contract.ThrowIfFalse(_callbackDispatcher is not null); 257Contract.ThrowIfFalse(_callbackDispatcher is not null); 276Contract.ThrowIfFalse(_callbackDispatcher is not null); 295Contract.ThrowIfFalse(_callbackDispatcher is not null);
RemoteHostAssetSerialization.cs (3)
101Contract.ThrowIfFalse(solutionChecksum == responseSolutionChecksum); 104Contract.ThrowIfFalse(count == checksums.Count); 109Contract.ThrowIfFalse(checksums.Contains(responseChecksum));
Serialization\MessagePackFormatters.cs (1)
74Contract.ThrowIfFalse(reader.ReadArrayHeader() == 2);
ServiceDescriptors.cs (4)
107Contract.ThrowIfFalse(serviceInterface.IsInterface); 109Contract.ThrowIfFalse(interfaceName.StartsWith(InterfaceNamePrefix, StringComparison.Ordinal)); 110Contract.ThrowIfFalse(interfaceName.EndsWith(InterfaceNameSuffix, StringComparison.Ordinal)); 117Contract.ThrowIfFalse(callbackInterface == null || callbackInterface.IsInterface);
SolutionAssetStorage.Scope.cs (1)
105Contract.ThrowIfFalse(checksum == resultingChecksum);
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (2)
AutomaticEndConstructCorrection\AutomaticEndConstructCorrector.vb (1)
292Contract.ThrowIfFalse(positionInText >= 0)
EndConstructGeneration\SpitLinesResult.vb (1)
25Contract.ThrowIfFalse(_lines.Any(Function(line) String.IsNullOrWhiteSpace(line)))
Microsoft.CodeAnalysis.VisualBasic.Features (26)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (2)
1048Contract.ThrowIfFalse(node.IsParentKind(SyntaxKind.ParameterList, SyntaxKind.TypeParameterList)) 1199Contract.ThrowIfFalse(parent.Parent.IsKind(SyntaxKind.FieldDeclaration))
ExtractMethod\VisualBasicMethodExtractor.Analyzer.vb (1)
33Contract.ThrowIfFalse(style.ParameterStyle.DeclarationBehavior = DeclarationBehavior.MoveIn OrElse style.ParameterStyle.DeclarationBehavior = DeclarationBehavior.SplitIn)
ExtractMethod\VisualBasicMethodExtractor.PostProcessor.vb (2)
60Contract.ThrowIfFalse(statement.Declarators.Count = 1) 74Contract.ThrowIfFalse(keyValuePair.Value.Count > 0)
ExtractMethod\VisualBasicMethodExtractor.vb (1)
32Contract.ThrowIfFalse(originalSpanStart >= 0)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.CallSiteContainerRewriter.vb (7)
41Contract.ThrowIfFalse(Me._firstStatementOrFieldToReplace.Parent Is Me._lastStatementOrFieldToReplace.Parent) 70Contract.ThrowIfFalse(expressionStatements.Count = 0) 74Contract.ThrowIfFalse(expressionStatements.Count = 0) 317Contract.ThrowIfFalse(Me._statementsOrFieldToInsert.Count() = 1) 327Contract.ThrowIfFalse(Me._firstStatementOrFieldToReplace Is Me._lastStatementOrFieldToReplace) 332Contract.ThrowIfFalse(lastStatementIndex >= 0) 334Contract.ThrowIfFalse(firstStatementIndex <= lastStatementIndex)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.ExpressionCodeGenerator.vb (2)
71Contract.ThrowIfFalse(IsExtractMethodOnExpression(VBSelectionResult)) 103Contract.ThrowIfFalse(container.IsStatementContainerNode() OrElse
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.MultipleStatementsCodeGenerator.vb (3)
29Contract.ThrowIfFalse(firstUnderContainer.Parent Is lastUnderContainer.Parent) 51Contract.ThrowIfFalse(firstStatementIndex >= 0) 54Contract.ThrowIfFalse(lastStatementIndex >= 0)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.SingleStatementCodeGenerator.vb (1)
40Contract.ThrowIfFalse(IsExtractMethodOnSingleStatement(VBSelectionResult))
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (3)
50Contract.ThrowIfFalse(Me.SemanticDocument Is selectionResult.SemanticDocument) 96Contract.ThrowIfFalse(firstStatementToRemove.Parent Is lastStatementToRemove.Parent) 152Contract.ThrowIfFalse(declStatement.Parent.IsStatementContainerNode())
ExtractMethod\VisualBasicSelectionResult.vb (2)
262Contract.ThrowIfFalse(lastStatement.Parent Is (GetFirstStatementUnderContainer()).Parent) 268Contract.ThrowIfFalse(SelectionInExpression)
ExtractMethod\VisualBasicSelectionValidator.vb (1)
653Contract.ThrowIfFalse(line.LineNumber > 0)
VisualBasicUseIsNotExpressionCodeFixProvider.vb (1)
65Contract.ThrowIfFalse(operand.IsKind(SyntaxKind.TypeOfIsExpression))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (15)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (2)
384Contract.ThrowIfFalse(index >= 0) 477Contract.ThrowIfFalse(originalModifiers.Count > 0)
Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
55Contract.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind))
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
64Contract.ThrowIfFalse(list.Count > 0)
Formatting\Engine\Trivia\TriviaDataFactory.LineContinuationTrivia.vb (1)
26Contract.ThrowIfFalse(Me.SecondTokenIsFirstTokenOnLine)
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (2)
71Contract.ThrowIfFalse(Me.SecondTokenIsFirstTokenOnLine) 77Contract.ThrowIfFalse(list.Count > 0)
Formatting\Engine\Trivia\TriviaDataFactory.vb (3)
103Contract.ThrowIfFalse(lineBreaks = 1) 117Contract.ThrowIfFalse(indentation >= 0 AndAlso indentation < s_lineContinuationCacheSize) 153Contract.ThrowIfFalse(space >= -1)
Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (1)
296Contract.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
SemanticModelReuse\VisualBasicSemanticModelReuseLanguageService.vb (2)
30Contract.ThrowIfFalse(TypeOf container Is PropertyBlockSyntax OrElse 36Contract.ThrowIfFalse(TypeOf member Is PropertyBlockSyntax OrElse
Simplification\VisualBasicSimplificationService.vb (1)
114Contract.ThrowIfFalse(SpeculationAnalyzer.CanSpeculateOnNode(nodeToSpeculate))
SyntaxNodeExtensions.vb (1)
115Contract.ThrowIfFalse(node.IsStatementContainerNode())
Microsoft.CodeAnalysis.Workspaces (164)
AbstractFormatEngine.OperationApplier.cs (5)
61Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 94Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 132Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 460Contract.ThrowIfFalse(triviaInfo.SecondTokenIsFirstTokenOnLine); 487Contract.ThrowIfFalse(baseToken.RawKind != 0 && startToken.RawKind != 0 && endToken.RawKind != 0);
AbstractTriviaDataFactory.AbstractComplexTrivia.cs (2)
80Contract.ThrowIfFalse(line > 0); 137Contract.ThrowIfFalse(list.Count > 0);
AbstractTriviaDataFactory.cs (5)
39Contract.ThrowIfFalse(space >= 0); 58Contract.ThrowIfFalse(lineBreaks >= 0); 59Contract.ThrowIfFalse(indentation >= 0); 91Contract.ThrowIfFalse(lineIndex is >= 0 and < LineBreakCacheSize); 92Contract.ThrowIfFalse(indentationLevel >= 0 && indentationLevel < _whitespaces.Length / _whitespaces.Rank);
AbstractTriviaDataFactory.Whitespace.cs (2)
27Contract.ThrowIfFalse(space >= 0); 59Contract.ThrowIfFalse(line > 0);
AbstractTriviaFormatter.cs (2)
76Contract.ThrowIfFalse(lineBreaks >= 0); 77Contract.ThrowIfFalse(spaces >= 0);
AdjustNewLinesOperation.cs (3)
16Contract.ThrowIfFalse(option != AdjustNewLinesOption.ForceLines || line > 0); 17Contract.ThrowIfFalse(option != AdjustNewLinesOption.PreserveLines || line >= 0); 18Contract.ThrowIfFalse(option != AdjustNewLinesOption.ForceLinesIfOnSingleLine || line > 0);
AdjustSpacesOperation.cs (1)
16Contract.ThrowIfFalse(space >= 0);
AnalyzerConfigOptionsExtensions.cs (1)
26Contract.ThrowIfFalse(option.Definition.IsEditorConfigOption);
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (2)
133Contract.ThrowIfFalse(currentOld.FullSpan.Start == currentNew.FullSpan.Start); 191Contract.ThrowIfFalse((oldRoot.FullSpan.End - currentOld.FullSpan.End) ==
CodeActions\CodeAction.cs (1)
105Contract.ThrowIfFalse(provider is CodeFixProvider or CodeRefactoringProvider);
CodeCleanup\AbstractCodeCleanerService.cs (1)
214Contract.ThrowIfFalse(hasMultiplePreviousToken || hasMultipleNextToken);
CodeFixes\CodeFixProvider.cs (1)
49Contract.ThrowIfFalse(priority is CodeActionRequestPriority.Low or CodeActionRequestPriority.Normal or CodeActionRequestPriority.High);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
59Contract.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (1)
47Contract.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
CodeRefactorings\CodeRefactoringProvider.cs (1)
42Contract.ThrowIfFalse(priority is CodeActionRequestPriority.Low or CodeActionRequestPriority.Normal or CodeActionRequestPriority.High);
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (1)
90Contract.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
CommonFormattingHelpers.cs (4)
45Contract.ThrowIfFalse(spans.Count > 0); 120Contract.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart); 282Contract.ThrowIfFalse(backwardPosition < parentNode.FullSpan.End); 308Contract.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition);
Diagnostics\DocumentAnalysisScope.cs (1)
51Contract.ThrowIfFalse(TextDocument is AdditionalDocument);
DocumentExtensions.cs (1)
116Contract.ThrowIfFalse(document.SupportsSemanticModel);
FindSymbols\FindReferences\DependentProjectsFinder.cs (2)
265Contract.ThrowIfFalse(project.SupportsCompilation); 277Contract.ThrowIfFalse(project.SupportsCompilation);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
578Contract.ThrowIfFalse(notNullOriginalUnreducedSymbol2.GetOriginalUnreducedDefinition().Equals(notNullOriginalUnreducedSymbol2));
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (1)
169Contract.ThrowIfFalse(_symbolToGroup.ContainsKey(symbol));
FindSymbols\Shared\AbstractSyntaxIndex.cs (1)
114Contract.ThrowIfFalse(document.SupportsSyntaxTree);
FindSymbols\SymbolFinder_Helpers.cs (3)
152Contract.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => !SymbolEquivalenceComparer.Instance.Equals(kvp.Key.ContainingAssembly, kvp.Value.ContainingAssembly))); 155Contract.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Key.ContainingType == null)); 156Contract.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Value.ContainingType == null));
FormattingContext.cs (1)
437Contract.ThrowIfFalse(intervals.Length == 0);
FormattingExtensions.cs (1)
201Contract.ThrowIfFalse(lines.Length > 0);
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);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (1)
497Contract.ThrowIfFalse(symbol.IsNormalAnonymousType());
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs\StringExtensions.cs (4)
209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 210Contract.ThrowIfFalse(tabSize > 0); 218Contract.ThrowIfFalse(column >= 0); 219Contract.ThrowIfFalse(tabSize > 0);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs\TaskExtensions.cs (1)
381Contract.ThrowIfFalse(task.IsCompleted);
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (1)
25Contract.ThrowIfFalse(fixAllScope is FixAllScope.ContainingMember or FixAllScope.ContainingType);
NonReentrantLock.cs (1)
172=> Contract.ThrowIfFalse(LockHeldByMe());
Notification\AbstractGlobalOperationNotificationService.cs (3)
40Contract.ThrowIfFalse(_registrations.Count == 0); 73Contract.ThrowIfFalse(_operations.Count == 1); 86Contract.ThrowIfFalse(result);
ParsedDocument.cs (1)
73Contract.ThrowIfFalse(Id == oldDocument.Id);
Remote\ExportRemoteServiceCallbackDispatcherAttribute.cs (1)
22Contract.ThrowIfFalse(serviceInterface.IsInterface);
Remote\RemoteServiceCallbackDispatcher.cs (1)
54Contract.ThrowIfFalse(_callbackInstances.TryGetValue(callbackId, out var instance));
Rename\RenameUtilities.cs (1)
101Contract.ThrowIfFalse(isSubset);
Serialization\SerializableSourceText.cs (1)
175Contract.ThrowIfFalse(kind == SerializationKinds.Bits);
Serialization\SerializerService_ChecksumWithChildren.cs (1)
79Contract.ThrowIfFalse(checksums.Checksum == checksum);
Serialization\SerializerService_Reference.cs (6)
378Contract.ThrowIfFalse(metadataKind == MetadataImageKind.Module); 388Contract.ThrowIfFalse(metadataKind == MetadataImageKind.Module); 403Contract.ThrowIfFalse(metadataKind == MetadataImageKind.Module); 414Contract.ThrowIfFalse(metadataKind == MetadataImageKind.Module); 428Contract.ThrowIfFalse(length == storageStream.Length); 442Contract.ThrowIfFalse(SerializationKinds.Bits == kind);
Shared\Extensions\IMethodSymbolExtensions.cs (1)
22Contract.ThrowIfFalse(delegateType.TypeKind == TypeKind.Delegate);
Shared\Extensions\SourceTextExtensions.cs (2)
218Contract.ThrowIfFalse(offset == length); 264Contract.ThrowIfFalse(offset == length);
Shared\TestHooks\AsynchronousOperationListener.cs (3)
116Contract.ThrowIfFalse(_gate.LockHeldByMe()); 122Contract.ThrowIfFalse(_gate.LockHeldByMe()); 187Contract.ThrowIfFalse(TrackActiveTokens);
Simplification\AbstractSimplificationService.cs (1)
185Contract.ThrowIfFalse(nodesAndTokensToReduce.Any());
Storage\SQLite\v2\Interop\SqlConnection.cs (2)
55Contract.ThrowIfFalse(wrote == length); 316Contract.ThrowIfFalse(MemoryMarshal.TryRead(bytes, out Checksum.HashData result));
Storage\SQLite\v2\Interop\SqlStatement.cs (1)
93Contract.ThrowIfFalse(Encoding.UTF8.GetBytes(value.AsSpan(), bytes) == utf8ByteCount);
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (3)
166Contract.ThrowIfFalse(TaskScheduler.Current == Storage._connectionPoolService.Scheduler.ConcurrentScheduler); 225Contract.ThrowIfFalse(TaskScheduler.Current == Storage._connectionPoolService.Scheduler.ExclusiveScheduler); 364Contract.ThrowIfFalse(TaskScheduler.Current == Storage._connectionPoolService.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_FlushWrites.cs (1)
65Contract.ThrowIfFalse(TaskScheduler.Current == _connectionPoolService.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (2)
49Contract.ThrowIfFalse( 68Contract.ThrowIfFalse(TaskScheduler.Current == _connectionPoolService.Scheduler.ExclusiveScheduler);
StructuredAnalyzerConfigOptions.cs (1)
65Contract.ThrowIfFalse(options.KeyComparer == KeyComparer);
SymbolKey.BodyLevelSymbolKey.cs (2)
22Contract.ThrowIfFalse(IsBodyLevelSymbol(symbol)); 66Contract.ThrowIfFalse(locations.All(loc => loc.IsInSource));
SymbolKey.ErrorTypeSymbolKey.cs (1)
86Contract.ThrowIfFalse(typeArguments.IsDefault);
SymbolKey.FunctionPointerTypeSymbolKey.cs (1)
71Contract.ThrowIfFalse(parameterTypes.IsDefault);
SymbolKey.NamedTypeSymbolKey.cs (1)
54Contract.ThrowIfFalse(typeArguments.IsDefault);
SymbolKey.SymbolKeyReader.cs (2)
418Contract.ThrowIfFalse(Equals(method, _methodSymbolStack[^1])); 434Contract.ThrowIfFalse(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
SymbolKey.SymbolKeyWriter.cs (1)
519Contract.ThrowIfFalse(method.Equals(_methodSymbolStack[_methodSymbolStack.Count - 1]));
SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
15Contract.ThrowIfFalse(symbol.TypeParameterKind == TypeParameterKind.Method);
SyntaxAnnotationExtensions.cs (1)
18Contract.ThrowIfFalse(symbol is CodeGenerationSymbol);
SyntaxGeneratorExtensions_Negate.cs (1)
526Contract.ThrowIfFalse(syntaxFacts.IsNotPattern(pattern));
SyntaxNodeExtensions.cs (1)
316Contract.ThrowIfFalse(nodes.Any());
TextDocumentExtensions.cs (2)
38Contract.ThrowIfFalse(textDocument is AdditionalDocument); 47Contract.ThrowIfFalse(textDocument is AnalyzerConfigDocument);
TokenData.cs (3)
26Contract.ThrowIfFalse((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount)); 78Contract.ThrowIfFalse(this.TokenStream == other.TokenStream); 105Contract.ThrowIfFalse(index1 >= 0 && index2 >= 0);
TokenPairWithOperations.cs (1)
30Contract.ThrowIfFalse(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
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);
TreeData.Debug.cs (1)
25Contract.ThrowIfFalse(text == _debugNodeData.GetTextBetween(token1, token2));
TreeData.Node.cs (1)
18Contract.ThrowIfFalse(root.GetFirstToken(includeZeroWidth: true).RawKind != 0);
TreeData.StructuredTrivia.cs (1)
22Contract.ThrowIfFalse(trivia.HasStructure);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
35Contract.ThrowIfFalse(mappedSpanResults.Length == textChanges.Length);
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (1)
464Contract.ThrowIfFalse(_documentIdToDynamicFileInfoProvider.TryGetValue(documentId, out var fileInfoProvider));
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (15)
153Contract.ThrowIfFalse(_gate.CurrentCount == 0); 160Contract.ThrowIfFalse(_gate.CurrentCount == 0); 238Contract.ThrowIfFalse(_gate.CurrentCount == 0); 261Contract.ThrowIfFalse(_gate.CurrentCount == 0); 272Contract.ThrowIfFalse(_gate.CurrentCount == 0); 300Contract.ThrowIfFalse(_gate.CurrentCount == 0); 304Contract.ThrowIfFalse(_projectReferenceInfoMap.Count == 0); 305Contract.ThrowIfFalse(_projectToMaxSupportedLangVersionMap.Count == 0); 306Contract.ThrowIfFalse(_projectToDependencyNodeTargetIdentifier.Count == 0); 355Contract.ThrowIfFalse(_gate.CurrentCount == 0); 401Contract.ThrowIfFalse(_gate.CurrentCount == 0); 485Contract.ThrowIfFalse(_gate.CurrentCount == 0); 526Contract.ThrowIfFalse(_gate.CurrentCount == 0); 558Contract.ThrowIfFalse(_gate.CurrentCount == 0); 577Contract.ThrowIfFalse(_gate.CurrentCount == 0);
Workspace\Solution\Checksum.cs (3)
61Contract.ThrowIfFalse(MemoryMarshal.TryRead(checksum, out HashData hash)); 121Contract.ThrowIfFalse(span.Length >= HashSize); 122Contract.ThrowIfFalse(MemoryMarshal.TryWrite(span, ref Unsafe.AsRef(in _checksum)));
Workspace\Solution\ChecksumCollection.cs (2)
48Contract.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksums)); 65Contract.ThrowIfFalse(values.Count == checksums.Children.Length);
Workspace\Solution\DocumentState.cs (2)
46Contract.ThrowIfFalse(_options is null == _treeSource is null); 677Contract.ThrowIfFalse(existingId == id);
Workspace\Solution\ProjectDependencyGraph.cs (1)
129Contract.ThrowIfFalse(_projectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_AddProjectReference.cs (1)
17Contract.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\RecoverableTextAndVersion.cs (1)
197Contract.ThrowIfFalse(_storage == null); // Cannot save more than once
Workspace\Solution\SolutionState.CompilationTracker.CompilationTrackerState.cs (1)
211Contract.ThrowIfFalse(intermediateProjects.Count > 0);
Workspace\Solution\SolutionState.CompilationTracker.cs (2)
234Contract.ThrowIfFalse(compilationPair.CompilationWithoutGeneratedDocuments.ContainsSyntaxTree(tree)); 827Contract.ThrowIfFalse(additionalTexts.Length == this.ProjectState.AdditionalDocumentStates.Count);
Workspace\Solution\SolutionState.cs (5)
174Contract.ThrowIfFalse(_projectIdToProjectStateMap.Count == ProjectIds.Count); 175Contract.ThrowIfFalse(_projectIdToProjectStateMap.Count == _dependencyGraph.ProjectIds.Count); 1499Contract.ThrowIfFalse(_projectIdToProjectStateMap.ContainsKey(projectId)); 1676Contract.ThrowIfFalse(newIdToProjectStateMap.ContainsKey(doc.Id.ProjectId)); 1919Contract.ThrowIfFalse(newTrackerMap.TryGetValue(projectId, out var existingTracker));
Workspace\Solution\StateChecksums.cs (2)
142Contract.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksum)); 143Contract.ThrowIfFalse(this == stateChecksum);
Workspace\TextExtensions.cs (1)
96Contract.ThrowIfFalse(solution.ContainsAnalyzerConfigDocument(id));
Workspace\Workspace_Editor.cs (6)
450Contract.ThrowIfFalse(_openSourceGeneratedDocumentIdentities.Remove(document.Id)); 685Contract.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer)); 693Contract.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer)); 711Contract.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer)); 715Contract.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer)); 739Contract.ThrowIfFalse(doc.TryGetText(out var text));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Remote\InProcRemostHostClient.cs (2)
139Contract.ThrowIfFalse(options.ClientRpcTarget is null == descriptor.ClientInterface is null); 245Contract.ThrowIfFalse(descriptor.ClientInterface == null);
Remote\TestSerializerService.cs (1)
93Contract.ThrowIfFalse(_sharedTestGeneratorReferences.TryGetValue(testGeneratorReferenceGuid, out var generatorReference));
Microsoft.VisualStudio.IntegrationTest.Utilities (9)
InProcess\AbstractCodeRefactorDialog_InProc.cs (1)
77Contract.ThrowIfFalse(result);
InProcess\GenerateTypeDialog_InProc.cs (5)
83Contract.ThrowIfFalse(await dialog.GetTestAccessor().AccessListComboBox.SimulateSelectItemAsync(JoinableTaskFactory, accessibility)); 96Contract.ThrowIfFalse(await dialog.GetTestAccessor().KindListComboBox.SimulateSelectItemAsync(JoinableTaskFactory, kind)); 109Contract.ThrowIfFalse(await dialog.GetTestAccessor().ProjectListComboBox.SimulateSelectItemAsync(JoinableTaskFactory, projectName)); 122Contract.ThrowIfFalse(await dialog.GetTestAccessor().CreateNewFileRadioButton.SimulateClickAsync(JoinableTaskFactory)); 123Contract.ThrowIfFalse(await dialog.GetTestAccessor().CreateNewFileComboBox.SimulateSelectItemAsync(JoinableTaskFactory, newFileName, mustExist: false));
InProcess\InteractiveWindow_InProc.cs (1)
167Contract.ThrowIfFalse(result.IsSuccessful);
InProcess\MoveToNamespaceDialog_InProc.cs (1)
65Contract.ThrowIfFalse(success);
InProcess\PickMembersDialog_InProc.cs (1)
65Contract.ThrowIfFalse(await button.SimulateClickAsync(JoinableTaskFactory));
Microsoft.VisualStudio.LanguageServices (34)
CommonControls\MemberSelectionViewModel.cs (1)
107Contract.ThrowIfFalse(ShowCheckDependentsButton);
ErrorReporting\VisualStudioInfoBar.cs (1)
97Contract.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
FindReferences\Entries\DocumentSpanEntry.cs (1)
301Contract.ThrowIfFalse(CanNavigateTo());
FindReferences\Entries\SimpleMessageEntry.cs (1)
54Contract.ThrowIfFalse(CanNavigateTo());
Implementation\AbstractOleCommandTarget.Query.cs (2)
17Contract.ThrowIfFalse(commandCount == 1); 18Contract.ThrowIfFalse(prgCmds.Length == 1);
InlineRename\InlineRenameUndoManager.cs (2)
112Contract.ThrowIfFalse(textUndoHistoryService.TryGetTextUndoHistory(workspace, subjectBuffer, out var undoHistory)); 113Contract.ThrowIfFalse(undoHistory.Properties.TryGetProperty(typeof(ITextBuffer), out ITextBuffer primaryBuffer));
LanguageService\AbstractLanguageService`2.VsCodeWindowManager.cs (2)
256Contract.ThrowIfFalse(_documentOutlineControl is null); 257Contract.ThrowIfFalse(_documentOutlineViewHost is null);
Options\LocalUserRegistryOptionPersister.cs (1)
39Contract.ThrowIfFalse(ErrorHandler.Succeeded(localRegistry.GetLocalRegistryRootEx((uint)__VsLocalRegistryType.RegType_UserSettings, out var rootHandle, out var rootPath)));
Packaging\PackageInstallerServiceFactory.cs (3)
217Contract.ThrowIfFalse(IsEnabled); 305Contract.ThrowIfFalse(IsEnabled); 377Contract.ThrowIfFalse(IsEnabled);
PickMembers\PickMembersDialogViewModel.cs (2)
158Contract.ThrowIfFalse(CanMoveUp); 166Contract.ThrowIfFalse(CanMoveDown);
Preview\FileChange.cs (1)
46Contract.ThrowIfFalse(left != null || right != null);
PreviewPane\PreviewPane.xaml.cs (1)
210Contract.ThrowIfFalse(_differenceViewerPreview == null);
ProjectSystem\FileChangeWatcher.cs (8)
143Contract.ThrowIfFalse(kind is Kind.None); 158Contract.ThrowIfFalse(kind is Kind.WatchDirectory); 174Contract.ThrowIfFalse(kind is Kind.WatchFile); 190Contract.ThrowIfFalse(kind is Kind.UnwatchDirectories); 206Contract.ThrowIfFalse(kind is Kind.UnwatchFiles); 222Contract.ThrowIfFalse(kind is Kind.UnwatchFile); 353Contract.ThrowIfFalse(_cookies is not null); 358Contract.ThrowIfFalse(_tokens is not null);
ProjectSystem\Legacy\AbstractLegacyProject_IProjectSiteEx.cs (1)
25Contract.ThrowIfFalse(_batchScopes.Count > 0);
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.cs (1)
231Contract.ThrowIfFalse(stream.Length == size);
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.RecoverableMetadataValueSource.cs (1)
29Contract.ThrowIfFalse(storages.Length > 0);
ProjectSystem\VisualStudioWorkspaceImpl.cs (1)
252Contract.ThrowIfFalse(ImmutableInterlocked.TryAdd(ref _projectToRuleSetFilePath, project.Id, ruleSetFilePathFunc));
TableDataSource\Suppression\VisualStudioDiagnosticListTableCommandHandler.cs (1)
93Contract.ThrowIfFalse(_threadingContext.HasMainThread);
Telemetry\AbstractWorkspaceTelemetryService.cs (1)
26Contract.ThrowIfFalse(CurrentSession is null);
Telemetry\TelemetryLogger.cs (1)
141Contract.ThrowIfFalse(_pendingScopes.TryRemove(blockId, out var scope));
ValueTracking\ValueTrackingToolWindow.cs (1)
79Contract.ThrowIfFalse(Initialized);
Microsoft.VisualStudio.LanguageServices.CSharp (4)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
159Contract.ThrowIfFalse(
ProjectSystemShim\TempPECompilerService.cs (2)
39Contract.ThrowIfFalse(fileNames.Length == fileContents.Length); 73Contract.ThrowIfFalse(optionNames.Length == optionValues.Length);
Utilities\CSharpParseOptionsChangingService.cs (1)
52Contract.ThrowIfFalse(LanguageVersionFacts.TryParse(maxLangVersion, out var parsedMaxLanguageVersion));
Microsoft.VisualStudio.LanguageServices.Implementation (3)
Options\Style\EnumCodeStyleOptionViewModel.cs (1)
30=> Contract.ThrowIfFalse(typeof(T).IsEnum);
ProjectSystem\CPS\CPSProject_IWorkspaceProjectContext.cs (1)
265Contract.ThrowIfFalse(_batchScopes.TryDequeue(out var scope));
SolutionExplorer\DiagnosticItem\BaseDiagnosticAndGeneratorItemSource.cs (1)
109Contract.ThrowIfFalse(HasItems);
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
ProjectSystemShim\TempPECompiler.TempPEProject.vb (1)
74Contract.ThrowIfFalse(itemid = VSConstants.VSITEMID.Nil)
ProjectSystemShim\TempPECompiler.vb (1)
26Contract.ThrowIfFalse(ppErrors = IntPtr.Zero)
Roslyn.VisualStudio.DiagnosticsWindow (1)
DiagnosticsWindow.cs (1)
71Contract.ThrowIfFalse(Workspace == null);
Roslyn.VisualStudio.Next.UnitTests (1)
Remote\SerializationValidator.cs (1)
213Contract.ThrowIfFalse(solution.State.TryGetStateChecksums(out var solutionObjectFromSolution));