63 references to ThrowIfFalse
Microsoft.CodeAnalysis.CodeStyle (63)
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
59
Contract.
ThrowIfFalse
(option.Value is ForEachExplicitCastInSourcePreference.Always or ForEachExplicitCastInSourcePreference.WhenStronglyTyped);
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (1)
224
Contract.
ThrowIfFalse
(indices.All(idx => idx >= 0 && idx < additionalLocationsLength));
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
124
Contract.
ThrowIfFalse
(context.FilterSpan != symbolStartAnalyzer._symbolStartAnalysisContext.FilterSpan);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
486
Contract.
ThrowIfFalse
(TryGetSyntax(getterField, out var fieldDeclaration, out var variableDeclarator, cancellationToken));
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
230
Contract.
ThrowIfFalse
(this.SyntaxFacts.IsSimpleMemberAccessExpression(memberAccess));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
248
Contract.
ThrowIfFalse
(rightMaxEndValue > leftMaxEndValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
167
Contract.
ThrowIfFalse
(context.FilterSpan.HasValue);
179
Contract.
ThrowIfFalse
(context.FilterSpan.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalyzerConfigOptionsExtensions.cs (1)
23
Contract.
ThrowIfFalse
(option.Definition.IsEditorConfigOption);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
561
Contract.
ThrowIfFalse
(symbol.IsNormalAnonymousType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (4)
209
Contract.
ThrowIfFalse
(0 <= endPosition && endPosition <= line.Length);
210
Contract.
ThrowIfFalse
(tabSize > 0);
218
Contract.
ThrowIfFalse
(column >= 0);
219
Contract.
ThrowIfFalse
(tabSize > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
299
Contract.
ThrowIfFalse
(nodes.Any());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (1)
414
Contract.
ThrowIfFalse
(intervals.Length == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (5)
52
Contract.
ThrowIfFalse
(triviaInfo.LineBreaks == 0);
85
Contract.
ThrowIfFalse
(triviaInfo.LineBreaks == 0);
123
Contract.
ThrowIfFalse
(triviaInfo.LineBreaks == 0);
451
Contract.
ThrowIfFalse
(triviaInfo.SecondTokenIsFirstTokenOnLine);
478
Contract.
ThrowIfFalse
(baseToken.RawKind != 0 && startToken.RawKind != 0 && endToken.RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.AbstractComplexTrivia.cs (1)
76
Contract.
ThrowIfFalse
(line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.cs (3)
92
Contract.
ThrowIfFalse
(space >= 0);
111
Contract.
ThrowIfFalse
(lineBreaks >= 0);
112
Contract.
ThrowIfFalse
(indentation >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (2)
27
Contract.
ThrowIfFalse
(space >= 0);
57
Contract.
ThrowIfFalse
(line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (2)
31
Contract.
ThrowIfFalse
((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount));
64
Contract.
ThrowIfFalse
(this.TokenStream == other.TokenStream);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenPairWithOperations.cs (1)
30
Contract.
ThrowIfFalse
(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (6)
138
Contract.
ThrowIfFalse
(0 <= index && index < this.TokenCount);
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);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Debug.cs (1)
19
Contract.
ThrowIfFalse
(text == _debugNodeData.GetTextBetween(token1, token2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
18
Contract.
ThrowIfFalse
(root.GetFirstToken(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.StructuredTrivia.cs (1)
22
Contract.
ThrowIfFalse
(trivia.HasStructure);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
184
Contract.
ThrowIfFalse
(lines.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AdjustNewLinesOperation.cs (3)
16
Contract.
ThrowIfFalse
(option != AdjustNewLinesOption.ForceLines || line > 0);
17
Contract.
ThrowIfFalse
(option != AdjustNewLinesOption.PreserveLines || line >= 0);
18
Contract.
ThrowIfFalse
(option != AdjustNewLinesOption.ForceLinesIfOnSingleLine || line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AdjustSpacesOperation.cs (1)
16
Contract.
ThrowIfFalse
(space >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (4)
17
Contract.
ThrowIfFalse
(option.IsMaskOn(IndentBlockOption.PositionMask));
36
Contract.
ThrowIfFalse
(option.IsMaskOn(IndentBlockOption.PositionMask));
38
Contract.
ThrowIfFalse
(option.IsMaskOn(IndentBlockOption.RelativePositionMask));
39
Contract.
ThrowIfFalse
(baseToken.Span.End <= textSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
76
Contract.
ThrowIfFalse
(lineBreaks >= 0);
77
Contract.
ThrowIfFalse
(spaces >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
66
Contract.
ThrowIfFalse
(locations.All(loc => loc.IsInSource));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (2)
418
Contract.
ThrowIfFalse
(Equals(method, _methodSymbolStack[^1]));
434
Contract.
ThrowIfFalse
(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
525
Contract.
ThrowIfFalse
(method.Equals(_methodSymbolStack[^1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
15
Contract.
ThrowIfFalse
(symbol.TypeParameterKind == TypeParameterKind.Method);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
152
Contract.
ThrowIfFalse
(Monitor.IsEntered(asyncLazy.SyncObject));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (4)
49
Contract.
ThrowIfFalse
(spans.Count > 0);
124
Contract.
ThrowIfFalse
(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart);
286
Contract.
ThrowIfFalse
(backwardPosition < parentNode.FullSpan.End);
312
Contract.
ThrowIfFalse
(parentNode.FullSpan.Start < forwardPosition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
172
=> Contract.
ThrowIfFalse
(LockHeldByMe());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (2)
116
Contract.
ThrowIfFalse
(task.IsCompleted);
132
Contract.
ThrowIfFalse
(task.IsCompleted);