2038 references to Contract
IdeCoreBenchmarks (1)
AbstractCloudCachePersistentStorageService.cs (1)
31
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath));
Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities (1)
AbstractUserDiagnosticTest.cs (1)
93
Contract
.ThrowIfTrue(parameters.testHost == TestHost.OutOfProcess, $"Out-of-proc testing is not supported since {analyzer} can't be serialized.");
Microsoft.CodeAnalysis.CSharp.EditorFeatures (14)
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (2)
45
Contract
.ThrowIfNull(undoHistoryRegistry);
46
Contract
.ThrowIfNull(editorOperationsFactoryService);
DecompiledSource\AssemblyResolver.cs (1)
176
Contract
.ThrowIfNull(fileName);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (3)
128
Contract
.ThrowIfNull(document, "Event Hookup could not find the document for the IBufferView.");
139
Contract
.ThrowIfNull(solutionWithEventHandler, "Event Hookup could not create solution with event handler.");
143
Contract
.ThrowIfFalse(workspace.TryApplyChanges(solutionWithEventHandler), "Event Hookup could not update the solution.");
StringCopyPaste\AbstractPasteProcessor.cs (3)
123
Contract
.ThrowIfTrue(StringExpressionBeforePasteInfo.ContentSpans.IsEmpty);
145
Contract
.ThrowIfFalse(IsAnyRawStringExpression(StringExpressionBeforePaste));
160
Contract
.ThrowIfFalse(IsAnyRawStringExpression(StringExpressionBeforePaste));
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
94
Contract
.ThrowIfFalse(_threadingContext.HasMainThread);
StringCopyPaste\StringCopyPasteCommandHandler_CutCopy.cs (1)
49
Contract
.ThrowIfFalse(_threadingContext.HasMainThread);
StringCopyPaste\StringCopyPasteHelpers.cs (1)
547
Contract
.ThrowIfTrue(spans.Length == 0);
StringCopyPaste\StringInfo.cs (2)
134
Contract
.ThrowIfFalse(SyntaxFacts.IsNewLine(text[rawStart]));
149
Contract
.ThrowIfFalse(SyntaxFacts.IsNewLine(text[rawEnd - 1]));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (14)
Completion\CompletionProviders\CrefCompletionProviderTests.cs (1)
440
Contract
.ThrowIfNull(n);
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (6)
2480
Contract
.ThrowIfNull(testDocument.CursorPosition);
2737
Contract
.ThrowIfNull(testDocument.CursorPosition);
2793
Contract
.ThrowIfNull(testDocument.CursorPosition);
3083
Contract
.ThrowIfNull(testDocument.CursorPosition);
3221
Contract
.ThrowIfNull(testDocument.CursorPosition);
3275
Contract
.ThrowIfNull(testDocument.CursorPosition);
CSharpRemoveRedundantNullableDirectiveTests.cs (1)
255
Contract
.ThrowIfNull(compilationOptions);
CSharpRemoveUnnecessaryNullableDirectiveTests.cs (1)
242
Contract
.ThrowIfNull(compilationOptions);
QuickInfo\SemanticQuickInfoSourceTests.cs (3)
49
Contract
.ThrowIfNull(service);
105
Contract
.ThrowIfNull(service);
257
Contract
.ThrowIfNull(service);
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (2)
128
Contract
.ThrowIfNull(pasteText);
130
Contract
.ThrowIfNull(json);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\Json\CSharpJsonParserTests_NstTests.cs (1)
19
Roslyn.Utilities.
Contract
.ThrowIfNull(tree);
Microsoft.CodeAnalysis.CSharp.Features (158)
AbstractAssignOutParametersCodeFixProvider.cs (1)
111
Contract
.ThrowIfNull(parameterList);
AnalyzedPattern.cs (1)
31
Contract
.ThrowIfNull(operation.SemanticModel);
ArrowExpressionClausePlacementCodeFixProvider.cs (1)
59
Contract
.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
338
Contract
.ThrowIfNull(syntaxRoot);
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (1)
242
Contract
.ThrowIfNull(attributeType);
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
76
Contract
.ThrowIfNull(semanticModel);
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
91
Contract
.ThrowIfNull(typeInferenceService, nameof(typeInferenceService));
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
110
Contract
.ThrowIfNull(namedType);
Completion\CompletionProviders\SnippetCompletionProvider.cs (1)
110
Contract
.ThrowIfNull(directive);
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
48
Contract
.ThrowIfNull(context);
ConditionalExpressionPlacementCodeFixProvider.cs (1)
59
Contract
.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (2)
50
Contract
.ThrowIfNull(newRoot);
54
Contract
.ThrowIfNull(newRoot);
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (3)
33
Contract
.ThrowIfNull(typeDeclaration); // checked by analyzer
185
Contract
.ThrowIfNull(methodDeclaration.Body); // checked by analyzer
258
Contract
.ThrowIfNull(field);
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
113
Contract
.ThrowIfNull(nextStatement);
ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (7)
94
Contract
.ThrowIfNull(_assignmentTarget);
105
Contract
.ThrowIfFalse(_assignmentTarget is IdentifierNameSyntax);
210
Contract
.ThrowIfNull(result);
237
Contract
.ThrowIfNull(armExpression);
279
Contract
.ThrowIfNull(node.Expression);
285
Contract
.ThrowIfNull(node.Expression);
294
Contract
.ThrowIfNull(result);
ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (3)
45
Contract
.ThrowIfNull(dataFlow);
64
Contract
.ThrowIfNull(declaration);
70
Contract
.ThrowIfNull(beforeSwitch);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (3)
198
Contract
.ThrowIfFalse(span.IntersectsWith(token.Span));
199
Contract
.ThrowIfFalse(token.Kind() == SyntaxKind.StringLiteralToken);
274
Contract
.ThrowIfTrue(characters.IsDefaultOrEmpty);
CSharpAddBracesDiagnosticAnalyzer.cs (1)
58
Contract
.ThrowIfNull(embeddedStatement);
CSharpAsAndMemberAccessCodeFixProvider.cs (2)
66
Contract
.ThrowIfNull(parent);
126
Contract
.ThrowIfNull(binaryExpression);
CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
133
Contract
.ThrowIfNull(isPatternExpression);
CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (7)
35
Contract
.ThrowIfNull(semanticModel);
36
Contract
.ThrowIfNull(localSymbol);
37
Contract
.ThrowIfNull(comparison);
38
Contract
.ThrowIfNull(operand);
283
Contract
.ThrowIfNull(statement);
309
Contract
.ThrowIfNull(scope);
377
Contract
.ThrowIfNull(dataFlow);
CSharpConvertTypeOfToNameOfCodeFixProvider.cs (1)
35
Contract
.ThrowIfNull(typeSymbol);
CSharpForEachCastCodeFixProvider.cs (1)
33
Contract
.ThrowIfNull(result);
CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
260
Contract
.ThrowIfNull(nextStatement);
265
Contract
.ThrowIfNull(dataFlow);
CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
128
Contract
.ThrowIfNull(semanticModel);
CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
79
Contract
.ThrowIfNull(currentAccessorList);
CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
53
Contract
.ThrowIfFalse(nodes.Any());
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
125
Contract
.ThrowIfNull(currentOptionsDirective);
157
Contract
.ThrowIfNull(currentOptionsDirective);
CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
38
Contract
.ThrowIfNull(options);
CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
46
Contract
.ThrowIfNull(compilationOptions);
CSharpUpgradeProjectCodeFixProvider.cs (2)
95
Contract
.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion));
109
Contract
.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion));
CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
59
Contract
.ThrowIfFalse(CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.GetWhenTrueAssignment(
CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
199
Contract
.ThrowIfNull(semanticModel);
CSharpUseNameofInAttributeCodeFixProvider.cs (1)
52
Contract
.ThrowIfNull(name);
CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
91
Contract
.ThrowIfNull(semanticModel);
CSharpUseRangeOperatorCodeFixProvider.cs (2)
147
Contract
.ThrowIfNull(instance);
199
Contract
.ThrowIfNull(result.Op2);
CSharpUseRangeOperatorDiagnosticAnalyzer.cs (4)
85
Contract
.ThrowIfNull(semanticModel);
148
Contract
.ThrowIfNull(invocation.Instance);
165
Contract
.ThrowIfNull(invocation.Instance);
214
Contract
.ThrowIfNull(invocation.Instance);
EditAndContinue\BreakpointSpans.cs (2)
246
Contract
.ThrowIfNull(property.AccessorList);
261
Contract
.ThrowIfNull(indexer.AccessorList);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (10)
569
Contract
.ThrowIfNull(oldDeclaration.Parent);
570
Contract
.ThrowIfNull(newDeclaration.Parent);
1167
Contract
.ThrowIfFalse(node.Parent is (kind:
1259
Contract
.ThrowIfNull(oldNode);
1287
Contract
.ThrowIfNull(oldNode);
1288
Contract
.ThrowIfNull(newNode);
1289
Contract
.ThrowIfNull(oldModel);
1411
Contract
.ThrowIfNull(oldNode);
1412
Contract
.ThrowIfNull(newNode);
1413
Contract
.ThrowIfNull(oldModel);
EditAndContinue\SyntaxComparer.cs (1)
914
Contract
.ThrowIfFalse(rightName.HasValue == leftName.HasValue);
ExtractMethod\CSharpMethodExtractor.Analyzer.cs (1)
59
Contract
.ThrowIfTrue(variable.UseAsReturnValue);
ExtractMethod\CSharpMethodExtractor.cs (4)
40
Contract
.ThrowIfFalse(originalSpanStart >= 0);
100
Contract
.ThrowIfNull(memberNode);
101
Contract
.ThrowIfTrue(memberNode.Kind() == SyntaxKind.NamespaceDeclaration);
174
Contract
.ThrowIfNull(type);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (16)
37
Contract
.ThrowIfNull(outmostCallSiteContainer);
38
Contract
.ThrowIfNull(variableToRemoveMap);
39
Contract
.ThrowIfNull(firstStatementOrFieldToReplace);
40
Contract
.ThrowIfNull(lastStatementOrFieldToReplace);
41
Contract
.ThrowIfNull(statementsOrFieldToInsert);
42
Contract
.ThrowIfTrue(statementsOrFieldToInsert.IsEmpty());
52
Contract
.ThrowIfFalse(_firstStatementOrFieldToReplace.Parent == _lastStatementOrFieldToReplace.Parent
72
Contract
.ThrowIfFalse(variable.Initializer == null);
280
Contract
.ThrowIfNull(statement);
305
Contract
.ThrowIfFalse(firstIndex >= 0);
308
Contract
.ThrowIfFalse(lastIndex >= 0);
310
Contract
.ThrowIfFalse(firstIndex <= lastIndex);
333
Contract
.ThrowIfFalse(firstMemberIndex >= 0);
336
Contract
.ThrowIfFalse(lastMemberIndex >= 0);
338
Contract
.ThrowIfFalse(firstMemberIndex <= lastMemberIndex);
377
Contract
.ThrowIfFalse(_firstStatementOrFieldToReplace == _lastStatementOrFieldToReplace);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (6)
88
Contract
.ThrowIfFalse(SemanticDocument == selectionResult.SemanticDocument);
133
Contract
.ThrowIfFalse(firstStatementToRemove.Parent == lastStatementToRemove.Parent
195
Contract
.ThrowIfTrue(AnalyzerResult.MethodTypeParametersInDeclaration.Count == 0);
217
Contract
.ThrowIfNull(declStatement);
218
Contract
.ThrowIfFalse(declStatement.Parent.IsStatementContainerNode());
740
Contract
.ThrowIfTrue(AnalyzerResult.HasVariableToUseAsReturnValue);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (4)
101
Contract
.ThrowIfFalse(IsExtractMethodOnExpression(CSharpSelectionResult));
161
Contract
.ThrowIfNull(container);
162
Contract
.ThrowIfFalse(container.IsStatementContainerNode() ||
194
Contract
.ThrowIfTrue(
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs (3)
50
Contract
.ThrowIfFalse(CSharpSyntaxFacts.Instance.AreStatementsInSameContainer(firstUnderContainer, lastUnderContainer));
112
Contract
.ThrowIfNull(node);
113
Contract
.ThrowIfFalse(node.IsStatementContainerNode());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.SingleStatementCodeGenerator.cs (1)
49
Contract
.ThrowIfFalse(IsExtractMethodOnSingleStatement(CSharpSelectionResult));
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (5)
26
Contract
.ThrowIfNull(semanticModel);
116
Contract
.ThrowIfNull(statement);
119
Contract
.ThrowIfNull(type);
129
Contract
.ThrowIfFalse(keyValuePair.Value.Count > 0);
153
Contract
.ThrowIfNull(statement);
ExtractMethod\CSharpSelectionResult.cs (10)
35
Contract
.ThrowIfNull(status);
36
Contract
.ThrowIfNull(document);
110
Contract
.ThrowIfTrue(SelectionInExpression);
114
Contract
.ThrowIfNull(statement);
121
Contract
.ThrowIfTrue(SelectionInExpression);
126
Contract
.ThrowIfNull(statement);
128
Contract
.ThrowIfFalse(CSharpSyntaxFacts.Instance.AreStatementsInSameContainer(statement, firstStatementUnderContainer));
135
Contract
.ThrowIfFalse(SelectionInExpression);
173
Contract
.ThrowIfFalse(last.IsParentKind(SyntaxKind.GlobalStatement));
174
Contract
.ThrowIfFalse(last.Parent.IsParentKind(SyntaxKind.CompilationUnit));
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (2)
41
Contract
.ThrowIfNull(SemanticDocument);
42
Contract
.ThrowIfFalse(SelectionInExpression);
ExtractMethod\CSharpSelectionResult.StatementResult.cs (3)
51
Contract
.ThrowIfNull(SemanticDocument);
52
Contract
.ThrowIfTrue(SelectionInExpression);
71
Contract
.ThrowIfTrue(SelectionInExpression);
ExtractMethod\CSharpSelectionValidator.cs (1)
509
Contract
.ThrowIfFalse(line.LineNumber > 0);
ExtractMethod\Extensions.cs (3)
34
Contract
.ThrowIfNull(node);
69
Contract
.ThrowIfNull(node);
100
Contract
.ThrowIfNull(node);
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
60
Contract
.ThrowIfNull(member);
InlineHints\CSharpInlineTypeHintsService.cs (1)
135
Contract
.ThrowIfFalse(displayAllOverride);
LineSeparators\CSharpLineSeparatorService.cs (2)
247
Contract
.ThrowIfNull(spans);
262
Contract
.ThrowIfNull(spans);
MakeLocalFunctionStaticCodeFixHelper.cs (1)
219
Contract
.ThrowIfNull(symbolType);
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
250
Contract
.ThrowIfNull(rewritten);
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (2)
303
Contract
.ThrowIfFalse(openBracket.Parent is BracketedArgumentListSyntax &&
345
Contract
.ThrowIfFalse(openBracket.Parent is ArrayRankSpecifierSyntax && openBracket.Parent.Parent is ArrayTypeSyntax);
SignatureHelp\GenericNamePartiallyWrittenSignatureHelpProvider.cs (1)
33
Contract
.ThrowIfTrue(nextToken.Kind() == 0);
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
164
Contract
.ThrowIfFalse(lessThanToken.Parent is TypeArgumentListSyntax && lessThanToken.Parent.Parent is GenericNameSyntax);
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
68
Contract
.ThrowIfFalse(includeInstance || includeStatic);
StringIndentation\CSharpStringIndentationService.cs (2)
174
Contract
.ThrowIfNull(offsetOpt);
185
Contract
.ThrowIfTrue(lastLine.LineNumber - firstLine.LineNumber < 2);
Structure\CSharpStructureHelpers.cs (3)
134
Contract
.ThrowIfNull(text);
135
Contract
.ThrowIfNull(prefix);
143
Contract
.ThrowIfFalse(comment.IsSingleLineComment() || comment.IsMultiLineComment());
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
21
Contract
.ThrowIfNull(trivia.SyntaxTree);
UseExpressionBodyHelper`1.cs (1)
84
Contract
.ThrowIfNull(body);
UseUtf8StringLiteralCodeFixProvider.cs (3)
53
Contract
.ThrowIfNull(readOnlySpanType);
61
Contract
.ThrowIfNull(arrayOp.Initializer);
150
Contract
.ThrowIfFalse(UseUtf8StringLiteralDiagnosticAnalyzer.TryConvertToUtf8String(builder, initializer.ElementValues));
UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
87
Contract
.ThrowIfNull(semanticModel);
Microsoft.CodeAnalysis.CSharp.Workspaces (81)
BlockSyntaxExtensions.cs (1)
110
Contract
.ThrowIfFalse(preference == ExpressionBodyPreference.WhenOnSingleLine);
CastSimplifier.cs (1)
176
Contract
.ThrowIfTrue(castNode.WalkUpParentheses().ContainsDiagnostics);
CodeGeneration\CSharpSyntaxGenerator.cs (6)
831
Contract
.ThrowIfNull(type);
1227
Contract
.ThrowIfNull(result);
2083
Contract
.ThrowIfNull(vd.Parent);
2986
Contract
.ThrowIfTrue(ReferenceEquals(root, node));
3007
Contract
.ThrowIfTrue(ReferenceEquals(root, declaration));
3159
Contract
.ThrowIfNull(expression);
CSharpAddImportsService.cs (1)
140
Contract
.ThrowIfNull(rewritten);
CSharpCodeGenerationHelpers.cs (2)
114
Contract
.ThrowIfNull(syntax);
268
Contract
.ThrowIfNull(symbol);
CSharpIndentationService.cs (2)
54
Contract
.ThrowIfNull(formattingRules);
55
Contract
.ThrowIfNull(root);
CSharpIndentationService.Indenter.cs (5)
76
Contract
.ThrowIfNull(indenter.Tree);
77
Contract
.ThrowIfTrue(token.Kind() == SyntaxKind.None);
127
Contract
.ThrowIfNull(interpolatedExpression);
272
Contract
.ThrowIfNull(nonTerminalNode, @"Malformed code or bug in parser???");
285
Contract
.ThrowIfNull(nonTerminalNode, @"Malformed code or bug in parser???");
CSharpInferredMemberNameSimplifier.cs (2)
64
Contract
.ThrowIfNull(toRemove.NameColon);
86
Contract
.ThrowIfNull(toRemove.NameEquals);
CSharpRemoveUnnecessaryImportsService.cs (1)
57
Contract
.ThrowIfNull(formattingOptions);
CSharpSmartTokenFormatter.cs (4)
36
Contract
.ThrowIfNull(root);
48
Contract
.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
49
Contract
.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
80
Contract
.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
CSharpTriviaFormatter.cs (1)
225
Contract
.ThrowIfFalse(multilineCommentTrivia.Count == 1);
CSharpTypeInferenceService.TypeInferrer.cs (4)
952
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != operatorToken);
1128
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != coalesceExpression.OperatorToken);
1945
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != prefixUnaryExpression.OperatorToken);
2001
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != awaitExpression.AwaitKeyword);
CSharpVirtualCharService.cs (3)
140
Contract
.ThrowIfFalse(tokenText is [.., 'u' or 'U', '8']);
146
Contract
.ThrowIfFalse(tokenText[0] == '"');
151
Contract
.ThrowIfFalse(tokenText[endIndexExclusive - 1] == '"');
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
275
Contract
.ThrowIfTrue(node is TypeDeclarationSyntax);
FormattingHelpers.cs (1)
486
Contract
.ThrowIfNull(node);
FormattingRangeHelper.cs (1)
22
Contract
.ThrowIfTrue(endToken.Kind() == SyntaxKind.None);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (1)
79
Contract
.ThrowIfTrue(sourceText == null && includePreviousTokenTrailingTriviaOnlyIfOnSameLine, "If we are including previous token trailing trivia, we need the text too.");
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
489
Contract
.ThrowIfNull(syntaxTree);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (2)
41
Contract
.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken);
45
Contract
.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken);
NamedTypeGenerator.cs (1)
228
Contract
.ThrowIfNull(invokeMethod);
NullableSyntaxAnnotationEx.cs (2)
29
Contract
.ThrowIfFalse(ReferenceEquals(Oblivious, NullableSyntaxAnnotation.Oblivious));
30
Contract
.ThrowIfFalse(ReferenceEquals(AnnotatedOrNotAnnotated, NullableSyntaxAnnotation.AnnotatedOrNotAnnotated));
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (1)
60
Contract
.ThrowIfNull(node);
ReassignedVariable\CSharpReassignedVariableService.cs (1)
51
Contract
.ThrowIfNull(current, "Couldn't find a suitable parent of this local declaration");
Rename\CSharpRenameRewriterLanguageService.cs (1)
875
Contract
.ThrowIfNull(tree);
SemanticModelExtensions.cs (1)
170
Contract
.ThrowIfNull(@using.NamespaceOrType);
SemanticModelReuse\CSharpSemanticModelReuseLanguageService.cs (2)
35
Contract
.ThrowIfFalse(accessor.Parent is AccessorListSyntax);
36
Contract
.ThrowIfFalse(accessor.Parent.Parent is BasePropertyDeclarationSyntax);
Simplification\CSharpSimplificationService.cs (3)
81
Contract
.ThrowIfNull(token.Parent);
174
Contract
.ThrowIfNull(syntaxNodeToSpeculate);
175
Contract
.ThrowIfFalse(SpeculationAnalyzer.CanSpeculateOnNode(nodeToSpeculate));
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (7)
42
Contract
.ThrowIfNull(options);
65
Contract
.ThrowIfNull(ParseOptions);
66
Contract
.ThrowIfNull(Options);
67
Contract
.ThrowIfNull(SemanticModel);
90
Contract
.ThrowIfNull(lastExpression.Parent);
105
Contract
.ThrowIfNull(lastPattern.Parent);
116
Contract
.ThrowIfNull(topMostCref.Parent);
SyntaxTriviaExtensions.cs (2)
121
Contract
.ThrowIfNull(trivia);
137
Contract
.ThrowIfNull(trivia);
TriviaDataFactory.Analyzer.cs (1)
128
Contract
.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind()));
TriviaDataFactory.CodeShapeAnalyzer.cs (3)
38
Contract
.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia);
39
Contract
.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia);
40
Contract
.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia);
TriviaDataFactory.ComplexTrivia.cs (1)
63
Contract
.ThrowIfFalse(triviaList.Count > 0);
TriviaDataFactory.cs (1)
108
Contract
.ThrowIfFalse(space >= -1);
TriviaDataFactory.FormattedComplexTrivia.cs (3)
32
Contract
.ThrowIfNull(context);
33
Contract
.ThrowIfNull(formattingRules);
34
Contract
.ThrowIfNull(originalString);
TriviaDataFactory.ModifiedComplexTrivia.cs (3)
24
Contract
.ThrowIfNull(original);
74
Contract
.ThrowIfFalse(this.SecondTokenIsFirstTokenOnLine);
80
Contract
.ThrowIfFalse(triviaList.Count > 0);
TriviaRewriter.cs (2)
34
Contract
.ThrowIfNull(node);
35
Contract
.ThrowIfNull(map);
TypeDeclarationSyntaxExtensions.cs (1)
71
Contract
.ThrowIfNull(typeNode);
TypeStyleHelper.cs (1)
133
Contract
.ThrowIfNull(containingType);
UsingsAndExternAliasesDirectiveComparer.cs (2)
128
Contract
.ThrowIfNull(using1!.Name);
129
Contract
.ThrowIfNull(using2!.Name);
UsingsAndExternAliasesOrganizer.cs (2)
84
Contract
.ThrowIfNull(using1.Name);
85
Contract
.ThrowIfNull(using2.Name);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
50
Contract
.ThrowIfNull(tokens);
Microsoft.CodeAnalysis.EditorFeatures (136)
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (2)
433
Contract
.ThrowIfFalse(SubjectBuffer.CurrentSnapshot[OpeningPoint.GetPosition(SubjectBuffer.CurrentSnapshot)] == OpeningBrace,
435
Contract
.ThrowIfFalse(SubjectBuffer.CurrentSnapshot[ClosingPoint.GetPosition(SubjectBuffer.CurrentSnapshot) - 1] == ClosingBrace,
BracePairs\BracePairsTaggerProvider.cs (1)
64
Contract
.ThrowIfNull(textView);
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (2)
62
Contract
.ThrowIfNull(textView);
82
Contract
.ThrowIfNull(textView);
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (2)
272
Contract
.ThrowIfTrue(snapshots.IsDefault || snapshots.IsEmpty);
388
Contract
.ThrowIfNull(lastProcessedSnapshot);
CodeDefinitionWindow\DefinitionContextTracker.cs (4)
71
Contract
.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
85
Contract
.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
100
Contract
.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
107
Contract
.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
CommentSelection\AbstractCommentSelectionBase.cs (2)
56
Contract
.ThrowIfNull(undoHistoryRegistry);
57
Contract
.ThrowIfNull(editorOperationsFactoryService);
Diagnostics\DiagnosticsSquiggleTaggerProvider.cs (2)
131
Contract
.ThrowIfFalse(tag1 is RoslynErrorTag);
132
Contract
.ThrowIfFalse(tag2 is RoslynErrorTag);
Diagnostics\DiagnosticsSuggestionTaggerProvider.cs (2)
67
Contract
.ThrowIfFalse(tag1 is RoslynErrorTag);
68
Contract
.ThrowIfFalse(tag2 is RoslynErrorTag);
DocumentationComments\AbstractDocumentationCommentCommandHandler.cs (3)
41
Contract
.ThrowIfNull(uiThreadOperationExecutor);
42
Contract
.ThrowIfNull(undoHistoryRegistry);
43
Contract
.ThrowIfNull(editorOperationsFactoryService);
EditAndContinue\ActiveStatementTaggerProvider.cs (1)
108
Contract
.ThrowIfFalse(tag1 == tag2, "ActiveStatementTag is a supposed to be a singleton");
EditAndContinue\ActiveStatementTrackingService.cs (5)
74
Contract
.Fail("Can only track active statements for a single edit session.");
86
Contract
.ThrowIfNull(session, "Active statement tracking not started.");
270
Contract
.ThrowIfFalse(oldSpan.Flags == newSpan.Flags);
271
Contract
.ThrowIfFalse(oldSpan.Ordinal == newSpan.Ordinal);
357
Contract
.ThrowIfTrue(activeStatementSpans.IsDefault);
EditAndContinue\EditAndContinueLanguageService.cs (4)
90
Contract
.ThrowIfNull(debuggingSession);
219
Contract
.ThrowIfNull(committedDesignTimeSolution);
247
Contract
.ThrowIfNull(Interlocked.Exchange(ref _pendingUpdatedDesignTimeSolution, null));
309
Contract
.ThrowIfNull(_committedDesignTimeSolution);
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
80
Contract
.ThrowIfNull(oldDocument.FilePath);
Editor\TextBufferAssociatedViewService.cs (1)
153
Contract
.ThrowIfTrue(set.Contains(view));
EditorConfigSettings\Data\CodeStyleSetting`1.cs (1)
35
Contract
.ThrowIfFalse(possibleValues.Length == valueDescriptions.Length);
EncapsulateField\AbstractEncapsulateFieldCommandHandler.cs (1)
87
Contract
.ThrowIfNull(document);
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
88
Contract
.ThrowIfNull(symbolItem.Location.OtherDocumentInfo);
Extensibility\NavigationBar\NavigationBarItem.cs (1)
75
Contract
.ThrowIfNull(item.TextVersion, "This should only be called for locations the caller knows to be in the open file");
ExternalAccess\VSTypeScript\VSTypeScriptInProcLanguageClient.cs (1)
91
Contract
.ThrowIfNull(typeScriptServerCapabilities);
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
78
Contract
.ThrowIfTrue(item.Spans.IsEmpty);
ExtractMethod\ExtractMethodCommandHandler.cs (4)
61
Contract
.ThrowIfNull(threadingContext);
62
Contract
.ThrowIfNull(undoManager);
63
Contract
.ThrowIfNull(renameService);
152
Contract
.ThrowIfNull(result);
FindReferences\FindReferencesCommandHandler.cs (1)
47
Contract
.ThrowIfNull(listenerProvider);
FindUsages\BufferedFindUsagesContext.cs (7)
62
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
70
Contract
.ThrowIfTrue(IsSwapped, "Should not be called if we've switched over to the streaming presenter");
77
Contract
.ThrowIfTrue(IsSwapped, "Should not be called if we've switched over to the streaming presenter");
84
Contract
.ThrowIfTrue(IsSwapped, "Should not be called if we've switched over to the streaming presenter");
91
Contract
.ThrowIfTrue(IsSwapped, "Should not be called if we've switched over to the streaming presenter");
98
Contract
.ThrowIfTrue(IsSwapped, "Trying to set the presenter multiple times.");
214
Contract
.Fail("GoToImpl/Base should never report a reference.");
GoToDefinition\GoToDefinitionCommandHandler.cs (2)
89
Contract
.ThrowIfNull(document);
174
Contract
.ThrowIfTrue(position.Snapshot.Length == 0);
InlineHints\InlineHintsDataTaggerProvider.cs (2)
67
Contract
.ThrowIfNull(textView);
89
Contract
.ThrowIfNull(textView);
InlineRename\AbstractEditorInlineRenameService.InlineRenameReplacementInfo.cs (1)
20
Contract
.ThrowIfFalse(conflicts.IsSuccessful);
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (1)
64
Contract
.ThrowIfTrue(info.IsError);
InlineRename\InlineRenameService.cs (2)
103
Contract
.ThrowIfNull(snapshot, "The document used for starting the inline rename session should still be open and associated with a snapshot.");
195
Contract
.ThrowIfTrue(_activeRenameSession != null && value != null, "Cannot assign an active rename session when one is already in progress.");
InlineRename\InlineRenameSession.cs (3)
225
Contract
.ThrowIfFalse(document.TryGetText(out var text));
226
Contract
.ThrowIfNull(text);
235
Contract
.ThrowIfNull(textSnapshot.TextBuffer);
InlineRename\UndoManagerServiceFactory.cs (1)
54
Contract
.ThrowIfFalse(textUndoHistoryService.TryGetTextUndoHistory(workspace, subjectBuffer, out var undoHistory));
IntelliSense\AbstractController.cs (2)
110
Contract
.ThrowIfFalse(IsSessionActive);
116
Contract
.ThrowIfTrue(IsSessionActive);
IntelliSense\AsyncCompletion\CommitManager.cs (2)
241
Contract
.ThrowIfNull(_languageServerSnippetExpander);
245
Contract
.ThrowIfNull(lspSnippetText);
IntelliSense\Helpers.cs (1)
262
Contract
.ThrowIfFalse(lines.Count > 0);
IntelliSense\ModelComputation.cs (2)
91
Contract
.ThrowIfTrue(_stopCancellationToken.IsCancellationRequested);
136
Contract
.ThrowIfTrue(_stopCancellationToken.IsCancellationRequested, "should not chain tasks after we've been cancelled");
IntelliSense\QuickInfo\Model.cs (1)
26
Contract
.ThrowIfNull(item);
IntelliSense\Session.cs (1)
44
Contract
.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));
Intents\RenameIntentProvider.cs (1)
39
Contract
.ThrowIfNull(renameIntentData);
Interactive\InteractiveSession.cs (1)
122
Contract
.ThrowIfFalse(result.InitializationResult != null);
Interactive\InteractiveWorkspace.cs (1)
57
Contract
.ThrowIfNull(_openTextContainer);
KeywordHighlighting\HighlighterViewTaggerProvider.cs (1)
129
Contract
.ThrowIfFalse(tag1 == tag2, "KeywordHighlightTag is supposed to be a singleton");
Preview\AbstractPreviewFactoryService.cs (1)
651
Contract
.ThrowIfTrue((leftWorkspace == null) && (rightWorkspace == null));
Preview\DifferenceViewerPreview.cs (1)
20
Contract
.ThrowIfNull(viewer);
ReferenceHighlighting\NavigateToHighlightReferenceCommandHandler.cs (2)
82
Contract
.ThrowIfFalse(spans.Any(), "We should have at least found the tag under the cursor!");
111
Contract
.ThrowIfFalse(destIndex >= 0, "Expected to find start tag in the collection");
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (2)
81
Contract
.ThrowIfNull(document, "Invoked rename tracking smart tag but cannot find the document for the snapshot span.");
88
Contract
.ThrowIfNull(symbol, "Invoked rename tracking smart tag but cannot find the symbol.");
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (1)
387
Contract
.ThrowIfFalse(_refCount >= 0);
Shared\Extensions\ITextSelectionExtensions.cs (2)
16
Contract
.ThrowIfNull(selection);
17
Contract
.ThrowIfNull(subjectBuffer);
Shared\Extensions\ITextViewExtensions.AutoClosingViewProperty.cs (3)
26
Contract
.ThrowIfTrue(textView.IsClosed);
47
Contract
.ThrowIfTrue(textView.IsClosed);
58
Contract
.ThrowIfTrue(textView.IsClosed);
Shared\Extensions\ITextViewExtensions.cs (9)
207
Contract
.ThrowIfNull(textView);
208
Contract
.ThrowIfNull(subjectBuffer);
209
Contract
.ThrowIfNull(valueCreator);
220
Contract
.ThrowIfNull(textView);
221
Contract
.ThrowIfNull(subjectBuffer);
232
Contract
.ThrowIfNull(textView);
233
Contract
.ThrowIfNull(subjectBuffer);
243
Contract
.ThrowIfNull(textView);
244
Contract
.ThrowIfNull(subjectBuffer);
Shared\Extensions\ITextViewExtensions.PerSubjectBufferProperty.cs (3)
35
Contract
.ThrowIfTrue(textView.IsClosed);
57
Contract
.ThrowIfTrue(textView.IsClosed);
69
Contract
.ThrowIfTrue(textView.IsClosed);
Shared\Extensions\IThreadingContextExtensions.cs (2)
13
=>
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
16
=>
Contract
.ThrowIfTrue(threadingContext.JoinableTaskContext.IsOnMainThread);
Shared\Tagging\EventSources\TaggerEventSources.CaretPositionChangedEventSource.cs (2)
19
Contract
.ThrowIfNull(textView);
20
Contract
.ThrowIfNull(subjectBuffer);
Shared\Tagging\EventSources\TaggerEventSources.CompositionEventSource.cs (1)
19
Contract
.ThrowIfNull(providers);
Shared\Tagging\EventSources\TaggerEventSources.ReadOnlyRegionsChangedEventSource.cs (1)
19
Contract
.ThrowIfNull(subjectBuffer);
Shared\Tagging\EventSources\TaggerEventSources.TextChangedEventSource.cs (1)
19
Contract
.ThrowIfNull(subjectBuffer);
Shared\Tagging\Utilities\TagSpanIntervalTree.cs (1)
96
Contract
.Fail(tag + " doesn't intersects with any requested span");
Shared\Utilities\AbstractClassificationTypeMap.cs (1)
37
Contract
.ThrowIfNull(rawValue);
Shared\Utilities\ForegroundThreadAffinitizedObject.cs (3)
32
Contract
.ThrowIfFalse(threadingContext.HasMainThread);
55
Contract
.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
59
=>
Contract
.ThrowIfTrue(IsForeground());
Shared\Utilities\LinkedEditsTracker.cs (2)
27
Contract
.ThrowIfNull(subjectBuffer);
61
Contract
.ThrowIfTrue(MyOwnChanges(args));
Shared\Utilities\ResettableDelay.cs (1)
30
Contract
.ThrowIfFalse(delayInMilliseconds >= 50, "Perf, only use delays >= 50ms");
Shared\Utilities\UIThreadOperationContextProgressTracker.cs (1)
19
Contract
.ThrowIfNull(scope);
Shared\Utilities\VirtualTreePoint.cs (3)
21
Contract
.ThrowIfNull(tree);
22
Contract
.ThrowIfFalse(position >= 0 && position <= tree.Length);
23
Contract
.ThrowIfFalse(virtualSpaces >= 0);
SolutionEvents\HostLegacySolutionEventsWorkspaceEventListener.cs (1)
66
Contract
.ThrowIfTrue(events.Any(e => e.OldSolution.Workspace != workspace || e.NewSolution.Workspace != workspace));
Structure\AbstractStructureTaggerProvider.cs (2)
229
Contract
.ThrowIfFalse(tag1 is StructureTag);
230
Contract
.ThrowIfFalse(tag2 is StructureTag);
Tagging\AbstractAsynchronousTaggerProvider.TagSource.cs (2)
263
Contract
.ThrowIfNull(_textView);
313
Contract
.ThrowIfTrue(_dataSource.Options.Any(o => o is not Option2<bool> and not PerLanguageOption2<bool>), "All options must be Option2<bool> or PerLanguageOption2<bool>");
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ReferenceCounting.cs (4)
24
Contract
.Fail($@"Should have been disposed!
40
Contract
.ThrowIfFalse(_taggers >= 0);
51
Contract
.ThrowIfFalse(_taggers > 0);
84
=>
Contract
.ThrowIfFalse(Thread.CurrentThread == _thread);
TextStructureNavigation\AbstractTextStructureNavigatorProvider.cs (2)
26
Contract
.ThrowIfNull(selectorService);
27
Contract
.ThrowIfNull(contentTypeService);
TextStructureNavigation\AbstractTextStructureNavigatorProvider.TextStructureNavigator.cs (3)
34
Contract
.ThrowIfNull(subjectBuffer);
35
Contract
.ThrowIfNull(naturalLanguageNavigator);
36
Contract
.ThrowIfNull(provider);
Workspaces\AbstractTextBufferVisibilityTracker.cs (4)
106
Contract
.ThrowIfFalse(_subjectBufferToCallbacks.TryGetValue(subjectBuffer, out var data));
107
Contract
.ThrowIfFalse(data.Callbacks.Contains(callback));
168
Contract
.ThrowIfTrue(Callbacks.Count > 0);
173
Contract
.ThrowIfTrue(TextViews.Count > 0);
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (36)
Controller.Session.cs (1)
33
Contract
.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));
Controller.Session_SetModelSelectedItem.cs (1)
39
Contract
.ThrowIfFalse(model.Items.Contains(selectedItem));
Model.cs (3)
44
Contract
.ThrowIfNull(selectedItem);
45
Contract
.ThrowIfFalse(items.Count != 0, "Must have at least one item.");
46
Contract
.ThrowIfFalse(items.Contains(selectedItem), "Selected item must be in list of items.");
NavigableSymbolService.NavigableSymbol.cs (1)
33
Contract
.ThrowIfNull(location);
NavigationCommandHandlers\AbstractNavigationCommandHandler.cs (1)
29
Contract
.ThrowIfNull(streamingPresenters);
NavigationCommandHandlers\FindBaseSymbolsCommandHandler.cs (1)
44
Contract
.ThrowIfNull(listenerProvider);
NavigationCommandHandlers\FindDerivedSymbolsCommandHandler.cs (1)
43
Contract
.ThrowIfNull(listenerProvider);
NavigationCommandHandlers\FindExtensionMethodsCommandHandler.cs (1)
48
Contract
.ThrowIfNull(listenerProvider);
NavigationCommandHandlers\FindImplementingMembersCommandHandler.cs (1)
46
Contract
.ThrowIfNull(listenerProvider);
NavigationCommandHandlers\FindMemberOverloadsCommandHandler.cs (1)
41
Contract
.ThrowIfNull(listenerProvider);
NavigationCommandHandlers\FindReferencesOfOverloadsCommandHandler.cs (3)
49
Contract
.ThrowIfNull(streamingPresenters);
50
Contract
.ThrowIfNull(listenerProvider);
51
Contract
.ThrowIfNull(threadingContext);
Preview\ICocoaDifferenceViewerExtensions.cs (3)
79
Contract
.ThrowIfNull(_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot);
117
Contract
.ThrowIfFalse(IsNormal(_width));
121
Contract
.ThrowIfFalse(IsNormal(_height));
Preview\PreviewFactoryService.cs (1)
66
Contract
.ThrowIfFalse(mode == DifferenceViewMode.Inline);
SignatureHelpPresenter.SignatureHelpPresenterSession.cs (2)
103
Contract
.ThrowIfNull(_signatureMap);
166
Contract
.ThrowIfFalse(_signatureMap.TryGetKey((Signature)eventArgs.NewSelectedSignature, out var helpItem));
Snippets\AbstractSnippetExpansionClient.cs (2)
90
Contract
.ThrowIfNull(ExpansionSession);
114
Contract
.ThrowIfNull(ExpansionSession);
Snippets\CSharpSnippets\SnippetExpansionClient.cs (1)
35
Contract
.ThrowIfNull(ExpansionSession);
Snippets\CSharpSnippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (1)
55
Contract
.ThrowIfNull(_snippetExpansionClient.ExpansionSession);
Snippets\SnippetFunctions\AbstractSnippetFunctionClassName.cs (1)
33
Contract
.ThrowIfNull(_snippetExpansionClient.ExpansionSession);
Snippets\SnippetFunctions\AbstractSnippetFunctionGenerateSwitchCases.cs (1)
80
Contract
.ThrowIfNull(_snippetExpansionClient.ExpansionSession);
Snippets\SnippetFunctions\AbstractSnippetFunctionSimpleTypeName.cs (1)
57
Contract
.ThrowIfNull(_snippetExpansionClient.ExpansionSession);
SuggestedAction.CaretPositionRestorer.cs (1)
34
Contract
.ThrowIfNull(associatedViewService);
SuggestedAction.cs (2)
56
Contract
.ThrowIfNull(provider);
57
Contract
.ThrowIfNull(codeAction);
SuggestedActionsSource.cs (2)
365
Contract
.ThrowIfFalse(
424
Contract
.ThrowIfNull(priority);
SuggestedActionsSourceProvider.cs (2)
91
Contract
.ThrowIfNull(textView);
92
Contract
.ThrowIfNull(textBuffer);
SuggestedActionWithNestedFlavors.cs (1)
80
Contract
.ThrowIfTrue(_nestedFlavors.IsDefault);
Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities (1)
Diagnostics\AbstractUserDiagnosticTest.cs (1)
93
Contract
.ThrowIfTrue(parameters.testHost == TestHost.OutOfProcess, $"Out-of-proc testing is not supported since {analyzer} can't be serialized.");
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (36)
Completion\AbstractArgumentProviderTests`1.cs (3)
69
Contract
.ThrowIfNull(parameter);
104
Contract
.ThrowIfTrue(arguments.Any(argument => syntaxFacts.IsNamedArgument(argument)), "Named arguments are not currently supported by this test.");
105
Contract
.ThrowIfTrue(parameters.Any(parameter => parameter.IsParams), "'params' parameters are not currently supported by this test.");
Diagnostics\GenerateType\GenerateTypeTestState.cs (2)
37
Contract
.ThrowIfNull(_testDocument, "markup does not contain a cursor position");
49
Contract
.ThrowIfNull(ProjectToBeModified, "Project with the given name does not exist");
EditAndContinue\ActiveStatementsDescription.cs (1)
267
Contract
.ThrowIfTrue(result.Any(span => span == default));
EditAndContinue\EditAndContinueTestHelpers.cs (3)
150
Contract
.ThrowIfNull(oldModel);
151
Contract
.ThrowIfNull(newModel);
350
Contract
.ThrowIfNull(actualSyntaxMap);
NavigateTo\NavigateToTestAggregator.Callback.cs (1)
27
Contract
.ThrowIfNull(options);
NavigateTo\NavigateToTestAggregator.cs (1)
26
Contract
.ThrowIfNull(itemProvider);
Workspaces\TestHostDocument.cs (9)
70
Contract
.ThrowIfNull(_id);
79
Contract
.ThrowIfNull(_project);
126
Contract
.ThrowIfNull(filePath);
195
Contract
.ThrowIfFalse(project.Id == this.Id.ProjectId);
226
Contract
.ThrowIfNull(_exportProvider, $"Can only create text view for {nameof(TestHostDocument)} created with {nameof(ExportProvider)}");
257
Contract
.ThrowIfNull(_languageServiceProvider, $"To get a text buffer for a {nameof(TestHostDocument)}, it must have been parented in a project.");
278
Contract
.ThrowIfNull(document);
318
Contract
.ThrowIfNull(_initialTextSnapshot);
360
Contract
.ThrowIfTrue(IsSourceGenerated, "We shouldn't be producing a DocumentInfo for a source generated document.");
Workspaces\TestWorkspace.cs (14)
684
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
692
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
693
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
702
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
710
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
711
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
720
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
728
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
729
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
738
Contract
.ThrowIfFalse(testDocument.IsSourceGenerated);
746
Contract
.ThrowIfFalse(testDocument.IsSourceGenerated);
747
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
750
Contract
.ThrowIfNull(document);
829
Contract
.ThrowIfFalse(threadingContext.HasMainThread && threadingContext.JoinableTaskContext.IsOnMainThread);
Workspaces\TestWorkspace_XmlConsumption.cs (1)
814
Contract
.ThrowIfTrue(cursorPosition != null);
Workspaces\TestWorkspace_XmlCreation.cs (1)
130
Contract
.ThrowIfFalse(options.SpecificDiagnosticOptions.IsEmpty);
Microsoft.CodeAnalysis.EditorFeatures.Text (16)
Extensions.SnapshotSourceText.cs (6)
42
Contract
.ThrowIfNull(editorSnapshot);
53
Contract
.ThrowIfNull(textImage);
103
Contract
.ThrowIfFalse(editorSnapshot.TextBuffer == container.GetTextBuffer());
230
Contract
.ThrowIfNull(editorSnapshot);
233
Contract
.ThrowIfNull(textImage);
247
Contract
.ThrowIfFalse(snapshot == editorSnapshot);
Extensions.TextBufferContainer.cs (1)
30
Contract
.ThrowIfNull(editorBuffer);
Shared\Extensions\ITextSnapshotExtensions.cs (3)
112
Contract
.ThrowIfNull(snapshot);
119
Contract
.ThrowIfNull(snapshot);
137
Contract
.ThrowIfNull(snapshot);
Shared\Extensions\ITextSnapshotLineExtensions.cs (6)
23
Contract
.ThrowIfNull(line);
45
Contract
.ThrowIfNull(line);
72
Contract
.ThrowIfNull(line, "line");
73
Contract
.ThrowIfFalse(startIndex >= 0);
95
Contract
.ThrowIfNull(line, @"line");
96
Contract
.ThrowIfNull(predicate, @"tree");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (12)
Diagnostics\DiagnosticsSquiggleTaggerProviderTests.cs (2)
153
Contract
.ThrowIfNull(tagger);
201
Contract
.ThrowIfNull(tagger);
EditAndContinue\RemoteEditAndContinueServiceTests.cs (1)
172
Contract
.ThrowIfNull(sessionProxy);
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (4)
77
Contract
.ThrowIfNull(symbol);
97
Contract
.ThrowIfNull(symbol);
192
Contract
.ThrowIfNull(assemblySymbol);
329
Contract
.ThrowIfNull(symbol);
Preview\PreviewWorkspaceTests.cs (2)
202
Contract
.ThrowIfNull(leftTagger);
203
Contract
.ThrowIfNull(rightTagger);
Tagging\AsynchronousTaggerTests.cs (3)
77
Contract
.ThrowIfNull(tagger);
103
Contract
.ThrowIfNull(tagger);
129
Contract
.ThrowIfNull(tagger);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (45)
Adornments\AbstractAdornmentManager.cs (11)
66
Contract
.ThrowIfNull(threadingContext);
67
Contract
.ThrowIfNull(textView);
68
Contract
.ThrowIfNull(tagAggregatorFactoryService);
69
Contract
.ThrowIfNull(adornmentLayerName);
70
Contract
.ThrowIfNull(asyncListener);
79
Contract
.ThrowIfFalse(textView.VisualElement.Dispatcher.CheckAccess());
110
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
142
Contract
.ThrowIfNull(spans);
205
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
230
Contract
.ThrowIfNull(changedSpanCollection);
233
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
BackgroundWorkIndicator\BackgroundWorkIndicatorContext.cs (4)
193
Contract
.ThrowIfTrue(requests.IsDefault || requests.IsEmpty, "We must have gotten an actual request to process.");
194
Contract
.ThrowIfTrue(requests.Count > 2, "At most we can have two requests in the queue (one to update, one to dismiss).");
195
Contract
.ThrowIfFalse(
264
Contract
.ThrowIfFalse(_scopes.Contains(scope));
BackgroundWorkIndicator\BackgroundWorkIndicatorScope.cs (1)
44
Contract
.ThrowIfFalse(Monitor.IsEntered(_context.Gate));
InlineDiagnostics\InlineDiagnosticsAdornmentManager.cs (3)
58
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
83
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
109
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
Interactive\InteractiveEvaluator.cs (1)
242
Contract
.ThrowIfNull(currentSubmissionBuffer);
Interactive\InteractiveGlobalUndoServiceFactory.cs (1)
65
Contract
.ThrowIfFalse(_undoHistoryRegistry.TryGetHistory(textBuffer, out var textUndoHistory));
IWpfDifferenceViewerExtensions.cs (3)
80
Contract
.ThrowIfNull(_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot);
120
Contract
.ThrowIfFalse(IsNormal(_width));
124
Contract
.ThrowIfFalse(IsNormal(_height));
LineSeparators\LineSeparatorAdornmentManager.cs (1)
27
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
NavigableSymbols\NavigableSymbolService.NavigableSymbol.cs (1)
33
Contract
.ThrowIfNull(location);
NavigateTo\NavigateToItemProvider.cs (2)
36
Contract
.ThrowIfNull(workspace);
37
Contract
.ThrowIfNull(asyncListener);
Preview\PreviewFactoryService.cs (1)
73
Contract
.ThrowIfFalse(mode == DifferenceViewMode.Inline);
SignatureHelp\Controller.Session.cs (1)
33
Contract
.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));
SignatureHelp\Controller.Session_SetModelSelectedItem.cs (1)
39
Contract
.ThrowIfFalse(model.Items.Contains(selectedItem));
SignatureHelp\Model.cs (3)
44
Contract
.ThrowIfNull(selectedItem);
45
Contract
.ThrowIfFalse(items.Count != 0, "Must have at least one item.");
46
Contract
.ThrowIfFalse(items.Contains(selectedItem), "Selected item must be in list of items.");
SignatureHelp\Presentation\SignatureHelpPresenter.SignatureHelpPresenterSession.cs (2)
103
Contract
.ThrowIfNull(_signatureMap);
166
Contract
.ThrowIfFalse(_signatureMap.TryGetKey((Signature)eventArgs.NewSelectedSignature, out var helpItem));
StringIndentation\StringIndentationAdornmentManager.cs (1)
35
Contract
.ThrowIfFalse(TextView.VisualElement.Dispatcher.CheckAccess());
Suggestions\SuggestedActions\SuggestedAction.CaretPositionRestorer.cs (1)
34
Contract
.ThrowIfNull(associatedViewService);
Suggestions\SuggestedActions\SuggestedAction.cs (2)
56
Contract
.ThrowIfNull(provider);
57
Contract
.ThrowIfNull(codeAction);
Suggestions\SuggestedActionsSource.cs (2)
365
Contract
.ThrowIfFalse(
424
Contract
.ThrowIfNull(priority);
Suggestions\SuggestedActionsSourceProvider.cs (2)
91
Contract
.ThrowIfNull(textView);
92
Contract
.ThrowIfNull(textBuffer);
Suggestions\SuggestedActionWithNestedFlavors.cs (1)
80
Contract
.ThrowIfTrue(_nestedFlavors.IsDefault);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
CodeFixes\CodeFixServiceTests.vb (2)
238
Contract
.ThrowIfFalse(context.Document.Project.Language = LanguageNames.CSharp)
263
Contract
.ThrowIfFalse(context.Document.Project.Language = LanguageNames.CSharp)
IntelliSense\SignatureHelpControllerTests.vb (1)
264
Roslyn.Utilities.
Contract
.ThrowIfFalse(s_controllerMocksMap.TryGetValue(controller, result))
Microsoft.CodeAnalysis.ExternalAccess.Debugger (2)
GlassTestsHotReloadService.cs (2)
42
Contract
.ThrowIfFalse(_sessionId == default, "Session already started");
49
Contract
.ThrowIfFalse(sessionId != default, "Session has not started");
Microsoft.CodeAnalysis.ExternalAccess.FSharp (6)
Internal\Editor\FSharpSmartIndentProvider.cs (2)
45
Contract
.ThrowIfTrue(service == null && legacyService == null);
100
Contract
.ThrowIfNull(_provider._legacyService);
SignatureHelp\FSharpSignatureHelpItems.cs (3)
67
Contract
.ThrowIfNull(items);
68
Contract
.ThrowIfTrue(items.IsEmpty());
69
Contract
.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value >= items.Count);
SignatureHelp\FSharpSignatureHelpTriggerInfo.cs (1)
18
Contract
.ThrowIfTrue(triggerReason == FSharpSignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null);
Microsoft.CodeAnalysis.ExternalAccess.Razor (3)
RazorCSharpFormattingInteractionService.cs (3)
41
Contract
.ThrowIfFalse(document.Project.Language is LanguageNames.CSharp);
67
Contract
.ThrowIfFalse(root.Language is LanguageNames.CSharp);
77
Contract
.ThrowIfFalse(root.Language is LanguageNames.CSharp);
Microsoft.CodeAnalysis.Features (402)
AbstractAddAccessibilityModifiersCodeFixProvider.cs (1)
54
Contract
.ThrowIfNull(symbol);
AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
78
Contract
.ThrowIfNull(obsoleteAttribute);
AbstractForEachCastCodeFixProvider.cs (2)
70
Contract
.ThrowIfNull(variableDeclarator.Symbol.Type);
71
Contract
.ThrowIfNull(enumerableType);
AbstractForEachCastDiagnosticAnalyzer.cs (1)
67
Contract
.ThrowIfFalse(option.Value is ForEachExplicitCastInSourcePreference.Always or ForEachExplicitCastInSourcePreference.WhenStronglyTyped);
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
81
Contract
.ThrowIfNull(symbol);
AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
110
Contract
.ThrowIfNull(node);
117
Contract
.ThrowIfNull(methodSymbol);
AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
59
Contract
.ThrowIfNull(methodSymbol);
256
Contract
.ThrowIfNull(currentInvocationExpression);
AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (1)
36
Contract
.ThrowIfNull(options);
AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
82
Contract
.ThrowIfNull(newRoot);
AbstractRemoveUnusedMembersCodeFixProvider.cs (2)
59
Contract
.ThrowIfNull(symbol);
72
Contract
.ThrowIfNull(fieldDeclarator);
AbstractRemoveUnusedValuesCodeFixProvider.cs (6)
485
Contract
.ThrowIfNull(variableDeclarator);
501
Contract
.ThrowIfFalse(node.GetRequiredParent().Parent is TExpressionStatementSyntax);
591
Contract
.ThrowIfNull(type);
592
Contract
.ThrowIfNull(newLocalNameOpt);
853
Contract
.ThrowIfNull(declStatement);
894
Contract
.ThrowIfNull(rootWithRemovedDeclaration);
AbstractSimplifyInterpolationHelpers.cs (3)
79
Contract
.ThrowIfNull(expression.SemanticModel);
139
Contract
.ThrowIfNull(operation.SemanticModel);
158
Contract
.ThrowIfNull(operation.SemanticModel);
AbstractUseCollectionInitializerCodeFixProvider.cs (1)
94
Contract
.ThrowIfNull(statement);
AbstractUseNullPropagationCodeFixProvider.cs (1)
161
Contract
.ThrowIfNull(newWhenTrueStatement);
AbstractUseObjectInitializerCodeFixProvider.cs (1)
95
Contract
.ThrowIfNull(statement);
AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
80
Contract
.ThrowIfNull(semanticModel);
AddAccessibilityModifiersHelpers.cs (1)
17
Contract
.ThrowIfNull(symbol);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
72
Contract
.ThrowIfNull(constructorDocument);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
185
Contract
.ThrowIfNull(changedSolution);
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (1)
28
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.ReferenceAssemblySymbol);
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (1)
42
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.PackageSymbol);
AddImport\CodeActions\MetadataSymbolReferenceCodeAction.cs (1)
25
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.MetadataSymbol);
AddImport\CodeActions\ParentInstallPackageCodeAction.cs (1)
47
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.PackageSymbol);
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (1)
35
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.ProjectSymbol);
AddImport\SearchScopes\ProjectSearchScope.cs (1)
25
Contract
.ThrowIfFalse(project.SupportsCompilation);
CodeFixes\Configuration\ConfigurationUpdater.cs (2)
167
Contract
.ThrowIfFalse(!string.IsNullOrEmpty(category));
190
Contract
.ThrowIfNull(category);
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
113
Contract
.ThrowIfNull(defaultValue);
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (1)
238
Contract
.ThrowIfFalse(batchOfFixes.Any());
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (4)
148
Contract
.ThrowIfFalse(!diagnostic.IsSuppressed);
167
Contract
.ThrowIfFalse(diagnostic.Location.IsInSource);
172
Contract
.ThrowIfNull(targetSymbol);
189
Contract
.ThrowIfFalse(!diagnostic.Location.IsInSource);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (2)
182
Contract
.ThrowIfFalse(indexOfTriviaToRemoveOrToggle >= 0);
189
Contract
.ThrowIfFalse(triviaToToggle != default);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (2)
93
Contract
.ThrowIfNull(result);
123
Contract
.ThrowIfNull(localFunctionResult);
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
273
Contract
.ThrowIfNull(symbol);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (2)
872
Contract
.ThrowIfNull(x);
873
Contract
.ThrowIfNull(y);
Completion\Providers\AbstractAwaitCompletionProvider.cs (3)
118
Contract
.ThrowIfTrue(dotAwaitContext == DotAwaitContext.None);
199
Contract
.ThrowIfFalse(dotToken.HasValue);
200
Contract
.ThrowIfNull(expr);
Completion\Providers\AbstractCrefCompletionProvider.cs (1)
36
Contract
.ThrowIfNull(semanticModel);
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (4)
131
Contract
.ThrowIfNull(containingType);
172
Contract
.ThrowIfNull(targetToken);
191
Contract
.ThrowIfNull(position);
218
Contract
.ThrowIfNull(root);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
52
Contract
.ThrowIfNull(enclosing);
Completion\Providers\AbstractOverrideCompletionProvider.ItemGetter.cs (1)
114
Contract
.ThrowIfNull(containingType);
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (1)
213
Contract
.ThrowIfNull(context);
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
246
Contract
.ThrowIfNull(syntaxContext);
324
Contract
.ThrowIfNull(syntaxContext);
Completion\Providers\CompletionUtilities.cs (1)
47
Contract
.ThrowIfNull(solution);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
98
Contract
.ThrowIfTrue(quotedPath[0] != '"');
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (1)
58
Contract
.ThrowIfNull(snippetText);
Completion\Providers\Snippets\SnippetCompletionItem.cs (3)
47
Contract
.ThrowIfFalse(item.Properties.TryGetValue(SnippetIdentifierKey, out var text));
53
Contract
.ThrowIfFalse(item.Properties.TryGetValue("Position", out var text));
54
Contract
.ThrowIfFalse(int.TryParse(text, out var num));
Completion\Utilities.cs (1)
54
Contract
.ThrowIfFalse(document.SupportsSemanticModel, "Should only be called from C#/VB providers.");
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
82
Contract
.ThrowIfNull(document.DocumentState.ParseOptions);
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (3)
65
Contract
.ThrowIfTrue(placeholderIndex < 0);
236
Contract
.ThrowIfNull(literalExpression);
258
Contract
.ThrowIfTrue(placeholderIndex < 0);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
538
Contract
.ThrowIfNull(containingMember,
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
212
Contract
.ThrowIfNull(document.FilePath);
DiagnosticHelper.cs (3)
186
Contract
.ThrowIfTrue(additionalLocations.IsEmpty());
187
Contract
.ThrowIfTrue(tagIndices.IsEmpty());
197
Contract
.ThrowIfFalse(indices.All(idx => idx >= 0 && idx < additionalLocationsLength));
Diagnostics\LiveDiagnosticUpdateArgsId.cs (1)
19
Contract
.ThrowIfNull(projectOrDocumentId);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
115
Contract
.ThrowIfNull(symbol);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (51)
544
Contract
.ThrowIfNull(newTree);
813
Contract
.ThrowIfFalse(newExceptionRegions[i].IsDefault);
825
Contract
.ThrowIfFalse(hasPartner);
862
Contract
.ThrowIfFalse(statementPart == -1);
864
Contract
.ThrowIfNull(newStatement);
1011
Contract
.ThrowIfNull(oldStatementSyntax);
1332
Contract
.ThrowIfNull(newStatementSyntax);
2043
Contract
.ThrowIfNull(oldNode);
2044
Contract
.ThrowIfNull(newNode);
2461
Contract
.ThrowIfNull(symbol);
2596
Contract
.ThrowIfNull(oldModel);
2597
Contract
.ThrowIfNull(oldSymbol);
2598
Contract
.ThrowIfNull(oldDeclaration);
2772
Contract
.ThrowIfNull(newModel);
2773
Contract
.ThrowIfNull(newSymbol);
2774
Contract
.ThrowIfNull(newDeclaration);
2802
Contract
.ThrowIfNull(oldDeclaration);
2827
Contract
.ThrowIfNull(oldDeclaration);
2977
Contract
.ThrowIfFalse(newSymbol is INamedTypeSymbol || IsGlobalMain(newSymbol));
2995
Contract
.ThrowIfNull(newContainingType);
2996
Contract
.ThrowIfNull(oldContainingType);
3024
Contract
.ThrowIfFalse(editKind == SemanticEditKind.Insert);
3032
Contract
.ThrowIfNull(oldModel);
3033
Contract
.ThrowIfNull(newModel);
3034
Contract
.ThrowIfNull(oldSymbol);
3035
Contract
.ThrowIfNull(newSymbol);
3046
Contract
.ThrowIfNull(oldDeclaration);
3047
Contract
.ThrowIfNull(newDeclaration);
3114
Contract
.ThrowIfFalse(editKind is SemanticEditKind.Update or SemanticEditKind.Insert);
3118
Contract
.ThrowIfNull(oldSymbol);
3171
Contract
.ThrowIfNull(oldDeclaration);
3175
Contract
.ThrowIfNull(newDeclaration);
3204
Contract
.ThrowIfNull(oldModel);
3205
Contract
.ThrowIfNull(newModel);
3210
Contract
.ThrowIfNull(newSymbol);
3211
Contract
.ThrowIfNull(oldSymbol);
3220
Contract
.ThrowIfNull(oldDeclaration);
3221
Contract
.ThrowIfNull(newDeclaration);
3225
Contract
.ThrowIfNull(oldContainingType);
3226
Contract
.ThrowIfNull(newContainingType);
3256
Contract
.ThrowIfFalse(IsConstructorWithMemberInitializers(oldDeclaration) == IsConstructorWithMemberInitializers(newDeclaration));
3257
Contract
.ThrowIfFalse(IsDeclarationWithInitializer(oldDeclaration) == IsDeclarationWithInitializer(newDeclaration));
3495
Contract
.ThrowIfNull(processedSymbols);
3521
Contract
.ThrowIfNull(processedSymbols);
3573
Contract
.ThrowIfNull(oldType);
3606
Contract
.ThrowIfNull(newType);
3911
Contract
.ThrowIfNull(newType.DelegateInvokeMethod);
4937
Contract
.ThrowIfNull(oldModel);
4939
Contract
.ThrowIfFalse(oldCtor is IMethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.StaticConstructor });
4972
Contract
.ThrowIfTrue(firstSpan.IsEmpty);
5031
Contract
.ThrowIfFalse(isStatic || oldCtor != null);
EditAndContinue\ActiveStatementExceptionRegions.cs (1)
24
Contract
.ThrowIfTrue(spans.IsDefault);
EditAndContinue\CommittedSolution.cs (5)
143
Contract
.ThrowIfFalse(currentDocument == null || documentId == currentDocument.Id);
222
Contract
.ThrowIfNull(document.FilePath);
312
Contract
.ThrowIfNull(document.FilePath);
382
Contract
.ThrowIfNull(sourceFilePath);
473
Contract
.ThrowIfNull(document.FilePath);
EditAndContinue\DebuggingSession.cs (3)
655
Contract
.ThrowIfNull(document.FilePath);
782
Contract
.ThrowIfNull(mappedDocument.FilePath);
904
Contract
.ThrowIfTrue(analysis.ActiveStatements.IsDefault);
EditAndContinue\DocumentActiveStatementChanges.cs (2)
22
Contract
.ThrowIfFalse(oldSpans.Length == newStatements.Length);
23
Contract
.ThrowIfFalse(oldSpans.Length == newExceptionRegions.Length);
EditAndContinue\EditAndContinueWorkspaceService.cs (5)
127
Contract
.ThrowIfTrue(captureAllMatchingDocuments && !captureMatchingDocuments.IsEmpty);
177
Contract
.ThrowIfNull(debuggingSession, "Debugging session has not started.");
187
Contract
.ThrowIfNull(debuggingSession);
217
Contract
.ThrowIfNull(debuggingSession);
225
Contract
.ThrowIfNull(debuggingSession);
EditAndContinue\EditSession.cs (11)
159
Contract
.ThrowIfTrue(documentAnalyses.IsEmpty);
630
Contract
.ThrowIfTrue(analysis.HasChangesAndErrors);
633
Contract
.ThrowIfTrue(analysis.ActiveStatements.IsDefault);
683
Contract
.ThrowIfNull(oldResolution.Symbol);
694
Contract
.ThrowIfNull(newResolution.Symbol);
700
Contract
.ThrowIfNull(newResolution.Symbol);
720
Contract
.ThrowIfNull(newSymbol);
980
Contract
.ThrowIfNull(oldCompilation);
981
Contract
.ThrowIfNull(newCompilation);
991
Contract
.ThrowIfNull(newCompilation);
1013
Contract
.ThrowIfNull(emitResult.Baseline);
EditAndContinue\EditSessionTelemetry.cs (1)
32
Contract
.ThrowIfNull(telemetry._inBreakState);
EditAndContinue\EmitSolutionUpdateResults.cs (1)
113
Contract
.ThrowIfNull(document);
EditAndContinue\TraceLog.cs (1)
143
Contract
.ThrowIfNull(_logDirectory);
EmbeddedLanguages\AbstractEmbeddedLanguageFeatureService.cs (1)
99
Contract
.ThrowIfTrue(services.IsDefaultOrEmpty);
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (3)
221
Contract
.ThrowIfNull(startString);
222
Contract
.ThrowIfNull(lengthString);
223
Contract
.ThrowIfNull(newText);
EmbeddedLanguages\ExportEmbeddedLanguageFeatureServiceAttribute.cs (2)
57
Contract
.ThrowIfFalse(contractType.IsInterface && typeof(IEmbeddedLanguageFeatureService).IsAssignableFrom(contractType),
62
Contract
.ThrowIfFalse(name is PredefinedEmbeddedLanguageNames.Regex or PredefinedEmbeddedLanguageNames.Json,
EmbeddedLanguages\RegularExpressions\RegexParser.cs (3)
883
Contract
.ThrowIfFalse(comment.HasValue);
1394
Contract
.ThrowIfNull(last);
1741
Contract
.ThrowIfNull(number);
EmbeddedLanguages\StackFrame\StackFrameParser.cs (2)
90
Contract
.ThrowIfFalse(_lexer.Position == _lexer.Text.Length);
91
Contract
.ThrowIfFalse(eolToken.Kind == StackFrameKind.EndOfFrame);
EncapsulateField\AbstractEncapsulateFieldService.cs (2)
140
Contract
.ThrowIfTrue(fields.Length == 0);
320
Contract
.ThrowIfFalse(resolution.IsSuccessful);
ExternalAccess\UnitTesting\API\NewUnitTestingIncrementalAnalyzerProvider.cs (1)
45
Contract
.ThrowIfNull(workspaceKind);
ExternalAccess\UnitTesting\API\UnitTestingHotReloadService.cs (3)
96
Contract
.ThrowIfFalse(_sessionId == default, "Session already started");
114
Contract
.ThrowIfFalse(sessionId != default, "Session has not started");
155
Contract
.ThrowIfFalse(_sessionId != default, "Session has not started");
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingIdleProcessor.cs (2)
59
Contract
.ThrowIfFalse(_processorTask == null);
90
Contract
.ThrowIfTrue(_isPaused_doNotAccessDirectly);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingSolutionCrawlerRegistrationService.cs (3)
60
Contract
.ThrowIfNull(workspaceKind);
135
Contract
.ThrowIfNull(workspaceKind);
158
Contract
.ThrowIfNull(workspaceKind);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (10)
266
Contract
.ThrowIfNull(args.ProjectId);
272
Contract
.ThrowIfNull(args.ProjectId);
277
Contract
.ThrowIfNull(args.ProjectId);
282
Contract
.ThrowIfNull(args.DocumentId);
288
Contract
.ThrowIfNull(args.DocumentId);
293
Contract
.ThrowIfNull(args.DocumentId);
306
Contract
.ThrowIfNull(args.ProjectId);
704
Contract
.ThrowIfNull(_projectOrDocumentIds);
752
Contract
.ThrowIfNull(_projectOrDocumentIds);
795
Contract
.ThrowIfNull(_projectOrDocumentIds);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs (2)
112
Contract
.ThrowIfNull(lowPriorityDocumentId);
118
Contract
.ThrowIfNull(item.DocumentId);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs (1)
122
Contract
.ThrowIfNull(item.DocumentId);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (3)
66
Contract
.ThrowIfFalse(item.DocumentId != null, "can only enqueue a document work item");
82
Contract
.ThrowIfFalse(item.DocumentId != null);
273
Contract
.ThrowIfNull(workItem.DocumentId);
ExternalAccess\VSTypeScript\Api\VSTypeScriptDiagnosticData.cs (1)
42
Contract
.ThrowIfTrue(useMapped);
ExternalAccess\Watch\Api\WatchHotReloadService.cs (3)
84
Contract
.ThrowIfFalse(_sessionId == default, "Session already started");
100
Contract
.ThrowIfFalse(sessionId != default, "Session has not started");
119
Contract
.ThrowIfFalse(_sessionId != default, "Session has not started");
ExtractClass\AbstractExtractClassRefactoringProvider.cs (1)
88
Contract
.ThrowIfNull(containingType);
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
216
Contract
.ThrowIfFalse(remainingResults.Count == 0);
ExtractMethod\AbstractSyntaxTriviaService.cs (6)
30
Contract
.ThrowIfNull(root);
31
Contract
.ThrowIfTrue(textSpan.IsEmpty);
37
Contract
.ThrowIfFalse(textSpan.Contains(tokens[TriviaLocation.AfterBeginningOfSpan].Span) && textSpan.Contains(tokens[TriviaLocation.BeforeEndOfSpan].Span));
56
Contract
.ThrowIfNull(root);
57
Contract
.ThrowIfNull(oldTokens);
58
Contract
.ThrowIfNull(computeReplacementToken);
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (4)
34
Contract
.ThrowIfNull(root);
35
Contract
.ThrowIfNull(annotations);
36
Contract
.ThrowIfNull(triviaList);
115
Contract
.ThrowIfFalse(
ExtractMethod\Extensions.cs (1)
75
Contract
.ThrowIfNull(typeSymbol);
ExtractMethod\InsertionPoint.cs (2)
29
Contract
.ThrowIfNull(document);
30
Contract
.ThrowIfNull(annotation);
ExtractMethod\MethodExtractor.Analyzer.cs (10)
31
Contract
.ThrowIfNull(selectionResult);
92
Contract
.ThrowIfFalse(unused.Count == 0);
416
Contract
.ThrowIfNull(model);
417
Contract
.ThrowIfNull(dataFlowAnalysisData);
503
Contract
.ThrowIfTrue(bestEffort, "Should never fail if bestEffort is true");
533
Contract
.ThrowIfNull(model);
534
Contract
.ThrowIfNull(type);
541
Contract
.ThrowIfTrue(bestEffort, "Should never fail if bestEffort is true");
700
Contract
.ThrowIfTrue(SelectionResult.SelectionInExpression);
864
Contract
.ThrowIfFalse(parameters.Count == arguments.Count);
ExtractMethod\MethodExtractor.Analyzer.SymbolMapBuilder.cs (3)
35
Contract
.ThrowIfNull(semanticModel);
36
Contract
.ThrowIfNull(service);
37
Contract
.ThrowIfNull(root);
ExtractMethod\MethodExtractor.AnalyzerResult.cs (1)
135
Contract
.ThrowIfNull(_variableToUseAsReturnValue);
ExtractMethod\MethodExtractor.CodeGenerator.cs (6)
44
Contract
.ThrowIfFalse(insertionPoint.SemanticDocument == analyzerResult.SemanticDocument);
229
Contract
.ThrowIfTrue(AnalyzerResult.GetVariablesToSplitOrMoveOutToCallSite(cancellationToken).Any(v => v.UseAsReturnValue));
249
Contract
.ThrowIfFalse(AnalyzerResult.GetVariablesToSplitOrMoveOutToCallSite(cancellationToken).Single(v => v.ReturnBehavior == ReturnBehavior.Initialization) != null);
258
Contract
.ThrowIfFalse(variable.ReturnBehavior == ReturnBehavior.Assignment);
296
Contract
.ThrowIfFalse(variableToUseAsReturnValue.ReturnBehavior is ReturnBehavior.Assignment or
309
Contract
.ThrowIfFalse(variable.GetDeclarationBehavior(cancellationToken) is DeclarationBehavior.MoveOut or
ExtractMethod\MethodExtractor.cs (1)
32
Contract
.ThrowIfNull(selectionResult);
ExtractMethod\MethodExtractor.GeneratedCode.cs (4)
22
Contract
.ThrowIfNull(document);
23
Contract
.ThrowIfNull(methodNameAnnotation);
24
Contract
.ThrowIfNull(callsiteAnnotation);
25
Contract
.ThrowIfNull(methodDefinitionAnnotation);
ExtractMethod\MethodExtractor.VariableInfo.cs (4)
38
Contract
.ThrowIfFalse(!_useAsReturnValue || _variableStyle.ReturnStyle.ReturnBehavior != ReturnBehavior.None);
98
Contract
.ThrowIfNull(variable);
99
Contract
.ThrowIfFalse(variable.CanBeUsedAsReturnValue);
100
Contract
.ThrowIfFalse(variable.ParameterModifier is ParameterBehavior.Out or ParameterBehavior.Ref);
ExtractMethod\MethodExtractor.VariableSymbol.cs (22)
112
Contract
.ThrowIfNull(parameterSymbol);
123
Contract
.ThrowIfNull(other);
136
Contract
.ThrowIfFalse(_parameterSymbol.Ordinal != other._parameterSymbol.Ordinal);
191
Contract
.ThrowIfNull(localSymbol);
192
Contract
.ThrowIfNull(nonNoisySet);
205
Contract
.ThrowIfNull(other);
212
Contract
.ThrowIfFalse(_localSymbol.Locations.Length == 1);
213
Contract
.ThrowIfFalse(other._localSymbol.Locations.Length == 1);
214
Contract
.ThrowIfFalse(_localSymbol.Locations[0].IsInSource);
215
Contract
.ThrowIfFalse(other._localSymbol.Locations[0].IsInSource);
216
Contract
.ThrowIfFalse(_localSymbol.Locations[0].SourceTree == other._localSymbol.Locations[0].SourceTree);
217
Contract
.ThrowIfFalse(_localSymbol.Locations[0].SourceSpan.Start != other._localSymbol.Locations[0].SourceSpan.Start);
234
Contract
.ThrowIfFalse(_localSymbol.Locations.Length == 1);
235
Contract
.ThrowIfFalse(_localSymbol.Locations[0].IsInSource);
236
Contract
.ThrowIfNull(_localSymbol.Locations[0].SourceTree);
242
Contract
.ThrowIfFalse(token.Span.Equals(span));
305
Contract
.ThrowIfNull(symbol);
316
Contract
.ThrowIfNull(other);
326
Contract
.ThrowIfFalse(locationLeft.IsInSource);
327
Contract
.ThrowIfFalse(locationRight.IsInSource);
328
Contract
.ThrowIfFalse(locationLeft.SourceTree == locationRight.SourceTree);
329
Contract
.ThrowIfFalse(locationLeft.SourceSpan.Start != locationRight.SourceSpan.Start);
ExtractMethod\OperationStatus.cs (3)
17
Contract
.ThrowIfTrue(flag.Succeeded() && flag.HasBestEffort());
25
Contract
.ThrowIfNull(reasons);
26
Contract
.ThrowIfTrue(flag.Succeeded() && flag.HasBestEffort());
ExtractMethod\SelectionResult.cs (3)
23
Contract
.ThrowIfNull(status);
103
Contract
.ThrowIfTrue(SelectionInExpression);
111
Contract
.ThrowIfTrue(SelectionInExpression);
ExtractMethod\SelectionValidator.cs (2)
34
Contract
.ThrowIfNull(document);
57
Contract
.ThrowIfNull(range);
ExtractMethod\UniqueNameGenerator.cs (3)
18
Contract
.ThrowIfNull(semanticModel);
24
Contract
.ThrowIfNull(contextNode);
25
Contract
.ThrowIfNull(baseName);
FindUsages\DefinitionItem.cs (3)
158
Contract
.ThrowIfFalse(Properties.ContainsKey(MetadataSymbolOriginatingProjectIdGuid));
159
Contract
.ThrowIfFalse(Properties.ContainsKey(MetadataSymbolOriginatingProjectIdDebugName));
250
Contract
.ThrowIfNull(projectId);
FindUsages\DefinitionItem.DefaultDefinitionItem.cs (1)
50
Contract
.ThrowIfNull(project);
FindUsages\IRemoteFindUsagesService.cs (2)
154
Contract
.ThrowIfFalse(_idToDefinition.ContainsKey(definitionId));
182
Contract
.ThrowIfNull(document);
FullyQualify\AbstractFullyQualifyService.cs (2)
167
Contract
.ThrowIfNull(rightSide);
197
Contract
.ThrowIfNull(symbolResult.OriginalSymbol);
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs (1)
58
Contract
.ThrowIfNull(_state.DelegatedConstructor);
GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.AbstractCodeAction.cs (2)
46
Contract
.ThrowIfNull(_state.ClassType);
68
Contract
.ThrowIfNull(classType);
GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.CodeAction.cs (1)
30
Contract
.ThrowIfNull(state.ClassType);
GenerateMember\AbstractGenerateMemberService.cs (1)
141
Contract
.ThrowIfNull(attributeNode);
GenerateMember\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
88
Contract
.ThrowIfNull(state.TypeToGenerateIn);
GenerateMember\GenerateConstructor\AbstractGenerateConstructorService.State.cs (9)
115
Contract
.ThrowIfNull(TypeToGenerateIn);
187
Contract
.ThrowIfNull(TypeToGenerateIn);
188
Contract
.ThrowIfNull(TypeToGenerateIn.BaseType);
209
Contract
.ThrowIfNull(TypeToGenerateIn);
240
Contract
.ThrowIfNull(TypeToGenerateIn);
523
Contract
.ThrowIfNull(TypeToGenerateIn);
580
Contract
.ThrowIfNull(TypeToGenerateIn);
615
Contract
.ThrowIfNull(TypeToGenerateIn);
638
Contract
.ThrowIfNull(TypeToGenerateIn);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
74
Contract
.ThrowIfFalse(document.Project.Solution == generateTypeOptionsResult.Project.Solution);
GenerateType\AbstractGenerateTypeService.State.cs (1)
121
Contract
.ThrowIfNull(generateTypeServiceStateOptions.NameOrMemberAccessExpression);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
150
Contract
.ThrowIfNull(parameterSyntax);
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (1)
448
Contract
.ThrowIfNull(parameterSymbol, "We filtered out varags methods earlier.");
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (2)
155
Contract
.ThrowIfNull(parameterList);
462
Contract
.ThrowIfNull(newMethodDeclaration);
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
113
Contract
.ThrowIfNull(type);
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (3)
320
Contract
.ThrowIfFalse(symbolGroup.Length > 0);
329
Contract
.ThrowIfFalse(symbolGroup.Length > 0);
731
Contract
.ThrowIfTrue(symbol.TypeParameterKind == TypeParameterKind.Cref);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
41
Contract
.ThrowIfNull(rootNamespace);
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (8)
250
Contract
.ThrowIfNull(workspace);
252
Contract
.ThrowIfFalse(threadingService.IsOnMainThread);
275
Contract
.ThrowIfTrue(_openedDocumentIds.ContainsKey(fileInfo));
309
Contract
.ThrowIfNull(documentId);
345
Contract
.ThrowIfFalse(_openedDocumentIds.IsEmpty);
351
Contract
.ThrowIfNull(compilation, "We are trying to produce a key for a language that doesn't support compilations.");
387
Contract
.ThrowIfNull(filePath);
398
Contract
.ThrowIfNull(assemblyIdentity);
MetadataAsSource\MetadataAsSourceFileService.cs (4)
98
Contract
.ThrowIfNull(_workspace);
123
Contract
.ThrowIfFalse(threadingService.IsOnMainThread);
209
Contract
.ThrowIfNull(document.FilePath);
219
Contract
.ThrowIfNull(_workspace);
MoveStaticMembers\AbstractMoveStaticMembersRefactoringProvider.cs (1)
53
Contract
.ThrowIfNull(containingType);
NamingStyleCodeFixProvider.cs (1)
53
Contract
.ThrowIfNull(serializedNamingStyle);
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.SymbolItem.cs (3)
92
Contract
.ThrowIfTrue(inDocumentInfo == null && otherDocumentInfo == null, "Both locations were null");
93
Contract
.ThrowIfTrue(inDocumentInfo != null && otherDocumentInfo != null, "Both locations were not null");
97
Contract
.ThrowIfTrue(inDocumentInfo.Value.spans.IsEmpty, "If location is in document, it must have non-empty spans");
PdbSourceDocument\PdbFileLocatorService.cs (1)
51
Contract
.ThrowIfNull(pdbReaderProvider);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (4)
94
Contract
.ThrowIfNull(telemetryMessage);
266
Contract
.ThrowIfNull(navigateDocument);
353
Contract
.ThrowIfNull(workspace);
355
Contract
.ThrowIfFalse(threadingService.IsOnMainThread);
PreferFrameworkType\PreferFrameworkTypeDiagnosticAnalyzerBase.cs (1)
39
Contract
.ThrowIfNull(options);
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (1)
62
Contract
.ThrowIfNull(containingType);
Rename\SymbolicRenameInfo.cs (3)
63
Contract
.ThrowIfTrue(this.IsError);
90
Contract
.ThrowIfTrue(this.IsError);
97
Contract
.ThrowIfTrue(this.IsError);
ReplaceConditionalWithStatements\AbstractReplaceConditionalWithStatementsCodeRefactoringProvider.cs (2)
251
Contract
.ThrowIfNull(initializer);
319
Contract
.ThrowIfNull(containerWithConditionalReplaced);
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
491
Contract
.ThrowIfFalse(x.Document == y.Document);
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (2)
124
Contract
.ThrowIfNull(_expression.Parent, $"Parent of {_expression} is null.");
291
Contract
.ThrowIfNull(_expression.Parent, $"Parent of {_expression} is null.");
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (3)
56
Contract
.ThrowIfNull(propertySymbol);
266
Contract
.ThrowIfNull(parent);
437
Contract
.ThrowIfFalse(x.location.Document == y.location.Document);
SignatureHelp\SignatureHelpItems.cs (3)
65
Contract
.ThrowIfNull(items);
66
Contract
.ThrowIfTrue(items.IsEmpty());
67
Contract
.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value >= items.Count);
SignatureHelp\SignatureHelpTriggerInfo.cs (1)
17
Contract
.ThrowIfTrue(triggerReason == SignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null);
SimplifyTypeNamesDiagnosticAnalyzerBase.cs (1)
82
Contract
.ThrowIfNull(options);
Snippets\AbstractSnippetService.cs (1)
39
Contract
.ThrowIfFalse(_identifierToProviderMap.ContainsKey(snippetIdentifier));
Snippets\RoslynLSPSnippetConverter.cs (2)
39
Contract
.ThrowIfNull(textChangeText);
129
Contract
.ThrowIfNull(textChangeText);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
108
Contract
.ThrowIfNull(snippetExpressionNode);
Snippets\SnippetProviders\AbstractConstructorSnippetProvider.cs (1)
38
Contract
.ThrowIfNull(containingType);
Snippets\SnippetProviders\AbstractSnippetProvider.cs (3)
113
Contract
.ThrowIfNull(caretTarget);
114
Contract
.ThrowIfNull(mainChangeNode);
234
Contract
.ThrowIfNull(snippetExpressionNode);
SolutionCrawler\AbstractDocumentDifferenceService.cs (2)
68
Contract
.ThrowIfNull(oldRoot);
69
Contract
.ThrowIfNull(newRoot);
SolutionCrawler\IdleProcessor.cs (2)
59
Contract
.ThrowIfFalse(_processorTask == null);
90
Contract
.ThrowIfTrue(_isPaused_doNotAccessDirectly);
SolutionCrawler\SolutionCrawlerRegistrationService.cs (2)
77
Contract
.ThrowIfNull(workspace.Kind);
137
Contract
.ThrowIfNull(workspace.Kind);
SolutionCrawler\WorkCoordinator.AsyncDocumentWorkItemQueue.cs (2)
91
Contract
.ThrowIfNull(lowPriorityDocumentId);
97
Contract
.ThrowIfNull(item.DocumentId);
SolutionCrawler\WorkCoordinator.cs (10)
215
Contract
.ThrowIfNull(args.ProjectId);
220
Contract
.ThrowIfNull(args.ProjectId);
226
Contract
.ThrowIfNull(args.ProjectId);
231
Contract
.ThrowIfNull(args.DocumentId);
236
Contract
.ThrowIfNull(args.DocumentId);
242
Contract
.ThrowIfNull(args.DocumentId);
255
Contract
.ThrowIfNull(args.ProjectId);
637
Contract
.ThrowIfNull(_projectOrDocumentIds);
685
Contract
.ThrowIfNull(_projectOrDocumentIds);
728
Contract
.ThrowIfNull(_projectOrDocumentIds);
SolutionCrawler\WorkCoordinator.HighPriorityProcessor.cs (4)
82
Contract
.ThrowIfFalse(item.DocumentId != null, "can only enqueue a document work item");
116
Contract
.ThrowIfNull(item.DocumentId);
144
Contract
.ThrowIfFalse(GetNextWorkItem(out var workItem, out var documentCancellation));
184
Contract
.ThrowIfNull(workItem.DocumentId);
SolutionCrawler\WorkCoordinator.IncrementalAnalyzerProcessor.cs (1)
106
Contract
.ThrowIfNull(item.DocumentId);
SolutionCrawler\WorkCoordinator.NormalPriorityProcessor.cs (3)
65
Contract
.ThrowIfFalse(item.DocumentId != null, "can only enqueue a document work item");
81
Contract
.ThrowIfFalse(item.DocumentId != null);
259
Contract
.ThrowIfNull(workItem.DocumentId);
SymbolMapping\SymbolMappingResult.cs (2)
16
Contract
.ThrowIfNull(project);
17
Contract
.ThrowIfNull(symbol);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (3)
143
Contract
.ThrowIfFalse(resolution.IsSuccessful);
156
Contract
.ThrowIfTrue(fieldSymbol == null || propertySymbol == null);
225
Contract
.ThrowIfNull(newFieldTreeRoot);
UseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (1)
73
Contract
.ThrowIfNull(expression); // checked in analyzer.
UseExplicitTupleNameCodeFixProvider.cs (1)
50
Contract
.ThrowIfNull(preferredName);
ValueTracking\SerializableValueTrackedItem.cs (1)
57
Contract
.ThrowIfNull(symbolResolution.Symbol);
ValueTracking\ValueTrackedItem.cs (1)
51
Contract
.ThrowIfNull(location.SourceTree);
Wrapping\AbstractCodeActionComputer.cs (2)
232
Contract
.ThrowIfNull(nodeToFormat);
264
Contract
.ThrowIfNull(rewrittenRoot);
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
312
Contract
.ThrowIfFalse(comma.IsToken);
Microsoft.CodeAnalysis.LanguageServer.Protocol (93)
Extensions\Extensions.cs (1)
27
Contract
.ThrowIfNull(document.FilePath);
Extensions\ProtocolConversions.cs (8)
114
Contract
.ThrowIfNull(context.TriggerCharacter);
115
Contract
.ThrowIfFalse(char.TryParse(context.TriggerCharacter, out var triggerChar));
126
Contract
.ThrowIfNull(context.TriggerCharacter);
127
Contract
.ThrowIfFalse(char.TryParse(context.TriggerCharacter, out var triggerChar));
143
Contract
.ThrowIfTrue(position < 1);
212
Contract
.ThrowIfNull(textChange.NewText);
274
Contract
.ThrowIfNull(textDiffService);
819
Contract
.ThrowIfFalse(textSpans.Length == mappedSpanResult.Length,
Features\CodeCleanup\AbstractCodeCleanupService.cs (1)
189
Contract
.ThrowIfNull(solution);
Features\CodeFixes\CodeFixService.cs (3)
315
Contract
.ThrowIfNull(solution);
962
Contract
.ThrowIfNull(x);
963
Contract
.ThrowIfNull(y);
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (3)
49
Contract
.ThrowIfFalse(diagnostics.All(d => d.DocumentId != null));
57
Contract
.ThrowIfFalse(diagnostics.All(d => d.DocumentId != null));
72
Contract
.ThrowIfFalse(diagnostics.All(d => d.DocumentId == null));
Features\Diagnostics\DiagnosticService.cs (1)
314
Contract
.ThrowIfNull(workspace);
Features\Diagnostics\DocumentAnalysisExecutor.cs (1)
67
Contract
.ThrowIfFalse(AnalysisScope.Analyzers.Contains(analyzer));
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (3)
154
Contract
.ThrowIfFalse(project.SupportsCompilation);
192
Contract
.ThrowIfFalse(project.TryGetCompilation(out var compilation2));
193
Contract
.ThrowIfFalse(compilation1 == compilation2);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ActiveFileState.cs (1)
65
Contract
.ThrowIfFalse(data.OldItems.IsDefault);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.AnalysisData.cs (1)
124
Contract
.ThrowIfFalse(project.Id == result.ProjectId);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.CompilationManager.cs (1)
89
Contract
.ThrowIfFalse(compilation.Analyzers.SetEquals(stateSets.Select(s => s.Analyzer).Where(a => !a.IsWorkspaceDiagnosticAnalyzer())));
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.cs (5)
54
Contract
.ThrowIfNull(analyzerService);
167
Contract
.ThrowIfFalse(project.Solution.Workspace == Workspace);
181
Contract
.ThrowIfFalse(solution == null || solution.Workspace == Workspace);
194
Contract
.ThrowIfFalse(document.Project.Solution.Workspace == Workspace);
208
Contract
.ThrowIfFalse(solution == null || solution.Workspace == Workspace);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (1)
319
Contract
.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)
73
Contract
.ThrowIfFalse(!compilationWithAnalyzers.Analyzers.IsEmpty);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs (8)
56
Contract
.ThrowIfFalse(lastResult.ProjectId == project.Id);
117
Contract
.ThrowIfFalse(lastResult.ProjectId == document.Project.Id);
158
Contract
.ThrowIfFalse(lastResult.ProjectId == project.Id);
192
Contract
.ThrowIfTrue(result.IsAggregatedForm);
193
Contract
.ThrowIfNull(result.DocumentIds);
242
Contract
.ThrowIfFalse(state.DocumentId == document.Id);
352
Contract
.ThrowIfFalse(document == null || document.Project == project);
413
Contract
.ThrowIfFalse(document == null || document.Project == project);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.cs (1)
301
Contract
.ThrowIfFalse(set.Add((stateSet.Language, stateSet.StateName)));
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (1)
222
Contract
.ThrowIfFalse(kind == AnalysisKind.NonLocal);
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
65
Contract
.ThrowIfNull(tree);
Handler\CodeActions\CodeActionResolveHandler.cs (4)
81
Contract
.ThrowIfNull(codeActionToResolve);
181
Contract
.ThrowIfNull(oldTextDoc);
182
Contract
.ThrowIfNull(newTextDoc);
192
Contract
.ThrowIfNull(textDiffService);
Handler\CodeActions\CodeActionsHandler.cs (1)
56
Contract
.ThrowIfNull(document);
Handler\CodeLens\CodeLensResolveHandler.cs (2)
77
Contract
.ThrowIfNull(resolveData, "Missing data for code lens resolve request");
80
Contract
.ThrowIfNull(cacheEntry, "Missing cache entry for code lens resolve request");
Handler\Completion\CompletionHandler.cs (3)
66
Contract
.ThrowIfNull(document);
67
Contract
.ThrowIfNull(context.Solution);
284
Contract
.ThrowIfNull(mostUsedCommitCharacters);
Handler\Completion\CompletionResolveHandler.cs (5)
100
Contract
.ThrowIfTrue(completionItem.InsertText != null);
101
Contract
.ThrowIfTrue(completionItem.TextEdit != null);
148
Contract
.ThrowIfNull(newText);
182
Contract
.ThrowIfNull(request.Data);
186
Contract
.Fail("Result id should always be provided when resolving a completion item we returned.");
Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (6)
138
Contract
.ThrowIfFalse(diagnosticMode == DiagnosticMode.LspPull, $"{diagnosticMode} is not pull");
208
Contract
.ThrowIfNull(context.Solution);
287
Contract
.ThrowIfFalse(diagnostics.IsEmpty);
344
Contract
.ThrowIfNull(diagnostic.Tags, $"diagnostic {diagnostic.Identifier} was missing tags");
369
Contract
.ThrowIfNull(diagnosticData.Message, $"Got a document diagnostic that did not have a {nameof(diagnosticData.Message)}");
503
Contract
.ThrowIfNull(diagnosticData.Language, $"diagnostic {diagnosticData.Id} is missing a language");
Handler\Diagnostics\WorkspacePullDiagnosticHandler.cs (2)
141
Contract
.ThrowIfNull(context.Solution);
165
Contract
.ThrowIfNull(context.Solution);
Handler\InlineCompletions\XmlSnippetParser.CodeSnippet.cs (2)
67
Contract
.ThrowIfNull(snippets, $"Did not find any code snippets in {filePath}");
276
Contract
.ThrowIfFalse(snippetParts.Any());
Handler\InlineCompletions\XmlSnippetParser.cs (1)
70
Contract
.ThrowIfFalse(matchingSnippet.IsExpansionSnippet(), "Only expansion snippets are supported");
Handler\ProjectContext\GetTextDocumentWithContextHandler.cs (2)
35
Contract
.ThrowIfNull(context.Workspace);
36
Contract
.ThrowIfNull(context.Solution);
Handler\References\FindAllReferencesHandler.cs (2)
55
Contract
.ThrowIfNull(document);
56
Contract
.ThrowIfNull(workspace);
Handler\Rename\RenameHandler.cs (1)
41
Contract
.ThrowIfNull(document);
Handler\RequestContext.cs (1)
217
Contract
.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), $"Attempted to get text for {documentUri} which is not open.");
Handler\RequestMetrics.cs (1)
49
Contract
.ThrowIfNull(_queuedDuration, "RecordExecutionStart was not called");
Handler\SemanticTokens\SemanticTokensHelpers.cs (4)
183
Contract
.ThrowIfTrue(numLinesInSpan < 1);
287
Contract
.ThrowIfTrue(deltaLine < 0, $"deltaLine is less than 0: {deltaLine}");
302
Contract
.ThrowIfFalse(tokenLength > 0);
356
Contract
.ThrowIfFalse(tokenTypesToIndex.TryGetValue(tokenTypeStr, out var tokenTypeIndex), "No matching token type index found.");
Handler\SemanticTokens\SemanticTokensRangeHandler.cs (2)
36
Contract
.ThrowIfNull(request.TextDocument);
45
Contract
.ThrowIfNull(request.TextDocument, "TextDocument is null.");
Handler\SemanticTokens\SemanticTokensRefreshQueue.cs (1)
164
Contract
.ThrowIfNull(_semanticTokenRefreshQueue);
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (2)
134
Contract
.ThrowIfNull(context.Solution);
171
Contract
.ThrowIfNull(context.Solution);
Handler\SpellCheck\WorkspaceSpellCheckHandler.cs (1)
33
Contract
.ThrowIfNull(context.Solution);
Handler\Symbols\WorkspaceSymbolsHandler.cs (1)
56
Contract
.ThrowIfNull(context.Solution);
LspServices\ExportLspServiceFactoryAttribute.cs (1)
41
Contract
.ThrowIfFalse(type.GetInterfaces().Contains(typeof(ILspService)), $"{type.Name} does not inherit from {nameof(ILspService)}");
LspServices\ExportStatelessLspServiceAttribute.cs (1)
41
Contract
.ThrowIfFalse(type.GetInterfaces().Contains(typeof(ILspService)), $"{type.Name} does not inherit from {nameof(ILspService)}");
LspServices\LspServices.cs (1)
58
Contract
.ThrowIfNull(service, $"Missing required LSP service {typeof(T).FullName}");
Workspaces\LspWorkspaceManager.cs (3)
99
Contract
.ThrowIfTrue(_trackedDocuments.ContainsKey(uri), $"didOpen received for {uri} which is already open.");
116
Contract
.ThrowIfFalse(_trackedDocuments.ContainsKey(uri), $"didClose received for {uri} which is not open.");
136
Contract
.ThrowIfFalse(_trackedDocuments.ContainsKey(uri), $"didChange received for {uri} which is not open.");
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (10)
CodeActions\RunCodeActionsTests.cs (1)
76
Contract
.ThrowIfNull(result);
DocumentChanges\DocumentChangesTests.LinkedDocuments.cs (1)
105
Contract
.ThrowIfNull(lspDocument);
InlineCompletions\InlineCompletionsTests.cs (1)
308
Contract
.ThrowIfNull(response);
InlineCompletions\TestSnippetInfoService.cs (1)
37
Contract
.ThrowIfNull(snippets);
Miscellaneous\LspMiscellaneousFilesWorkspaceTests.cs (3)
151
Contract
.ThrowIfNull(miscWorkspace);
152
Contract
.ThrowIfNull(miscDocument);
226
Contract
.ThrowIfNull(result);
Ordering\RequestOrderingTests.cs (2)
260
Contract
.ThrowIfNull(response);
264
Contract
.ThrowIfNull(solution);
SemanticTokens\AbstractSemanticTokensTests.cs (1)
32
Contract
.ThrowIfNull(result);
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator (5)
Generator.cs (1)
106
Contract
.ThrowIfNull(projectPath);
Graph\Edge.cs (2)
34
Contract
.ThrowIfTrue(IsEdgeLabelOneToMany(label));
42
Contract
.ThrowIfFalse(IsEdgeLabelOneToMany(label));
Program.cs (1)
107
Contract
.ThrowIfNull(binLog);
VisualStudioMefHostServices.cs (1)
28
Contract
.ThrowIfNull(exportProvider);
Microsoft.CodeAnalysis.Remote.ServiceHub (53)
AbstractCloudCachePersistentStorageService.cs (1)
31
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath));
AbstractWorkspaceTelemetryService.cs (1)
26
Contract
.ThrowIfFalse(CurrentSession is null);
Host\IGlobalServiceBroker.cs (1)
45
Contract
.ThrowIfNull(s_instance, "Global service broker not registered");
Host\RemoteDocumentDifferenceService.cs (2)
64
Contract
.ThrowIfNull(oldRoot);
65
Contract
.ThrowIfNull(newRoot);
Host\RemoteWorkspace.cs (4)
112
Contract
.ThrowIfNull(solutionChecksum);
113
Contract
.ThrowIfTrue(solutionChecksum == Checksum.Null);
147
Contract
.ThrowIfTrue(inFlightSolution.InFlightCount < 1);
163
Contract
.ThrowIfTrue(inFlightSolution.InFlightCount < 1);
Host\RemoteWorkspace.InFlightSolution.cs (13)
59
Contract
.ThrowIfFalse(workspace._gate.CurrentCount == 0);
81
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
90
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
109
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
110
Contract
.ThrowIfNull(updatePrimaryBranchAsync);
111
Contract
.ThrowIfTrue(this._cancellationTokenSource_doNotAccessDirectly.IsCancellationRequested);
146
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
147
Contract
.ThrowIfTrue(InFlightCount < 1);
160
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
161
Contract
.ThrowIfTrue(InFlightCount < 1);
170
Contract
.ThrowIfFalse(_workspace._solutionChecksumToSolution.TryGetValue(SolutionChecksum, out var existingSolution));
171
Contract
.ThrowIfFalse(existingSolution == this);
174
Contract
.ThrowIfFalse(_workspace._solutionChecksumToSolution.Remove(SolutionChecksum));
Host\RemoteWorkspace.SolutionCreator.cs (14)
71
Contract
.ThrowIfFalse(solution.Id == newSolutionInfo.Id && solution.FilePath == newSolutionInfo.FilePath);
179
Contract
.ThrowIfTrue(oldProjectChecksums.Checksum == newProjectChecksums.Checksum);
299
Contract
.ThrowIfFalse(project.State.ProjectInfo.Attributes.Id == newProjectAttributes.Id);
300
Contract
.ThrowIfFalse(project.State.ProjectInfo.Attributes.Language == newProjectAttributes.Language);
301
Contract
.ThrowIfFalse(project.State.ProjectInfo.Attributes.IsSubmission == newProjectAttributes.IsSubmission);
418
Contract
.ThrowIfTrue(oldDocumentChecksums.Checksum == newDocumentChecksums.Checksum);
421
Contract
.ThrowIfNull(document);
477
Contract
.ThrowIfFalse(document.State.Attributes.Id == newDocumentInfo.Id);
478
Contract
.ThrowIfFalse(document.State.Attributes.Name == newDocumentInfo.Name);
479
Contract
.ThrowIfFalse(document.State.Attributes.FilePath == newDocumentInfo.FilePath);
480
Contract
.ThrowIfFalse(document.State.Attributes.IsGenerated == newDocumentInfo.IsGenerated);
481
Contract
.ThrowIfFalse(document.State.Attributes.DesignTimeOnly == newDocumentInfo.DesignTimeOnly);
486
Contract
.ThrowIfFalse(document is Document);
493
Contract
.ThrowIfFalse(document is Document);
Host\RemoteWorkspace_SolutionCaching.cs (9)
44
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
51
Contract
.ThrowIfTrue(solution.InFlightCount < 1);
67
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
72
Contract
.ThrowIfTrue(solution.InFlightCount < 1);
76
Contract
.ThrowIfTrue(solution.InFlightCount < 2);
93
Contract
.ThrowIfFalse(solution.InFlightCount == 1);
103
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
111
Contract
.ThrowIfTrue(solution.InFlightCount < 1);
112
Contract
.ThrowIfTrue(solutionChecksum != solution.SolutionChecksum);
Host\Storage\RemoteCloudCachePersistentStorageService.cs (1)
63
Contract
.ThrowIfNull(cacheService);
Services\BrokeredServiceBase.cs (1)
60
Contract
.ThrowIfNull(traceSource);
Services\BrokeredServiceBase.FactoryBase.cs (1)
133
Contract
.ThrowIfNull(descriptor.ClientInterface);
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (1)
247
Contract
.ThrowIfNull(analyzerId);
Services\NavigationBar\RemoteNavigationBarItemService.cs (1)
33
Contract
.ThrowIfNull(document);
Services\ProcessTelemetry\RemoteWorkspaceConfigurationService.cs (1)
34
Contract
.ThrowIfFalse(_options == null);
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
35
Contract
.ThrowIfNull(document);
TelemetryLogger.cs (1)
141
Contract
.ThrowIfFalse(_pendingScopes.TryRemove(blockId, out var scope));
Microsoft.CodeAnalysis.Remote.Workspaces (25)
BrokeredServiceConnection.cs (8)
68
Contract
.ThrowIfFalse((callbackDispatcher == null) == (serviceDescriptor.ClientInterface == null));
98
Contract
.ThrowIfNull(service);
137
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
154
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
238
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
257
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
276
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
295
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
RemoteCallback.cs (1)
54
Contract
.ThrowIfNull(rental.Proxy);
RemoteHostAssetSerialization.cs (3)
101
Contract
.ThrowIfFalse(solutionChecksum == responseSolutionChecksum);
104
Contract
.ThrowIfFalse(count == checksums.Count);
109
Contract
.ThrowIfFalse(checksums.Contains(responseChecksum));
Serialization\MessagePackFormatters.cs (1)
74
Contract
.ThrowIfFalse(reader.ReadArrayHeader() == 2);
ServiceDescriptors.cs (4)
107
Contract
.ThrowIfFalse(serviceInterface.IsInterface);
109
Contract
.ThrowIfFalse(interfaceName.StartsWith(InterfaceNamePrefix, StringComparison.Ordinal));
110
Contract
.ThrowIfFalse(interfaceName.EndsWith(InterfaceNameSuffix, StringComparison.Ordinal));
117
Contract
.ThrowIfFalse(callbackInterface == null || callbackInterface.IsInterface);
SolutionAsset.cs (1)
38
Contract
.ThrowIfTrue(kind is WellKnownSynchronizationKind.SourceText);
SolutionAssetStorage.cs (3)
71
Contract
.ThrowIfTrue(scope.RefCount <= 0);
88
Contract
.ThrowIfTrue(existingScope != scope);
90
Contract
.ThrowIfTrue(scope.RefCount <= 0);
SolutionAssetStorage.Scope.cs (3)
84
Contract
.ThrowIfTrue(result.Count != numberOfChecksumsToSearch);
102
Contract
.ThrowIfTrue(resultPool.Object.Count != 1);
105
Contract
.ThrowIfFalse(checksum == resultingChecksum);
VisualStudioMefHostServices.cs (1)
28
Contract
.ThrowIfNull(exportProvider);
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (10)
AutomaticEndConstructCorrection\AutomaticEndConstructCorrector.vb (2)
26
Contract
.ThrowIfNull(subjectBuffer)
292
Contract
.ThrowIfFalse(positionInText >= 0)
AutomaticEndConstructCorrection\LetterOnlyTrackingSpan.vb (1)
20
Contract
.ThrowIfNull(span.Snapshot)
EndConstructGeneration\SpitLinesResult.vb (1)
25
Contract
.ThrowIfFalse(_lines.Any(Function(line) String.IsNullOrWhiteSpace(line)))
LineCommit\CommitBufferManager.DirtyState.vb (2)
15
Contract
.ThrowIfNull(baseDocument)
16
Contract
.ThrowIfNull(baseSnapshot)
LineCommit\CommitBufferManager.vb (4)
48
Contract
.ThrowIfNull(buffer)
49
Contract
.ThrowIfNull(commitFormatter)
50
Contract
.ThrowIfNull(inlineRenameService)
333
Contract
.ThrowIfNull(manager)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (2)
Utils.vb (2)
116
Contract
.ThrowIfNull(syntaxTree)
117
Contract
.ThrowIfNull(node)
Microsoft.CodeAnalysis.VisualBasic.Features (67)
Completion\KeywordRecommenders\Expressions\TrueFalseKeywordRecommender.vb (1)
33
Contract
.ThrowIfNull(typeInferenceService, NameOf(typeInferenceService))
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (7)
661
Contract
.ThrowIfNull(oldDeclaration.Parent)
662
Contract
.ThrowIfNull(newDeclaration.Parent)
1048
Contract
.ThrowIfFalse(node.IsParentKind(SyntaxKind.ParameterList, SyntaxKind.TypeParameterList))
1199
Contract
.ThrowIfFalse(parent.Parent.IsKind(SyntaxKind.FieldDeclaration))
1330
Contract
.ThrowIfNull(oldNode)
1331
Contract
.ThrowIfNull(newNode)
1332
Contract
.ThrowIfNull(oldModel)
ExtractMethod\Extensions.vb (7)
28
Contract
.ThrowIfNull(node)
40
Contract
.ThrowIfNull(node)
57
Contract
.ThrowIfNull(node)
58
Contract
.ThrowIfNull(statement)
300
Contract
.ThrowIfNull(node)
326
Contract
.ThrowIfNull(node)
373
Contract
.ThrowIfNull(tuple.Item1)
ExtractMethod\VisualBasicMethodExtractor.Analyzer.vb (2)
33
Contract
.ThrowIfFalse(style.ParameterStyle.DeclarationBehavior = DeclarationBehavior.MoveIn OrElse style.ParameterStyle.DeclarationBehavior = DeclarationBehavior.SplitIn)
50
Contract
.ThrowIfTrue(variable.UseAsReturnValue)
ExtractMethod\VisualBasicMethodExtractor.PostProcessor.vb (6)
17
Contract
.ThrowIfNull(semanticModel)
59
Contract
.ThrowIfNull(statement)
60
Contract
.ThrowIfFalse(statement.Declarators.Count = 1)
65
Contract
.ThrowIfNull(type)
74
Contract
.ThrowIfFalse(keyValuePair.Value.Count > 0)
100
Contract
.ThrowIfNull(statement)
ExtractMethod\VisualBasicMethodExtractor.vb (3)
32
Contract
.ThrowIfFalse(originalSpanStart >= 0)
54
Contract
.ThrowIfNull(enclosingTopLevelNode)
89
Contract
.ThrowIfNull(type)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.CallSiteContainerRewriter.vb (13)
27
Contract
.ThrowIfNull(outmostCallSiteContainer)
28
Contract
.ThrowIfNull(variableToRemoveMap)
29
Contract
.ThrowIfNull(firstStatementOrFieldToReplace)
30
Contract
.ThrowIfNull(lastStatementOrFieldToReplace)
31
Contract
.ThrowIfTrue(statementsOrFieldToInsert.IsEmpty())
41
Contract
.ThrowIfFalse(Me._firstStatementOrFieldToReplace.Parent Is Me._lastStatementOrFieldToReplace.Parent)
70
Contract
.ThrowIfFalse(expressionStatements.Count = 0)
74
Contract
.ThrowIfFalse(expressionStatements.Count = 0)
310
Contract
.ThrowIfNull(statement)
317
Contract
.ThrowIfFalse(Me._statementsOrFieldToInsert.Count() = 1)
327
Contract
.ThrowIfFalse(Me._firstStatementOrFieldToReplace Is Me._lastStatementOrFieldToReplace)
332
Contract
.ThrowIfFalse(lastStatementIndex >= 0)
334
Contract
.ThrowIfFalse(firstStatementIndex <= lastStatementIndex)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.ExpressionCodeGenerator.vb (4)
71
Contract
.ThrowIfFalse(IsExtractMethodOnExpression(VBSelectionResult))
102
Contract
.ThrowIfNull(container)
103
Contract
.ThrowIfFalse(container.IsStatementContainerNode() OrElse
123
Contract
.ThrowIfTrue(
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.MultipleStatementsCodeGenerator.vb (3)
29
Contract
.ThrowIfFalse(firstUnderContainer.Parent Is lastUnderContainer.Parent)
51
Contract
.ThrowIfFalse(firstStatementIndex >= 0)
54
Contract
.ThrowIfFalse(lastStatementIndex >= 0)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.SingleStatementCodeGenerator.vb (1)
40
Contract
.ThrowIfFalse(IsExtractMethodOnSingleStatement(VBSelectionResult))
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (6)
50
Contract
.ThrowIfFalse(Me.SemanticDocument Is selectionResult.SemanticDocument)
96
Contract
.ThrowIfFalse(firstStatementToRemove.Parent Is lastStatementToRemove.Parent)
133
Contract
.ThrowIfTrue(AnalyzerResult.MethodTypeParametersInDeclaration.Count = 0)
151
Contract
.ThrowIfNull(declStatement)
152
Contract
.ThrowIfFalse(declStatement.Parent.IsStatementContainerNode())
439
Contract
.ThrowIfTrue(Me.AnalyzerResult.HasVariableToUseAsReturnValue)
ExtractMethod\VisualBasicSelectionResult.vb (9)
31
Contract
.ThrowIfNull(document)
118
Contract
.ThrowIfNull(Me.SemanticDocument)
126
Contract
.ThrowIfNull(scope, "Should always find an expression given that SelectionInExpression was true")
228
Contract
.ThrowIfTrue(SelectionInExpression)
246
Contract
.ThrowIfNull(statement)
252
Contract
.ThrowIfTrue(SelectionInExpression)
261
Contract
.ThrowIfNull(lastStatement)
262
Contract
.ThrowIfFalse(lastStatement.Parent Is (GetFirstStatementUnderContainer()).Parent)
268
Contract
.ThrowIfFalse(SelectionInExpression)
ExtractMethod\VisualBasicSelectionValidator.vb (1)
653
Contract
.ThrowIfFalse(line.LineNumber > 0)
LineSeparators\VisualBasicLineSeparatorService.vb (2)
104
Contract
.ThrowIfNull(spans)
152
Contract
.ThrowIfNull(node)
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
44
Contract
.ThrowIfNull(semanticModel)
VisualBasicUseIsNotExpressionCodeFixProvider.vb (1)
65
Contract
.ThrowIfFalse(operand.IsKind(SyntaxKind.TypeOfIsExpression))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (42)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (2)
203
Contract
.ThrowIfNull(methodDeclaration)
204
Contract
.ThrowIfNull(_semanticModel)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (2)
384
Contract
.ThrowIfFalse(index >= 0)
477
Contract
.ThrowIfFalse(originalModifiers.Count > 0)
Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
55
Contract
.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind))
Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.vb (2)
38
Contract
.ThrowIfTrue(trivia.Kind = SyntaxKind.EndOfLineTrivia)
39
Contract
.ThrowIfTrue(trivia.Kind = SyntaxKind.SkippedTokensTrivia)
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (2)
22
Contract
.ThrowIfNull(treeInfo)
64
Contract
.ThrowIfFalse(list.Count > 0)
Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (3)
27
Contract
.ThrowIfNull(context)
28
Contract
.ThrowIfNull(formattingRules)
29
Contract
.ThrowIfNull(originalString)
Formatting\Engine\Trivia\TriviaDataFactory.LineContinuationTrivia.vb (1)
26
Contract
.ThrowIfFalse(Me.SecondTokenIsFirstTokenOnLine)
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (3)
19
Contract
.ThrowIfNull(original)
71
Contract
.ThrowIfFalse(Me.SecondTokenIsFirstTokenOnLine)
77
Contract
.ThrowIfFalse(list.Count > 0)
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (2)
24
Contract
.ThrowIfNull(node)
25
Contract
.ThrowIfNull(map)
Formatting\Engine\Trivia\TriviaDataFactory.vb (3)
103
Contract
.ThrowIfFalse(lineBreaks = 1)
117
Contract
.ThrowIfFalse(indentation >= 0 AndAlso indentation < s_lineContinuationCacheSize)
153
Contract
.ThrowIfFalse(space >= -1)
Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (1)
296
Contract
.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
Formatting\Engine\VisualBasicFormatEngine.vb (1)
34
Contract
.ThrowIfNull(tokenStream)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb\SyntaxTreeExtensions.vb (1)
239
Contract
.ThrowIfNull(syntaxTree)
SemanticModelReuse\VisualBasicSemanticModelReuseLanguageService.vb (2)
30
Contract
.ThrowIfFalse(TypeOf container Is PropertyBlockSyntax OrElse
36
Contract
.ThrowIfFalse(TypeOf member Is PropertyBlockSyntax OrElse
Simplification\Reducers\AbstractVisualBasicReducer.AbstractReductionRewriter.vb (1)
53
Contract
.ThrowIfNull(ParseOptions)
Simplification\Simplifiers\ExpressionSimplifier.vb (1)
202
Contract
.Fail("QualifiedName Left = " + qualifiedName.Left.ToString() + " and QualifiedName Right = " + qualifiedName.Right.ToString() + " . Left is tried to be replaced with the PredefinedType " + replacementNode.ToString())
Simplification\VisualBasicSimplificationService.vb (4)
78
Contract
.ThrowIfNull(nodeToSpeculate)
79
Contract
.ThrowIfNull(originalNode)
96
Contract
.ThrowIfFalse(originalMethod.Statements.Any(), "How did empty method body get reduced?")
114
Contract
.ThrowIfFalse(SpeculationAnalyzer.CanSpeculateOnNode(nodeToSpeculate))
StringExtensions.vb (2)
62
Contract
.ThrowIfNull(text)
91
Contract
.ThrowIfNull(text)
SyntaxNodeExtensions.vb (2)
114
Contract
.ThrowIfNull(node)
115
Contract
.ThrowIfFalse(node.IsStatementContainerNode())
VisualBasicRemoveUnnecessaryImportsService.vb (1)
32
Contract
.ThrowIfNull(formattingOptions)
VisualBasicSemanticFacts.vb (2)
134
Contract
.ThrowIfNull(model)
135
Contract
.ThrowIfTrue(model.IsSpeculativeSemanticModel)
VisualBasicSmartTokenFormatter.vb (2)
26
Contract
.ThrowIfNull(root)
35
Contract
.ThrowIfTrue(token.Kind = SyntaxKind.None OrElse token.Kind = SyntaxKind.EndOfFileToken)
VisualBasicTypeInferenceService.TypeInferrer.vb (1)
524
Contract
.ThrowIfTrue(previousToken <> Nothing AndAlso binop.OperatorToken <> previousToken)
Microsoft.CodeAnalysis.Workspaces (508)
AbstractAggregatedFormattingResult.cs (2)
32
Contract
.ThrowIfNull(node);
33
Contract
.ThrowIfNull(formattingResults);
AbstractDocumentationCommentService.cs (1)
52
Contract
.ThrowIfNull(documentationComment);
AbstractFlagsEnumGenerator.cs (5)
80
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
121
Contract
.ThrowIfNull(finalNode);
151
Contract
.ThrowIfNull(field.ConstantValue);
174
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
190
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
AbstractFormatEngine.cs (1)
64
Contract
.ThrowIfTrue(treeData.Root.IsInvalidTokenRange(startToken, endToken));
AbstractFormatEngine.OperationApplier.cs (6)
61
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
94
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
132
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
271
Contract
.ThrowIfNull(previousChangesMap);
460
Contract
.ThrowIfFalse(triviaInfo.SecondTokenIsFirstTokenOnLine);
487
Contract
.ThrowIfFalse(baseToken.RawKind != 0 && startToken.RawKind != 0 && endToken.RawKind != 0);
AbstractTriviaDataFactory.AbstractComplexTrivia.cs (3)
27
Contract
.ThrowIfNull(treeInfo);
80
Contract
.ThrowIfFalse(line > 0);
137
Contract
.ThrowIfFalse(list.Count > 0);
AbstractTriviaDataFactory.cs (6)
25
Contract
.ThrowIfNull(treeInfo);
39
Contract
.ThrowIfFalse(space >= 0);
58
Contract
.ThrowIfFalse(lineBreaks >= 0);
59
Contract
.ThrowIfFalse(indentation >= 0);
91
Contract
.ThrowIfFalse(lineIndex is >= 0 and < LineBreakCacheSize);
92
Contract
.ThrowIfFalse(indentationLevel >= 0 && indentationLevel < _whitespaces.Length / _whitespaces.Rank);
AbstractTriviaDataFactory.ModifiedWhitespace.cs (1)
27
Contract
.ThrowIfNull(original);
AbstractTriviaDataFactory.Whitespace.cs (2)
27
Contract
.ThrowIfFalse(space >= 0);
59
Contract
.ThrowIfFalse(line > 0);
AbstractTriviaFormatter.cs (6)
72
Contract
.ThrowIfNull(context);
73
Contract
.ThrowIfNull(formattingRules);
74
Contract
.ThrowIfNull(originalString);
76
Contract
.ThrowIfFalse(lineBreaks >= 0);
77
Contract
.ThrowIfFalse(spaces >= 0);
79
Contract
.ThrowIfTrue(token1 == default && token2 == default);
AdjustNewLinesOperation.cs (3)
16
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.ForceLines || line > 0);
17
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.PreserveLines || line >= 0);
18
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.ForceLinesIfOnSingleLine || line > 0);
AdjustSpacesOperation.cs (1)
16
Contract
.ThrowIfFalse(space >= 0);
AlignTokensOperation.cs (1)
18
Contract
.ThrowIfNull(tokens);
AnalyzerConfigOptionsExtensions.cs (1)
26
Contract
.ThrowIfFalse(option.Definition.IsEditorConfigOption);
AnchorIndentationOperation.cs (3)
18
Contract
.ThrowIfTrue(anchorToken.RawKind == 0);
19
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
21
Contract
.ThrowIfTrue(endToken.RawKind == 0);
AnnotationTable.cs (1)
108
Contract
.ThrowIfNull(ra.Data);
AsyncLazy`1.cs (9)
114
Contract
.ThrowIfNull(asynchronousComputeFunction);
150
Contract
.ThrowIfTrue(_asynchronousComputationCancellationSource != null &&
154
Contract
.ThrowIfTrue(_requests != null &&
159
Contract
.ThrowIfTrue(_requests != null &&
163
Contract
.ThrowIfTrue(_cachedResult != null &&
168
Contract
.ThrowIfTrue(_asynchronousComputeFunction == null && _synchronousComputeFunction != null);
248
Contract
.ThrowIfNull(_synchronousComputeFunction);
360
Contract
.ThrowIfTrue(_computationActive);
361
Contract
.ThrowIfNull(_asynchronousComputeFunction);
BottomUpBaseIndentationFinder.cs (1)
34
Contract
.ThrowIfNull(formattingRules);
ChainedFormattingRules.cs (1)
33
Contract
.ThrowIfNull(formattingRules);
Classification\IRemoteSemanticClassificationService.cs (2)
94
Contract
.ThrowIfNull(ClassificationTypes);
95
Contract
.ThrowIfNull(ClassificationTriples);
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (6)
101
Contract
.ThrowIfTrue(commonLeftWidth > oldRootWidth);
102
Contract
.ThrowIfTrue(commonLeftWidth > newRootWidth);
103
Contract
.ThrowIfTrue(commonRightWidth > oldRootWidth);
104
Contract
.ThrowIfTrue(commonRightWidth > newRootWidth);
133
Contract
.ThrowIfFalse(currentOld.FullSpan.Start == currentNew.FullSpan.Start);
191
Contract
.ThrowIfFalse((oldRoot.FullSpan.End - currentOld.FullSpan.End) ==
CodeActions\CodeAction.cs (1)
105
Contract
.ThrowIfFalse(provider is CodeFixProvider or CodeRefactoringProvider);
CodeCleanup\AbstractCodeCleanerService.cs (7)
214
Contract
.ThrowIfFalse(hasMultiplePreviousToken || hasMultipleNextToken);
240
Contract
.ThrowIfTrue(spanMarkerType == SpanMarkerType.EndOfFile);
241
Contract
.ThrowIfTrue(previousToken.RawKind == 0);
256
Contract
.ThrowIfTrue(spanMarkerType == SpanMarkerType.BeginningOfFile);
257
Contract
.ThrowIfTrue(nextToken.RawKind == 0);
372
Contract
.ThrowIfTrue(startToken.RawKind == 0 || endToken.RawKind == 0);
669
Contract
.ThrowIfNull(annotation.Data);
CodeFixes\CodeFixProvider.cs (1)
49
Contract
.ThrowIfFalse(priority is CodeActionRequestPriority.Low or CodeActionRequestPriority.Normal or CodeActionRequestPriority.High);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
59
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or
CodeFixes\FixAllOccurrences\FixAllContext.cs (1)
315
Contract
.ThrowIfNull(project);
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (1)
47
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
CodeFixesAndRefactorings\FixAllLogger.cs (1)
95
Contract
.ThrowIfTrue(completed && timedOut);
CodeGenerationHelpers.cs (2)
182
Contract
.ThrowIfNull(attribute);
200
Contract
.ThrowIfTrue(availableIndices != null && availableIndices.Count != declarationList.Count + 1);
CodeGenerationOptions.cs (1)
138
Contract
.ThrowIfNull(document.Project.ParseOptions);
CodeRefactorings\CodeRefactoringProvider.cs (1)
42
Contract
.ThrowIfFalse(priority is CodeActionRequestPriority.Low or CodeActionRequestPriority.Normal or CodeActionRequestPriority.High);
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (1)
90
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
CodeRefactorings\FixAllOccurences\FixAllState.cs (2)
101
Contract
.ThrowIfNull(Document);
112
Contract
.ThrowIfNull(Document);
CommonFormattingHelpers.cs (15)
44
Contract
.ThrowIfNull(root);
45
Contract
.ThrowIfFalse(spans.Count > 0);
80
Contract
.ThrowIfNull(root);
81
Contract
.ThrowIfTrue(textSpan.IsEmpty);
120
Contract
.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart);
144
Contract
.ThrowIfNull(tree);
145
Contract
.ThrowIfTrue(token.RawKind == 0);
166
Contract
.ThrowIfTrue(token1.RawKind == 0 && token2.RawKind == 0);
167
Contract
.ThrowIfTrue(token1.Equals(token2));
282
Contract
.ThrowIfFalse(backwardPosition < parentNode.FullSpan.End);
286
Contract
.ThrowIfTrue(nextToken.RawKind == 0);
307
Contract
.ThrowIfNull(parentNode);
308
Contract
.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition);
312
Contract
.ThrowIfTrue(previousToken.RawKind == 0);
362
Contract
.ThrowIfNull(root);
Diagnostics\DiagnosticAnalysisResult.cs (5)
219
Contract
.ThrowIfNull(_syntaxLocals);
220
Contract
.ThrowIfNull(_semanticLocals);
221
Contract
.ThrowIfNull(_nonLocals);
222
Contract
.ThrowIfTrue(_others.IsDefault);
257
Contract
.ThrowIfNull(map);
Diagnostics\DiagnosticAnalysisResultBuilder.cs (1)
59
Contract
.ThrowIfTrue(Project.SupportsCompilation);
Diagnostics\DiagnosticDataLocation.cs (1)
62
Contract
.ThrowIfNull(unmappedFileSpan.Path);
Diagnostics\DocumentAnalysisScope.cs (1)
51
Contract
.ThrowIfFalse(TextDocument is AdditionalDocument);
Diagnostics\HostDiagnosticAnalyzers.cs (1)
181
Contract
.ThrowIfNull(language);
DocumentExtensions.cs (1)
116
Contract
.ThrowIfFalse(document.SupportsSemanticModel);
Editing\SyntaxEditor.cs (2)
258
Contract
.Fail($"GetCurrentNode returned null with the following node: {OriginalNode}");
303
Contract
.ThrowIfNull(node);
Editing\SyntaxGenerator.cs (4)
1027
Contract
.ThrowIfNull(attribute.AttributeClass);
1380
Contract
.ThrowIfTrue(ReferenceEquals(root, node));
1531
Contract
.ThrowIfNull(currentFirst);
1903
Contract
.ThrowIfNull(name);
EditorConfigValueSerializer`1.cs (1)
62
Contract
.ThrowIfTrue(RoslynString.IsNullOrEmpty(editorConfigStringForValue));
EmbeddedSeparatedSyntaxNodeList.cs (1)
27
Contract
.ThrowIfTrue(nodesAndTokens.IsDefault);
ErrorReporting\InfoBarUI.cs (1)
20
Contract
.ThrowIfNull(title);
FindSymbols\Declarations\DeclarationFinder.cs (3)
30
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
80
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
87
Contract
.ThrowIfNull(info);
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (2)
28
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
33
Contract
.ThrowIfNull(query.Name);
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (2)
121
Contract
.ThrowIfNull(index);
124
Contract
.ThrowIfNull(_stringValue);
FindSymbols\FindReferences\DependentProjectsFinder.cs (4)
263
Contract
.ThrowIfNull(symbolOrigination.assembly);
264
Contract
.ThrowIfNull(project);
265
Contract
.ThrowIfFalse(project.SupportsCompilation);
277
Contract
.ThrowIfFalse(project.SupportsCompilation);
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
347
Contract
.ThrowIfNull(symbolTreeInfo);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
578
Contract
.ThrowIfFalse(notNullOriginalUnreducedSymbol2.GetOriginalUnreducedDefinition().Equals(notNullOriginalUnreducedSymbol2));
FindSymbols\FindReferences\Finders\AbstractTypeParameterSymbolReferenceFinder.cs (1)
56
Contract
.ThrowIfNull(token.Parent?.Parent);
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (1)
45
Contract
.ThrowIfNull(underlyingNamedType);
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (1)
57
Contract
.ThrowIfNull(symbol.DeclaringMethod);
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (3)
159
Contract
.ThrowIfFalse(linkedSymbols.Contains(symbol), "Linked symbols did not contain the very symbol we started with.");
162
Contract
.ThrowIfFalse(group.Symbols.Contains(symbol), "Symbol group did not contain the very symbol we started with.");
169
Contract
.ThrowIfFalse(_symbolToGroup.ContainsKey(symbol));
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (2)
121
Contract
.ThrowIfNull(searchSymbol);
229
Contract
.ThrowIfFalse(projects.Count == 1, "Only a single project should be passed in");
FindSymbols\IStreamingFindReferencesProgress.cs (1)
34
Contract
.ThrowIfTrue(symbols.IsDefaultOrEmpty, "Symbols should be non empty");
FindSymbols\Shared\AbstractSyntaxIndex.cs (3)
32
Contract
.ThrowIfNull(index);
55
Contract
.ThrowIfFalse(index != null || loadOnly == true, "Result can only be null if 'loadOnly: true' was passed.");
114
Contract
.ThrowIfFalse(document.SupportsSyntaxTree);
FindSymbols\SymbolFinder.FindReferencesServerCallback.cs (1)
66
Contract
.ThrowIfTrue(dehydrated.Symbols.Count == 0);
FindSymbols\SymbolFinder_Helpers.cs (5)
148
Contract
.ThrowIfNull(equivalentTypesWithDifferingAssemblies);
149
Contract
.ThrowIfTrue(!equivalentTypesWithDifferingAssemblies.Any());
152
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => !SymbolEquivalenceComparer.Instance.Equals(kvp.Key.ContainingAssembly, kvp.Value.ContainingAssembly)));
155
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Key.ContainingType == null));
156
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Value.ContainingType == null));
FindSymbols\SymbolTree\MetadataInfo.cs (1)
31
Contract
.ThrowIfNull(info);
FindSymbols\SymbolTree\SymbolTreeInfo.cs (4)
126
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
138
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
150
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
156
Contract
.ThrowIfNull(queryName);
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
113
Contract
.ThrowIfTrue(info.Checksum != checksum, "How could the info stored for a particular PEReference now have a different checksum?");
FindSymbols\SymbolTree\SymbolTreeInfo_Serialization.cs (1)
57
Contract
.ThrowIfNull(result);
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (4)
179
Contract
.ThrowIfNull(info);
180
Contract
.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
201
Contract
.ThrowIfNull(info);
202
Contract
.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
85
Contract
.ThrowIfNull(node);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (2)
138
Contract
.ThrowIfTrue((uint)accessibility > Max4BitValue);
139
Contract
.ThrowIfTrue((uint)kind > Max5BitValue);
Formatting\AbstractFormattingService.cs (1)
20
Contract
.ThrowIfNull(syntaxFormattingOptions);
Formatting\Formatter.cs (1)
138
Contract
.ThrowIfNull(formattingOptions);
FormattingContext.cs (4)
59
Contract
.ThrowIfNull(engine);
60
Contract
.ThrowIfNull(tokenStream);
125
Contract
.ThrowIfNull(operations);
437
Contract
.ThrowIfFalse(intervals.Length == 0);
FormattingContext.InitialContextFinder.cs (3)
32
Contract
.ThrowIfNull(tokenStream);
33
Contract
.ThrowIfNull(formattingRules);
34
Contract
.ThrowIfNull(rootNode);
FormattingExtensions.cs (1)
201
Contract
.ThrowIfFalse(lines.Length > 0);
IIndentationService.cs (1)
36
Contract
.ThrowIfNull(firstNonWhitespacePos);
ImmutableHashMapExtensions.cs (2)
28
Contract
.ThrowIfNull(valueProvider);
31
Contract
.ThrowIfNull(map);
IndentBlockOperation.cs (10)
17
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));
19
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
20
Contract
.ThrowIfTrue(startToken.RawKind == 0);
21
Contract
.ThrowIfTrue(endToken.RawKind == 0);
36
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));
38
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask));
39
Contract
.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);
41
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
42
Contract
.ThrowIfTrue(startToken.RawKind == 0);
43
Contract
.ThrowIfTrue(endToken.RawKind == 0);
ISymbolExtensions_Accessibility.cs (7)
88
Contract
.ThrowIfNull(symbol);
89
Contract
.ThrowIfNull(within);
183
Contract
.ThrowIfNull(type);
221
Contract
.ThrowIfNull(assembly);
258
Contract
.ThrowIfNull(containingType);
435
Contract
.ThrowIfNull(withinType);
436
Contract
.ThrowIfNull(originalContainingType);
ISyntaxFactsExtensions.cs (1)
29
Contract
.ThrowIfNull(node);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs\INamedTypeSymbolExtensions.cs (3)
338
Contract
.ThrowIfNull(classOrStructType);
339
Contract
.ThrowIfNull(interfacesOrAbstractClasses);
340
Contract
.ThrowIfNull(isImplemented);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (1)
497
Contract
.ThrowIfFalse(symbol.IsNormalAnonymousType());
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs\StringExtensions.cs (10)
16
Contract
.ThrowIfNull(line);
31
Contract
.ThrowIfNull(line);
46
Contract
.ThrowIfNull(lineText);
57
Contract
.ThrowIfNull(lineText);
208
Contract
.ThrowIfNull(line);
209
Contract
.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length);
210
Contract
.ThrowIfFalse(tabSize > 0);
217
Contract
.ThrowIfNull(line);
218
Contract
.ThrowIfFalse(column >= 0);
219
Contract
.ThrowIfFalse(tabSize > 0);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
69
Contract
.ThrowIfNull(syntaxTree);
131
Contract
.ThrowIfNull(syntaxTree);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\TestHooks\TaskExtensions.cs\TaskExtensions.cs (2)
53
Contract
.ThrowIfNull(task, nameof(task));
90
Contract
.ThrowIfNull(task, nameof(task));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs\TaskExtensions.cs (7)
89
Contract
.ThrowIfNull(continuationAction, nameof(continuationAction));
108
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
122
Contract
.ThrowIfNull(continuationAction, nameof(continuationAction));
154
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
199
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
318
Contract
.ThrowIfNull(continuationFunction, nameof(continuationFunction));
381
Contract
.ThrowIfFalse(task.IsCompleted);
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (2)
25
Contract
.ThrowIfFalse(fixAllScope is FixAllScope.ContainingMember or FixAllScope.ContainingType);
54
Contract
.ThrowIfNull(documentForLocation);
ListExtensions.cs (2)
68
Contract
.ThrowIfNull(list);
69
Contract
.ThrowIfNull(predicate);
LocationExtensions.cs (1)
15
Contract
.ThrowIfNull(location.SourceTree);
Logger.LogBlock.cs (1)
21
Contract
.ThrowIfNull(s_currentLogger);
NonReentrantLock.cs (1)
172
=>
Contract
.ThrowIfFalse(LockHeldByMe());
Notification\AbstractGlobalOperationNotificationService.cs (4)
40
Contract
.ThrowIfFalse(_registrations.Count == 0);
41
Contract
.ThrowIfFalse(_operations.Count == 0, $"Non-disposed operations: {string.Join(", ", _operations)}");
73
Contract
.ThrowIfFalse(_operations.Count == 1);
86
Contract
.ThrowIfFalse(result);
Options\DocumentOptionSet.cs (1)
85
Contract
.ThrowIfTrue(internallyDefinedOption.Type == typeof(NamingStylePreferences));
ParsedDocument.cs (1)
73
Contract
.ThrowIfFalse(Id == oldDocument.Id);
PublicOptionFactory.cs (4)
101
Contract
.ThrowIfNull(option.PublicOption);
107
Contract
.ThrowIfNull(option.PublicOption);
113
Contract
.ThrowIfNull(option.PublicOption);
119
Contract
.ThrowIfNull(option.PublicOption);
ReferenceCountedDisposable.cs (1)
294
Contract
.ThrowIfNull(weakInstance);
Remote\ExportRemoteServiceCallbackDispatcherAttribute.cs (1)
22
Contract
.ThrowIfFalse(serviceInterface.IsInterface);
Remote\IRemoteKeepAliveService.cs (1)
59
Contract
.Fail("Should have been disposed!");
Remote\RemoteArguments.cs (1)
69
Contract
.ThrowIfNull(project, WorkspacesResources.Symbols_project_could_not_be_found_in_the_provided_solution);
Remote\RemoteServiceCallbackDispatcher.cs (2)
32
Contract
.ThrowIfTrue(_callbackInstances?.TryRemove(Id, out _) == false);
54
Contract
.ThrowIfFalse(_callbackInstances.TryGetValue(callbackId, out var instance));
Remote\RemoteServiceCallbackDispatchers.cs (1)
24
Contract
.ThrowIfNull(serviceInterface);
Rename\ConflictEngine\ConflictResolver.cs (6)
193
Contract
.ThrowIfNull(implicitUsageConflict.SourceTree);
217
Contract
.ThrowIfNull(implicitConflict.SourceTree);
243
Contract
.ThrowIfNull(projectOpt);
295
Contract
.ThrowIfNull(projectOpt);
310
Contract
.ThrowIfNull(languageConflict.SourceTree);
337
Contract
.ThrowIfNull(oldLocation.SourceTree);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
162
Contract
.ThrowIfTrue(conflictLocations.Count != 0, "We're the first phase, so we should have no conflict locations yet");
Rename\ConflictEngine\MutableConflictResolution.cs (1)
117
Contract
.ThrowIfNull(directory);
Rename\IRemoteRenamerService.cs (2)
157
Contract
.ThrowIfNull(serializableLocations);
239
Contract
.ThrowIfNull(Resolution);
Rename\LightweightRenameLocations.cs (5)
42
Contract
.ThrowIfTrue(locations.IsDefault);
43
Contract
.ThrowIfTrue(implicitLocations.IsDefault);
44
Contract
.ThrowIfTrue(referencedSymbols.IsDefault);
80
Contract
.ThrowIfNull(solution);
81
Contract
.ThrowIfNull(symbol);
Rename\Renamer.cs (6)
163
Contract
.ThrowIfNull(solution);
164
Contract
.ThrowIfNull(symbol);
165
Contract
.ThrowIfTrue(string.IsNullOrEmpty(newName));
211
Contract
.ThrowIfNull(solution);
212
Contract
.ThrowIfNull(symbol);
213
Contract
.ThrowIfTrue(string.IsNullOrEmpty(newName));
Rename\RenameUtilities.cs (4)
101
Contract
.ThrowIfFalse(isSubset);
307
Contract
.ThrowIfNull(definitionSymbol);
318
Contract
.ThrowIfNull(symbol);
319
Contract
.ThrowIfNull(solution);
Rename\SymbolicRenameLocations.cs (4)
49
Contract
.ThrowIfTrue(locations.IsDefault);
50
Contract
.ThrowIfTrue(implicitLocations.IsDefault);
51
Contract
.ThrowIfTrue(referencedSymbols.IsDefault);
68
Contract
.ThrowIfNull(symbol);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
266
Contract
.ThrowIfNull(aliasLocation.SourceTree);
285
Contract
.ThrowIfNull(aliasLocation.SourceTree);
Rename\SymbolicRenameLocations.SearchResult.cs (1)
24
Contract
.ThrowIfNull(locations);
SemanticModelExtensions.cs (3)
109
Contract
.ThrowIfNull(semanticModel.ParentModel);
110
Contract
.ThrowIfTrue(semanticModel.ParentModel.IsSpeculativeSemanticModel);
111
Contract
.ThrowIfTrue(semanticModel.ParentModel.ParentModel != null);
Serialization\SerializableSourceText.cs (1)
175
Contract
.ThrowIfFalse(kind == SerializationKinds.Bits);
Serialization\SerializerService_ChecksumWithChildren.cs (1)
79
Contract
.ThrowIfFalse(checksums.Checksum == checksum);
Serialization\SerializerService_Reference.cs (6)
378
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
388
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
403
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
414
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
428
Contract
.ThrowIfFalse(length == storageStream.Length);
442
Contract
.ThrowIfFalse(SerializationKinds.Bits == kind);
Shared\Extensions\DocumentExtensions.cs (1)
19
Contract
.ThrowIfNull(result);
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
89
Contract
.ThrowIfTrue(start < text.Lines.GetLinePosition(0));
90
Contract
.ThrowIfTrue(end > text.Lines.GetLinePosition(text.Length));
Shared\Extensions\IMethodSymbolExtensions.cs (1)
22
Contract
.ThrowIfFalse(delegateType.TypeKind == TypeKind.Delegate);
Shared\Extensions\ISymbolExtensions.cs (1)
370
Contract
.ThrowIfNull(candidate);
Shared\Extensions\SemanticEquivalence.cs (1)
108
Contract
.ThrowIfTrue(b1 != b2);
Shared\Extensions\SourceTextExtensions.cs (2)
218
Contract
.ThrowIfFalse(offset == length);
264
Contract
.ThrowIfFalse(offset == length);
Shared\Extensions\SyntaxGeneratorExtensions.cs (1)
179
Contract
.ThrowIfNull(type);
Shared\Extensions\TelemetryExtensions.cs (1)
18
Contract
.ThrowIfNull(type.FullName);
Shared\TestHooks\AsynchronousOperationListener.cs (3)
116
Contract
.ThrowIfFalse(_gate.LockHeldByMe());
122
Contract
.ThrowIfFalse(_gate.LockHeldByMe());
187
Contract
.ThrowIfFalse(TrackActiveTokens);
Shared\Utilities\BloomFilter_Serialization.cs (1)
30
Contract
.ThrowIfTrue(bitArray.Length % 8 != 0);
Shared\Utilities\ExtensionOrderer.Graph.cs (1)
22
Contract
.ThrowIfNull(name);
Simplification\AbstractSimplificationService.cs (1)
185
Contract
.ThrowIfFalse(nodesAndTokensToReduce.Any());
SimplificationHelpers.cs (1)
66
Contract
.ThrowIfNull(expression);
SourceTextExtensions_SharedWithCodeStyle.cs (1)
19
Contract
.ThrowIfNull(text);
StackExtensions.cs (2)
34
Contract
.ThrowIfNull(stack);
35
Contract
.ThrowIfNull(range);
Storage\AbstractPersistentStorageService.cs (1)
84
Contract
.ThrowIfNull(storage);
Storage\SQLite\v2\Interop\SqlConnection.cs (2)
55
Contract
.ThrowIfFalse(wrote == length);
316
Contract
.ThrowIfFalse(MemoryMarshal.TryRead(bytes, out Checksum.HashData result));
Storage\SQLite\v2\Interop\SqlStatement.cs (1)
93
Contract
.ThrowIfFalse(Encoding.UTF8.GetBytes(value.AsSpan(), bytes) == utf8ByteCount);
Storage\SQLite\v2\SQLiteConnectionPoolService.cs (2)
139
Contract
.ThrowIfNull(directoryName);
150
Contract
.ThrowIfNull(directory);
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (6)
152
Contract
.ThrowIfTrue(optional.HasValue && optional.Value == null);
166
Contract
.ThrowIfFalse(TaskScheduler.Current == Storage._connectionPoolService.Scheduler.ConcurrentScheduler);
225
Contract
.ThrowIfFalse(TaskScheduler.Current == Storage._connectionPoolService.Scheduler.ExclusiveScheduler);
290
Contract
.ThrowIfTrue(exception != null);
307
Contract
.ThrowIfTrue(exception != null);
364
Contract
.ThrowIfFalse(TaskScheduler.Current == Storage._connectionPoolService.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage.cs (1)
59
Contract
.ThrowIfNull(solutionKey.FilePath);
Storage\SQLite\v2\SQLitePersistentStorage_FlushWrites.cs (1)
65
Contract
.ThrowIfFalse(TaskScheduler.Current == _connectionPoolService.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (3)
49
Contract
.ThrowIfFalse(
68
Contract
.ThrowIfFalse(TaskScheduler.Current == _connectionPoolService.Scheduler.ExclusiveScheduler);
134
Contract
.ThrowIfTrue(id == -1);
Storage\SQLite\v2\SQLitePersistentStorageService.cs (1)
94
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath));
StructuredAnalyzerConfigOptions.cs (1)
65
Contract
.ThrowIfFalse(options.KeyComparer == KeyComparer);
SuppressOperation.cs (3)
17
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
18
Contract
.ThrowIfTrue(startToken.RawKind == 0);
19
Contract
.ThrowIfTrue(endToken.RawKind == 0);
SymbolKey.BodyLevelSymbolKey.cs (5)
22
Contract
.ThrowIfFalse(IsBodyLevelSymbol(symbol));
23
Contract
.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
62
Contract
.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
66
Contract
.ThrowIfFalse(locations.All(loc => loc.IsInSource));
258
Contract
.ThrowIfTrue(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
SymbolKey.BuiltinOperatorSymbolKey.cs (1)
48
Contract
.ThrowIfNull(returnTypeSymbol);
SymbolKey.ErrorTypeSymbolKey.cs (2)
86
Contract
.ThrowIfFalse(typeArguments.IsDefault);
91
Contract
.ThrowIfTrue(typeArguments.IsDefault);
SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
71
Contract
.ThrowIfFalse(parameterTypes.IsDefault);
76
Contract
.ThrowIfTrue(parameterTypes.IsDefault);
SymbolKey.NamedTypeSymbolKey.cs (2)
54
Contract
.ThrowIfFalse(typeArguments.IsDefault);
60
Contract
.ThrowIfTrue(typeArguments.IsDefault);
SymbolKey.SymbolKeyReader.cs (5)
126
Contract
.ThrowIfNull(result);
417
Contract
.ThrowIfTrue(_methodSymbolStack.Count == 0);
418
Contract
.ThrowIfFalse(Equals(method, _methodSymbolStack[^1]));
433
Contract
.ThrowIfTrue(_contextualSymbolStack.Count == 0);
434
Contract
.ThrowIfFalse(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
SymbolKey.SymbolKeyWriter.cs (2)
518
Contract
.ThrowIfTrue(_methodSymbolStack.Count == 0);
519
Contract
.ThrowIfFalse(method.Equals(_methodSymbolStack[_methodSymbolStack.Count - 1]));
SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
15
Contract
.ThrowIfFalse(symbol.TypeParameterKind == TypeParameterKind.Method);
SyntaxAnnotationExtensions.cs (1)
18
Contract
.ThrowIfFalse(symbol is CodeGenerationSymbol);
SyntaxGeneratorExtensions_Negate.cs (1)
526
Contract
.ThrowIfFalse(syntaxFacts.IsNotPattern(pattern));
SyntaxNodeExtensions.cs (8)
102
Contract
.ThrowIfNull(node);
174
Contract
.ThrowIfTrue(node1.RawKind == 0 || node2.RawKind == 0);
292
Contract
.ThrowIfNull(root);
293
Contract
.ThrowIfNull(pairs);
306
Contract
.ThrowIfNull(root);
307
Contract
.ThrowIfNull(pairs);
315
Contract
.ThrowIfNull(nodes);
316
Contract
.ThrowIfFalse(nodes.Any());
SyntaxTokenExtensions.cs (1)
41
Contract
.ThrowIfTrue(token1.RawKind == 0 || token2.RawKind == 0);
TemporaryStorage\TemporaryStorageServiceFactory.cs (1)
160
Contract
.ThrowIfNull(_name);
TextDocumentExtensions.cs (2)
38
Contract
.ThrowIfFalse(textDocument is AdditionalDocument);
47
Contract
.ThrowIfFalse(textDocument is AnalyzerConfigDocument);
TokenData.cs (4)
25
Contract
.ThrowIfNull(tokenStream);
26
Contract
.ThrowIfFalse((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount));
78
Contract
.ThrowIfFalse(this.TokenStream == other.TokenStream);
105
Contract
.ThrowIfFalse(index1 >= 0 && index2 >= 0);
TokenPairWithOperations.cs (2)
28
Contract
.ThrowIfNull(tokenStream);
30
Contract
.ThrowIfFalse(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
TokenStream.cs (10)
138
Contract
.ThrowIfFalse(0 <= index && index < this.TokenCount);
237
Contract
.ThrowIfNull(data);
243
Contract
.ThrowIfNull(data);
249
Contract
.ThrowIfNull(data);
250
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
429
Contract
.ThrowIfFalse(this.FormatBeginningOfTree);
441
Contract
.ThrowIfFalse(this.FormatEndOfTree);
453
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
465
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
478
Contract
.ThrowIfTrue(token.RawKind == 0);
TreeData.cs (1)
42
Contract
.ThrowIfNull(root);
TreeData.Debug.cs (1)
25
Contract
.ThrowIfFalse(text == _debugNodeData.GetTextBetween(token1, token2));
TreeData.Node.cs (2)
18
Contract
.ThrowIfFalse(root.GetFirstToken(includeZeroWidth: true).RawKind != 0);
23
Contract
.ThrowIfTrue(token.RawKind == 0);
TreeData.NodeAndText.cs (2)
20
Contract
.ThrowIfNull(text);
26
Contract
.ThrowIfTrue(token.RawKind == 0);
TreeData.StructuredTrivia.cs (1)
22
Contract
.ThrowIfFalse(trivia.HasStructure);
Utilities\Documentation\XmlDocumentationProvider.cs (2)
106
Contract
.ThrowIfNull(xmlDocCommentBytes);
155
Contract
.ThrowIfNull(filePath);
Utilities\TaskQueue.cs (2)
25
Contract
.ThrowIfNull(operationListener);
26
Contract
.ThrowIfNull(taskScheduler);
VirtualChar.cs (1)
72
Contract
.ThrowIfFalse(surrogateChar == 0 || rune == Rune.ReplacementChar,
Workspace\DocumentActiveContextChangedEventArgs.cs (4)
22
Contract
.ThrowIfNull(solution);
23
Contract
.ThrowIfNull(sourceTextContainer);
24
Contract
.ThrowIfNull(oldActiveContextDocumentId);
25
Contract
.ThrowIfNull(newActiveContextDocumentId);
Workspace\DocumentEventArgs.cs (1)
18
Contract
.ThrowIfNull(document);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
35
Contract
.ThrowIfFalse(mappedSpanResults.Length == textChanges.Length);
Workspace\Host\PersistentStorage\IPersistentStorageConfiguration.cs (1)
54
Contract
.ThrowIfNull(fileName);
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (5)
200
Contract
.ThrowIfNull(documentInfo.FilePath);
464
Contract
.ThrowIfFalse(_documentIdToDynamicFileInfoProvider.TryGetValue(documentId, out var fileInfoProvider));
479
Contract
.ThrowIfNull(fileInfo, "We previously received a dynamic file for this path, and we're responding to a change, so we expect to get a new one.");
548
Contract
.ThrowIfNull(documentInfo.FilePath, "We shouldn't be adding documents without file paths.");
578
Contract
.ThrowIfTrue(folders.IsDefault);
Workspace\ProjectSystem\ProjectSystemProject.cs (2)
811
Contract
.ThrowIfNull(providerForFileInfo);
1302
Contract
.ThrowIfNull(remainingMetadataReferences);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (17)
153
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
160
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
238
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
261
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
272
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
300
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
304
Contract
.ThrowIfFalse(_projectReferenceInfoMap.Count == 0);
305
Contract
.ThrowIfFalse(_projectToMaxSupportedLangVersionMap.Count == 0);
306
Contract
.ThrowIfFalse(_projectToDependencyNodeTargetIdentifier.Count == 0);
355
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
401
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
448
Contract
.ThrowIfNull(projectWithMetadataReference);
449
Contract
.ThrowIfNull(referencedProject);
485
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
526
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
558
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
577
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
Workspace\ProjectSystem\ProjectSystemProjectOptionsProcessor.cs (1)
218
Contract
.ThrowIfNull(sender);
Workspace\Solution\Checksum.cs (3)
61
Contract
.ThrowIfFalse(MemoryMarshal.TryRead(checksum, out HashData hash));
121
Contract
.ThrowIfFalse(span.Length >= HashSize);
122
Contract
.ThrowIfFalse(MemoryMarshal.TryWrite(span, ref Unsafe.AsRef(in _checksum)));
Workspace\Solution\ChecksumCollection.cs (2)
48
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksums));
65
Contract
.ThrowIfFalse(values.Count == checksums.Children.Length);
Workspace\Solution\Document.cs (2)
291
Contract
.ThrowIfNull(result);
485
Contract
.ThrowIfNull(_cachedOptions);
Workspace\Solution\DocumentState.cs (6)
46
Contract
.ThrowIfFalse(_options is null == _treeSource is null);
72
Contract
.ThrowIfNull(options);
159
Contract
.ThrowIfNull(tree);
231
Contract
.ThrowIfNull(newTree);
521
Contract
.ThrowIfNull(_options);
677
Contract
.ThrowIfFalse(existingId == id);
Workspace\Solution\DocumentState_LinkedFileReuse.cs (1)
36
Contract
.ThrowIfNull(siblingTreeSource);
Workspace\Solution\Project.cs (2)
38
Contract
.ThrowIfNull(solution);
39
Contract
.ThrowIfNull(projectState);
Workspace\Solution\ProjectDependencyGraph.cs (3)
92
Contract
.ThrowIfNull(transitiveReferencesMap);
93
Contract
.ThrowIfNull(reverseTransitiveReferencesMap);
129
Contract
.ThrowIfFalse(_projectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_AddProjectReference.cs (1)
17
Contract
.ThrowIfFalse(_projectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveProject.cs (1)
14
Contract
.ThrowIfFalse(_projectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveProjectReference.cs (2)
15
Contract
.ThrowIfFalse(_projectIds.Contains(projectId));
16
Contract
.ThrowIfFalse(_referencesMap[projectId].Contains(referencedProjectId));
Workspace\Solution\ProjectReference.cs (1)
25
Contract
.ThrowIfNull(projectId);
Workspace\Solution\ProjectState.cs (3)
96
Contract
.ThrowIfNull(projectInfo);
97
Contract
.ThrowIfNull(languageServices);
287
Contract
.ThrowIfNull(projectDirectory);
Workspace\Solution\RecoverableTextAndVersion.cs (4)
164
Contract
.ThrowIfTrue(source is LoadableTextAndVersionSource { CacheResult: true });
177
Contract
.ThrowIfNull(_storage);
187
Contract
.ThrowIfNull(_storage);
197
Contract
.ThrowIfFalse(_storage == null); // Cannot save more than once
Workspace\Solution\Solution.cs (6)
69
Contract
.ThrowIfTrue(this.WorkspaceKind == CodeAnalysis.WorkspaceKind.RemoteWorkspace, "Access .Workspace off of a RemoteWorkspace Solution is not supported.");
130
Contract
.ThrowIfNull(state);
219
Contract
.ThrowIfNull(documentId);
234
Contract
.ThrowIfNull(documentId);
296
Contract
.ThrowIfNull(generatedDocument, "The call to GetDocumentState found a SourceGeneratedDocumentState, so we should have found it now.");
1763
Contract
.ThrowIfNull(newDocumentState, "Because we just froze this document, it should always exist.");
Workspace\Solution\SolutionState.CompilationTracker.CompilationTrackerState.cs (7)
70
Contract
.ThrowIfTrue(documentsAreFinalAndFrozen && !documentsAreFinal);
147
Contract
.ThrowIfTrue(compilation.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
159
Contract
.ThrowIfTrue(intermediateProjects is null);
210
Contract
.ThrowIfTrue(intermediateProjects is null);
211
Contract
.ThrowIfFalse(intermediateProjects.Count > 0);
271
Contract
.ThrowIfNull(finalCompilation);
333
Contract
.ThrowIfNull(projectId);
Workspace\Solution\SolutionState.CompilationTracker.cs (7)
55
Contract
.ThrowIfNull(project);
225
Contract
.ThrowIfNull(oldDocumentId, $"{nameof(oldTree)} came from the compilation produced by the workspace, so the document ID should have existed.");
234
Contract
.ThrowIfFalse(compilationPair.CompilationWithoutGeneratedDocuments.ContainsSyntaxTree(tree));
301
Contract
.ThrowIfNull(finalCompilation, "We have a FinalState, so we must have a non-null final compilation");
821
Contract
.ThrowIfNull(stateMember);
823
Contract
.ThrowIfNull(additionalTextsMember);
827
Contract
.ThrowIfFalse(additionalTexts.Length == this.ProjectState.AdditionalDocumentStates.Count);
Workspace\Solution\SolutionState.cs (10)
174
Contract
.ThrowIfFalse(_projectIdToProjectStateMap.Count == ProjectIds.Count);
175
Contract
.ThrowIfFalse(_projectIdToProjectStateMap.Count == _dependencyGraph.ProjectIds.Count);
180
Contract
.ThrowIfTrue(_projectIdToTrackerMap.Any(kvp => kvp.Key != kvp.Value.ProjectState.Id));
399
Contract
.ThrowIfNull(result);
423
Contract
.ThrowIfNull(projectState);
1499
Contract
.ThrowIfFalse(_projectIdToProjectStateMap.ContainsKey(projectId));
1676
Contract
.ThrowIfFalse(newIdToProjectStateMap.ContainsKey(doc.Id.ProjectId));
1859
Contract
.ThrowIfTrue(_frozenSourceGeneratedDocumentState != null, "We shouldn't be calling WithFrozenSourceGeneratedDocument on a solution with a frozen source generated document.");
1919
Contract
.ThrowIfFalse(newTrackerMap.TryGetValue(projectId, out var existingTracker));
1921
Contract
.ThrowIfNull(replacingItemTracker);
Workspace\Solution\SolutionState.SymbolToProjectId.cs (1)
38
Contract
.ThrowIfNull(syntaxTree);
Workspace\Solution\SolutionState_Checksum.cs (1)
56
Contract
.ThrowIfNull(projectId);
Workspace\Solution\StateChecksums.cs (6)
57
Contract
.ThrowIfNull(state.FrozenSourceGeneratedDocumentState, "We should not have had a FrozenSourceGeneratedDocumentIdentity checksum if we didn't have a text in the first place.");
63
Contract
.ThrowIfNull(state.FrozenSourceGeneratedDocumentState, "We should not have had a FrozenSourceGeneratedDocumentState checksum if we didn't have a text in the first place.");
142
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksum));
143
Contract
.ThrowIfFalse(this == stateChecksum);
160
Contract
.ThrowIfNull(state.CompilationOptions, "We should not be trying to serialize a project with no compilation options; RemoteSupportedLanguages.IsSupported should have filtered it out.");
166
Contract
.ThrowIfNull(state.ParseOptions, "We should not be trying to serialize a project with no compilation options; RemoteSupportedLanguages.IsSupported should have filtered it out.");
Workspace\Solution\TextDocument.cs (2)
27
Contract
.ThrowIfNull(project);
28
Contract
.ThrowIfNull(state);
Workspace\Solution\TextDocumentStates.cs (1)
167
Contract
.ThrowIfTrue(!ignoreUnchangedContent && ignoreUnchangeableDocuments);
Workspace\Solution\WeaklyCachedRecoverableValueSource.cs (1)
148
Contract
.ThrowIfTrue(Gate.CurrentCount != 0);
Workspace\TextExtensions.cs (1)
96
Contract
.ThrowIfFalse(solution.ContainsAnalyzerConfigDocument(id));
Workspace\Workspace.cs (7)
342
Contract
.ThrowIfNull(transformation);
1078
Contract
.ThrowIfNull(newDocument);
1410
Contract
.ThrowIfNull(projectChanges.OldProject.CompilationOptions);
1411
Contract
.ThrowIfNull(projectChanges.NewProject.CompilationOptions);
1750
Contract
.ThrowIfTrue(changes.GetAddedProjects().Any());
1751
Contract
.ThrowIfTrue(changes.GetRemovedProjects().Any());
1752
Contract
.ThrowIfTrue(changes.GetProjectChanges().Any());
Workspace\Workspace_Editor.cs (7)
276
Contract
.ThrowIfNull(currentContextId, "The document is open, so we should have had some context ID.");
450
Contract
.ThrowIfFalse(_openSourceGeneratedDocumentIdentities.Remove(document.Id));
685
Contract
.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
693
Contract
.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
711
Contract
.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
715
Contract
.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
739
Contract
.ThrowIfFalse(doc.TryGetText(out var text));
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
MSBuild\MSBuildWorkspace.cs (1)
476
Contract
.ThrowIfNull(dir);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (9)
Fakes\SimpleAssetSource.cs (1)
49
Contract
.ThrowIfTrue(asset is null);
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
30
Contract
.ThrowIfNull(sourceText, "Failed to fetch the text of an additional file.");
MEF\TestComposition.cs (1)
183
Contract
.ThrowIfFalse(testAssembly == null, $"Test assemblies are not allowed in test composition: {testAssembly}. Specify explicit test parts instead.");
Remote\InProcRemostHostClient.cs (4)
57
Contract
.ThrowIfNull(client);
139
Contract
.ThrowIfFalse(options.ClientRpcTarget is null == descriptor.ClientInterface is null);
143
Contract
.ThrowIfNull(options.ClientRpcTarget);
245
Contract
.ThrowIfFalse(descriptor.ClientInterface == null);
Remote\TestSerializerService.cs (2)
93
Contract
.ThrowIfFalse(_sharedTestGeneratorReferences.TryGetValue(testGeneratorReferenceGuid, out var generatorReference));
140
Contract
.ThrowIfFalse(_sharedTestGeneratorReferences == null ||
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
Options\OptionSerializerTests.cs (2)
90
Contract
.ThrowIfNull(defaultValue, $"Option: {option.Name}");
111
Contract
.ThrowIfNull(enumType, $"Option: {option.Name}");
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
685
Contract
.ThrowIfNull(document);
Microsoft.VisualStudio.IntegrationTest.Utilities (39)
AutomationElementHelper.cs (1)
57
Contract
.ThrowIfNull(element);
InProcess\AbstractCodeRefactorDialog_InProc.cs (1)
77
Contract
.ThrowIfFalse(result);
InProcess\CodeDefinitionWindow_InProc.cs (1)
43
Contract
.ThrowIfNull(wpfView, "We were unable to get the Code Definition Window view.");
InProcess\Editor_InProc.cs (2)
74
Contract
.ThrowIfNull(textViewHost);
234
Contract
.ThrowIfNull(subjectBuffer);
InProcess\GenerateTypeDialog_InProc.cs (5)
83
Contract
.ThrowIfFalse(await dialog.GetTestAccessor().AccessListComboBox.SimulateSelectItemAsync(JoinableTaskFactory, accessibility));
96
Contract
.ThrowIfFalse(await dialog.GetTestAccessor().KindListComboBox.SimulateSelectItemAsync(JoinableTaskFactory, kind));
109
Contract
.ThrowIfFalse(await dialog.GetTestAccessor().ProjectListComboBox.SimulateSelectItemAsync(JoinableTaskFactory, projectName));
122
Contract
.ThrowIfFalse(await dialog.GetTestAccessor().CreateNewFileRadioButton.SimulateClickAsync(JoinableTaskFactory));
123
Contract
.ThrowIfFalse(await dialog.GetTestAccessor().CreateNewFileComboBox.SimulateSelectItemAsync(JoinableTaskFactory, newFileName, mustExist: false));
InProcess\InteractiveWindow_InProc.cs (8)
52
Contract
.ThrowIfNull(_interactiveWindow);
59
Contract
.ThrowIfNull(_interactiveWindow);
65
Contract
.ThrowIfNull(_interactiveWindow);
71
Contract
.ThrowIfNull(_interactiveWindow);
167
Contract
.ThrowIfFalse(result.IsSuccessful);
178
Contract
.ThrowIfNull(_interactiveWindow);
217
Contract
.ThrowIfNull(_interactiveWindow);
262
Contract
.ThrowIfNull(_interactiveWindow);
InProcess\MoveToNamespaceDialog_InProc.cs (1)
65
Contract
.ThrowIfFalse(success);
InProcess\PickMembersDialog_InProc.cs (1)
65
Contract
.ThrowIfFalse(await button.SimulateClickAsync(JoinableTaskFactory));
InProcess\SolutionExplorer_InProc.cs (10)
90
Contract
.ThrowIfNull(_solution);
91
Contract
.ThrowIfNull(_fileName);
176
Contract
.ThrowIfNull(_solution);
254
Contract
.ThrowIfNull(_solution);
261
Contract
.ThrowIfNull(_solution);
475
Contract
.ThrowIfNull(_solution);
831
Contract
.ThrowIfNull(_solution);
873
Contract
.ThrowIfNull(_solution);
898
Contract
.ThrowIfNull(item);
910
Contract
.ThrowIfNull(item);
InProcess\TestWaitingService.cs (1)
33
Contract
.ThrowIfNull(featureWaiter);
InProcess\TextViewWindow_InProc.cs (2)
268
Contract
.ThrowIfNull(session);
284
Contract
.ThrowIfNull(session);
IntegrationHelper.cs (1)
276
Contract
.ThrowIfNull(moniker);
OutOfProcess\Editor_OutOfProc.Verifier.cs (2)
159
Contract
.ThrowIfNull(currentParameter);
169
Contract
.ThrowIfNull(currentParameters);
OutOfProcess\TextViewWindow_OutOfProc.Verifier.cs (1)
95
Contract
.ThrowIfNull(applyFix);
VisualStudioInstanceFactory.cs (2)
125
Contract
.ThrowIfNull(_currentlyRunningInstance);
195
Contract
.ThrowIfNull(_currentlyRunningInstance);
Microsoft.VisualStudio.LanguageServices (147)
CodeCleanup\AbstractCodeCleanUpFixer.cs (2)
199
Contract
.ThrowIfNull(workspace);
206
Contract
.ThrowIfNull(document);
CodeLens\RemoteCodeLensReferencesService.cs (1)
167
Contract
.ThrowIfTrue(results.IsDefaultOrEmpty);
ColorSchemes\ColorSchemeApplier.ClassificationVerifier.cs (1)
165
Contract
.ThrowIfNull(_fontAndColorUtilities);
CommonControls\MemberSelectionViewModel.cs (1)
107
Contract
.ThrowIfFalse(ShowCheckDependentsButton);
DebuggerIntelliSense\DebuggerIntellisenseFilter.cs (1)
156
Contract
.ThrowIfNull(_context);
DesignerAttribute\VisualStudioDesignerAttributeService.cs (1)
317
Contract
.ThrowIfNull(_projectSystemNotificationQueue);
Diagnostics\DiagnosticProgressReporter.cs (1)
167
Contract
.ThrowIfNull(_taskCenterService);
Diagnostics\VisualStudioDiagnosticAnalyzerProvider.cs (2)
38
Contract
.ThrowIfNull(extensionManager);
39
Contract
.ThrowIfNull(typeIExtensionContent);
DocumentationComments\VisualStudioDocumentationProvider.cs (2)
27
Contract
.ThrowIfNull(memberIndexService);
28
Contract
.ThrowIfNull(filePath);
ErrorReporting\VisualStudioInfoBar.cs (2)
97
Contract
.ThrowIfFalse(_threadingContext.JoinableTaskContext.IsOnMainThread);
129
Contract
.ThrowIfNull(onClose);
FindReferences\Entries\DocumentSpanEntry.cs (1)
301
Contract
.ThrowIfFalse(CanNavigateTo());
FindReferences\Entries\SimpleMessageEntry.cs (2)
54
Contract
.ThrowIfFalse(CanNavigateTo());
55
Contract
.ThrowIfNull(_navigationBucket);
Implementation\AbstractEditorFactory.cs (3)
74
Contract
.ThrowIfNull(_oleServiceProvider);
106
Contract
.ThrowIfNull(textBuffer, $"Failed to get document data for {pszMkDocument}");
160
Contract
.ThrowIfNull(_oleServiceProvider);
Implementation\AbstractOleCommandTarget.cs (4)
30
Contract
.ThrowIfNull(wpfTextView);
31
Contract
.ThrowIfNull(componentModel);
59
Contract
.ThrowIfNull(vsTextView);
64
Contract
.ThrowIfNull(nextCommandTarget);
Implementation\AbstractOleCommandTarget.Query.cs (2)
17
Contract
.ThrowIfFalse(commandCount == 1);
18
Contract
.ThrowIfFalse(prgCmds.Length == 1);
InheritanceMargin\InheritanceGlyphFactory.cs (1)
83
Contract
.ThrowIfTrue(membersOnLine.IsEmpty);
InheritanceMargin\InheritanceMarginHelpers.cs (1)
140
Contract
.ThrowIfTrue(members.Length <= 1);
InheritanceMargin\InheritanceMarginTag.cs (1)
41
Contract
.ThrowIfTrue(membersOnLine.IsEmpty);
InheritanceMargin\InheritanceMarginTaggerProvider.cs (3)
59
Contract
.ThrowIfNull(textView);
78
Contract
.ThrowIfNull(textView);
144
Contract
.ThrowIfTrue(membersOnTheLineArray.IsEmpty);
InlineRename\InlineRenameUndoManager.cs (2)
112
Contract
.ThrowIfFalse(textUndoHistoryService.TryGetTextUndoHistory(workspace, subjectBuffer, out var undoHistory));
113
Contract
.ThrowIfFalse(undoHistory.Properties.TryGetProperty(typeof(ITextBuffer), out ITextBuffer primaryBuffer));
Interop\ComAggregate.cs (3)
44
Contract
.ThrowIfNull(value, "value");
57
Contract
.ThrowIfNull(comWrapper, "comWrapper");
62
Contract
.ThrowIfNull(target, "target");
LanguageClient\LogHubLspLogger.cs (1)
31
Contract
.Fail($"{GetType().FullName} was double disposed");
LanguageService\AbstractLanguageService`2.cs (3)
179
Contract
.ThrowIfNull(textView);
182
Contract
.ThrowIfNull(wpfTextView, "Could not get IWpfTextView for IVsTextView");
214
Contract
.ThrowIfNull(openDocument);
LanguageService\AbstractLanguageService`2.VsCodeWindowManager.cs (4)
113
Contract
.ThrowIfFalse(_navigationBarController == null, "We shouldn't have a controller manager if there isn't a dropdown");
114
Contract
.ThrowIfFalse(_dropdownBarClient == null, "We shouldn't have a dropdown client if there isn't a dropdown");
256
Contract
.ThrowIfFalse(_documentOutlineControl is null);
257
Contract
.ThrowIfFalse(_documentOutlineViewHost is null);
LanguageService\AbstractLanguageService`2.VsLanguageDebugInfo.cs (3)
49
Contract
.ThrowIfNull(languageService);
50
Contract
.ThrowIfNull(languageServiceProvider);
320
Contract
.ThrowIfNull(tree);
Library\ClassView\AbstractSyncClassViewCommandHandler.cs (1)
36
Contract
.ThrowIfNull(serviceProvider);
NavigationBar\NavigationBarClient.cs (3)
83
Contract
.ThrowIfNull(item, "We shouldn't be getting requests for member items if we had no type selected.");
127
Contract
.ThrowIfNull(_dropdownBar, "The dropdown is asking us for things, so we should have a reference to it.");
201
Contract
.ThrowIfNull(_dropdownBar, "The dropdown is asking us for things, so we should have a reference to it.");
Options\LocalUserRegistryOptionPersister.cs (8)
38
Contract
.ThrowIfNull(localRegistry);
39
Contract
.ThrowIfFalse(ErrorHandler.Succeeded(localRegistry.GetLocalRegistryRootEx((uint)__VsLocalRegistryType.RegType_UserSettings, out var rootHandle, out var rootPath)));
42
Contract
.ThrowIfTrue(string.IsNullOrEmpty(rootPath));
43
Contract
.ThrowIfTrue(handle == __VsLocalRegistryRootHandle.RegHandle_Invalid);
133
Contract
.ThrowIfNull(_registryKey);
144
Contract
.ThrowIfNull(value);
151
Contract
.ThrowIfNull(value);
159
Contract
.ThrowIfNull(value);
Options\NamingPreferencesReadFallback.cs (1)
26
Contract
.ThrowIfNull(language);
Options\VisualStudioSettingsOptionPersister.cs (3)
66
Contract
.ThrowIfNull(_settingManager);
105
Contract
.ThrowIfNull(_settingManager);
197
Contract
.ThrowIfNull(_settingManager);
Packaging\PackageInstallerServiceFactory.cs (5)
217
Contract
.ThrowIfFalse(IsEnabled);
305
Contract
.ThrowIfFalse(IsEnabled);
377
Contract
.ThrowIfFalse(IsEnabled);
453
Contract
.ThrowIfNull(_workQueue, "We should only register for events after having create the WorkQueue");
462
Contract
.ThrowIfNull(_workQueue, "How could we be processing a workqueue change without a workqueue?");
PickMembers\PickMembersDialogViewModel.cs (2)
158
Contract
.ThrowIfFalse(CanMoveUp);
166
Contract
.ThrowIfFalse(CanMoveDown);
Preview\FileChange.cs (1)
46
Contract
.ThrowIfFalse(left != null || right != null);
Preview\PreviewUpdater.cs (2)
58
Contract
.ThrowIfNull(_previewWorkspace, "We shouldn't have a current document if we don't have a workspace.");
69
Contract
.ThrowIfNull(_previewWorkspace, "We shouldn't have a current document if we don't have a workspace.");
PreviewPane\PreviewPane.xaml.cs (2)
77
Contract
.ThrowIfNull(helpLinkToolTipText);
210
Contract
.ThrowIfFalse(_differenceViewerPreview == null);
ProjectSystem\FileChangeTracker.cs (2)
92
Contract
.ThrowIfTrue(_fileChangeCookie != s_none);
108
Contract
.ThrowIfTrue(_fileChangeCookie != s_none);
ProjectSystem\FileChangeWatcher.cs (9)
143
Contract
.ThrowIfFalse(kind is Kind.None);
158
Contract
.ThrowIfFalse(kind is Kind.WatchDirectory);
174
Contract
.ThrowIfFalse(kind is Kind.WatchFile);
190
Contract
.ThrowIfFalse(kind is Kind.UnwatchDirectories);
206
Contract
.ThrowIfFalse(kind is Kind.UnwatchFiles);
222
Contract
.ThrowIfFalse(kind is Kind.UnwatchFile);
353
Contract
.ThrowIfFalse(_cookies is not null);
358
Contract
.ThrowIfFalse(_tokens is not null);
450
Contract
.ThrowIfFalse(_activeFileWatchingTokens.Remove(watchedFile), "This token was no longer being watched.");
ProjectSystem\Legacy\AbstractLegacyProject.cs (1)
70
Contract
.ThrowIfNull(hierarchy);
ProjectSystem\Legacy\AbstractLegacyProject_IProjectSiteEx.cs (1)
25
Contract
.ThrowIfFalse(_batchScopes.Count > 0);
ProjectSystem\Legacy\SolutionEventsBatchScopeCreator.cs (1)
187
Contract
.ThrowIfTrue(_scopeCreator._fullSolutionLoadScopes.Any());
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.cs (1)
231
Contract
.ThrowIfFalse(stream.Length == size);
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.MetadataCache.cs (1)
78
Contract
.ThrowIfNull(newMetadata);
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.RecoverableMetadataValueSource.cs (1)
29
Contract
.ThrowIfFalse(storages.Length > 0);
ProjectSystem\MiscellaneousFilesWorkspace.cs (1)
291
Contract
.ThrowIfNull(languageInformation);
ProjectSystem\VisualStudioWorkspaceImpl.cs (4)
252
Contract
.ThrowIfFalse(ImmutableInterlocked.TryAdd(ref _projectToRuleSetFilePath, project.Id, ruleSetFilePathFunc));
928
Contract
.ThrowIfNull(folderPath, "If we didn't have a file path, then we expected a folder path to generate the file path from.");
957
Contract
.ThrowIfNull(hierarchy, "Removing files from projects without hierarchies are not supported.");
961
Contract
.ThrowIfNull(document.FilePath, "Removing files from projects that don't have file names are not supported.");
RoslynActivityLogger.cs (2)
32
Contract
.ThrowIfNull(traceSource);
43
Contract
.ThrowIfNull(traceSource);
RoslynPackage.cs (5)
362
Contract
.ThrowIfNull(globalNotificationService);
376
Contract
.ThrowIfNull(gate);
377
Contract
.ThrowIfNull(globalNotificationService);
395
Contract
.ThrowIfNull(gate);
396
Contract
.ThrowIfNull(globalNotificationService);
Snippets\AbstractSnippetExpansionClient.cs (2)
1013
Contract
.ThrowIfNull(expansion);
1040
Contract
.ThrowIfNull(vsTextView);
SolutionEventMonitor.cs (1)
30
Contract
.ThrowIfNull(notificationService);
Storage\AbstractCloudCachePersistentStorageService.cs (1)
31
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath));
Storage\VisualStudioCloudCacheStorageService.cs (1)
66
Contract
.ThrowIfNull(cacheService);
SyncNamespaces\SyncNamespacesCommandHandler.cs (1)
54
Contract
.ThrowIfNull(serviceProvider);
TableDataSource\DiagnosticTableItem.cs (1)
27
Contract
.ThrowIfNull(data);
TableDataSource\Suppression\VisualStudioDiagnosticListSuppressionStateService.cs (2)
219
Contract
.ThrowIfNull(_tableControl);
302
Contract
.ThrowIfNull(project);
TableDataSource\Suppression\VisualStudioDiagnosticListTableCommandHandler.cs (1)
93
Contract
.ThrowIfFalse(_threadingContext.HasMainThread);
TableDataSource\TableEntriesFactory.cs (1)
222
Contract
.ThrowIfNull(primary);
TableDataSource\TableItem.cs (3)
28
Contract
.ThrowIfNull(workspace);
29
Contract
.ThrowIfNull(projectNames);
30
Contract
.ThrowIfNull(projectGuids);
TableDataSource\TaskList\VisualStudioTaskListTable.cs (3)
125
Contract
.ThrowIfNull(args.Solution);
126
Contract
.ThrowIfNull(args.DocumentId);
133
Contract
.ThrowIfNull(data.Solution);
TableDataSource\VisualStudioDiagnosticListTable.BuildTableDataSource.cs (1)
211
Contract
.ThrowIfTrue(data.IsSuppressed);
TaskList\ExternalErrorDiagnosticUpdateSource.cs (1)
366
Contract
.ThrowIfNull(projectGroup.Key);
TaskList\HostDiagnosticUpdateSource.cs (6)
75
Contract
.ThrowIfNull(projectId);
76
Contract
.ThrowIfNull(key);
77
Contract
.ThrowIfNull(items);
89
Contract
.ThrowIfNull(projectId);
113
Contract
.ThrowIfNull(projectId);
114
Contract
.ThrowIfNull(key);
Telemetry\AbstractWorkspaceTelemetryService.cs (1)
26
Contract
.ThrowIfFalse(CurrentSession is null);
Telemetry\FileLogger.cs (1)
57
Contract
.ThrowIfNull(e.Value);
Telemetry\TelemetryLogger.cs (1)
141
Contract
.ThrowIfFalse(_pendingScopes.TryRemove(blockId, out var scope));
Telemetry\VisualStudioWorkspaceTelemetryService.cs (1)
57
Contract
.ThrowIfNull(settings);
UnusedReferences\RemoveUnusedReferencesCommandHandler.cs (1)
63
Contract
.ThrowIfNull(serviceProvider);
Utilities\VsCodeWindowViewTracker.cs (2)
92
Contract
.ThrowIfNull(pView, $"{nameof(IVsCodeWindow.GetLastActiveView)} returned success, but did not provide a view.");
94
Contract
.ThrowIfNull(view, "The active view should be initialized.");
ValueTracking\ValueTrackingCommandHandler.cs (1)
172
Contract
.ThrowIfNull(roslynPackage);
ValueTracking\ValueTrackingToolWindow.cs (2)
67
Contract
.ThrowIfTrue(Initialized);
79
Contract
.ThrowIfFalse(Initialized);
Venus\VenusCommandFilter.cs (3)
31
Contract
.ThrowIfNull(wpfTextView);
32
Contract
.ThrowIfNull(subjectBuffer);
33
Contract
.ThrowIfNull(nextCommandTarget);
Workspace\GlobalUndoServiceFactory.WorkspaceGlobalUndoTransaction.cs (1)
60
Contract
.ThrowIfNull(visualStudioWorkspace);
Workspace\SourceGeneratedFileManager.cs (1)
287
Contract
.ThrowIfNull(sourceGeneratedDocument);
Workspace\VisualStudioActiveDocumentTracker.cs (1)
146
Contract
.ThrowIfNull(frame);
Workspace\VisualStudioDocumentNavigationService.cs (1)
428
Contract
.ThrowIfNull(textBuffer);
Microsoft.VisualStudio.LanguageServices.CSharp (16)
CodeModel\CSharpCodeModelService.cs (12)
968
Contract
.ThrowIfNull(symbol);
1734
Contract
.ThrowIfNull(parsedArgumentList);
1761
Contract
.ThrowIfNull(node.Parent);
2723
Contract
.ThrowIfNull(typeSymbol);
2756
Contract
.ThrowIfNull(fieldDeclaration);
2766
Contract
.ThrowIfNull(newFieldDeclaration);
2795
Contract
.ThrowIfNull(attributeList);
2813
Contract
.ThrowIfNull(newAttributeList);
2822
Contract
.ThrowIfNull(argumentList);
2824
Contract
.ThrowIfNull(newArgumentList);
2832
Contract
.ThrowIfNull(parameterList);
2834
Contract
.ThrowIfNull(newParameterList);
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
159
Contract
.ThrowIfFalse(
ProjectSystemShim\TempPECompilerService.cs (2)
39
Contract
.ThrowIfFalse(fileNames.Length == fileContents.Length);
73
Contract
.ThrowIfFalse(optionNames.Length == optionValues.Length);
Utilities\CSharpParseOptionsChangingService.cs (1)
52
Contract
.ThrowIfFalse(LanguageVersionFacts.TryParse(maxLangVersion, out var parsedMaxLanguageVersion));
Microsoft.VisualStudio.LanguageServices.Implementation (19)
CodeModel\AbstractCodeModelObject_CodeGen.cs (3)
50
Contract
.ThrowIfNull(method);
64
Contract
.ThrowIfNull(method);
170
Contract
.ThrowIfNull(method);
CodeModel\AbstractCodeModelService.cs (5)
424
Contract
.ThrowIfNull(node.Parent);
818
Contract
.ThrowIfNull(typeSymbol);
826
Contract
.ThrowIfNull(typeSymbol);
1035
Contract
.ThrowIfNull(annotatedNode);
1084
Contract
.ThrowIfTrue(object.ReferenceEquals(root, newRoot), $"We failed to insert the node into the tree; this might be if {nameof(containerNode)} came from a different snapshot.");
CodeModel\ProjectCodeModel.cs (2)
57
Contract
.ThrowIfNull(_projectId);
58
Contract
.ThrowIfNull(_visualStudioWorkspace);
Options\Style\EnumCodeStyleOptionViewModel.cs (1)
30
=>
Contract
.ThrowIfFalse(typeof(T).IsEnum);
ProjectSystem\CPS\CPSProject_IWorkspaceProjectContext.cs (1)
265
Contract
.ThrowIfFalse(_batchScopes.TryDequeue(out var scope));
RoslynVisualStudioWorkspace.cs (3)
87
Contract
.ThrowIfNull(textDocument.FilePath);
162
Contract
.ThrowIfNull(tree, "We have a location that was in source, but doesn't have a SourceTree.");
165
Contract
.ThrowIfNull(document, "We have a symbol coming from a tree, and that tree isn't in the Project it supposedly came from.");
SolutionExplorer\AnalyzerReferenceManager.cs (1)
64
Contract
.ThrowIfNull(_tracker.SelectedHierarchy);
SolutionExplorer\DiagnosticItem\BaseDiagnosticAndGeneratorItemSource.cs (2)
109
Contract
.ThrowIfFalse(HasItems);
182
Contract
.ThrowIfNull(_items, "We only subscribe to events after we create the items, so this should not be null.");
SolutionExplorer\SourceGeneratedFileItems\SourceGeneratedFileItemSource.cs (1)
163
Contract
.ThrowIfTrue(_cancellationSeries.HasActiveToken);
Microsoft.VisualStudio.LanguageServices.New.IntegrationTests (6)
InProcess\EditorInProcess.cs (3)
147
Contract
.ThrowIfNull(subjectBuffer);
291
Contract
.ThrowIfNull(session);
304
Contract
.ThrowIfNull(session);
InProcess\SolutionExplorerInProcess.cs (1)
39
Contract
.ThrowIfTrue(await IsSolutionOpenAsync(cancellationToken));
InProcess\WorkspaceInProcess.cs (1)
138
Contract
.ThrowIfFalse(await statusService.IsFullyLoadedAsync(cancellationToken));
IntegrationHelper.cs (1)
276
Contract
.ThrowIfNull(moniker);
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
ProjectSystemShim\TempPECompiler.TempPEProject.vb (1)
74
Contract
.ThrowIfFalse(itemid = VSConstants.VSITEMID.Nil)
ProjectSystemShim\TempPECompiler.vb (1)
26
Contract
.ThrowIfFalse(ppErrors = IntPtr.Zero)
Microsoft.VisualStudio.LanguageServices.Xaml (8)
Implementation\LanguageServer\Handler\Commands\CreateEventCommandHandler.cs (1)
47
Contract
.ThrowIfNull(request.Arguments);
Implementation\LanguageServer\Handler\Completion\CompletionResolveHandler.cs (1)
48
Contract
.ThrowIfNull(context.Solution);
Implementation\LanguageServer\Handler\Definitions\GoToDefinitionHandler.cs (2)
111
Contract
.ThrowIfNull(sourceDefinition.FilePath);
153
Contract
.ThrowIfNull(symbolDefinition.Symbol);
Implementation\LanguageServer\Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
64
Contract
.ThrowIfNull(context.Solution);
Implementation\LanguageServer\Handler\Diagnostics\WorkspacePullDiagnosticHandler.cs (1)
43
Contract
.ThrowIfNull(context.Solution);
Implementation\LanguageServer\Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
56
Contract
.ThrowIfNull(result.TextChange.NewText);
Implementation\LanguageServer\Handler\OnTypeRename\OnTypeRenameHandler.cs (1)
89
Contract
.ThrowIfTrue(result.Ranges.IsDefault);
Roslyn.VisualStudio.DiagnosticsWindow (1)
DiagnosticsWindow.cs (1)
71
Contract
.ThrowIfFalse(Workspace == null);
Roslyn.VisualStudio.Next.UnitTests (3)
Remote\SerializationValidator.cs (3)
83
Contract
.ThrowIfNull(data.Value);
97
Contract
.ThrowIfNull<object?>(result);
213
Contract
.ThrowIfFalse(solution.State.TryGetStateChecksums(out var solutionObjectFromSolution));