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