45 references to ThrowIfTrue
Microsoft.CodeAnalysis.CSharp.Features (1)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (1)
141
Contract.
ThrowIfTrue
(
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
80
Contract.
ThrowIfTrue
(sourceText == null && includePreviousTokenTrailingTriviaOnlyIfOnSameLine, "If we are including previous token trailing trivia, we need the text too.");
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
CompleteStatement\AbstractCompleteStatementTests.cs (2)
41
Contract.
ThrowIfTrue
(positions.IsEmpty && spans.IsEmpty, "Expected at least one test position");
42
Contract.
ThrowIfTrue
(!positions.IsEmpty && !spans.IsEmpty, "Cannot test positions and spans at the same time");
Completion\AbstractArgumentProviderTests`1.cs (2)
102
Contract.
ThrowIfTrue
(arguments.Any(argument => syntaxFacts.IsNamedArgument(argument)), "Named arguments are not currently supported by this test.");
103
Contract.
ThrowIfTrue
(parameters.Any(parameter => parameter.IsParams), "'params' parameters are not currently supported by this test.");
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (2)
Remote\RazorPinnedSolutionInfoWrapper.cs (2)
29
Contract.
ThrowIfTrue
(checksum == Checksum.Null && solution is null, "Either a Checksum or a Solution must be provided.");
30
Contract.
ThrowIfTrue
(checksum != Checksum.Null && solution is not null, "Only one of Checksum or Solution can be provided.");
Microsoft.CodeAnalysis.Features (7)
Copilot\CopilotUtilities.cs (2)
72
Contract.
ThrowIfTrue
(!textChanges.IsSorted(static (c1, c2) => c1.Span.Start - c2.Span.Start), "'changes' was not sorted.");
78
Contract.
ThrowIfTrue
(lastEdit.Span.OverlapsWith(currentEdit.Span), "'changes' contained overlapping edits.");
ExtractMethod\MethodExtractor.Analyzer.cs (2)
500
Contract.
ThrowIfTrue
(bestEffort, "Should never fail if bestEffort is true");
612
Contract.
ThrowIfTrue
(bestEffort, "Should never fail if bestEffort is true");
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.SymbolItem.cs (3)
83
Contract.
ThrowIfTrue
(inDocumentInfo == null && otherDocumentInfo == null, "Both locations were null");
84
Contract.
ThrowIfTrue
(inDocumentInfo != null && otherDocumentInfo != null, "Both locations were not null");
88
Contract.
ThrowIfTrue
(inDocumentInfo.Value.spans.IsEmpty, "If location is in document, it must have non-empty spans");
Microsoft.CodeAnalysis.Workspaces (27)
FindSymbols\Declarations\DeclarationFinder.cs (2)
28
Contract.
ThrowIfTrue
(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
78
Contract.
ThrowIfTrue
(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
28
Contract.
ThrowIfTrue
(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
FindSymbols\IStreamingFindReferencesProgress.cs (1)
35
Contract.
ThrowIfTrue
(symbols.IsDefaultOrEmpty, "Symbols should be non empty");
FindSymbols\SymbolTree\SymbolTreeInfo.cs (3)
124
Contract.
ThrowIfTrue
(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
136
Contract.
ThrowIfTrue
(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
148
Contract.
ThrowIfTrue
(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
136
Contract.
ThrowIfTrue
(info.Checksum != checksum, "How could the info stored for a particular PEReference now have a different checksum?");
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (2)
181
Contract.
ThrowIfTrue
(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
203
Contract.
ThrowIfTrue
(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (1)
62
Contract.
ThrowIfTrue
(relatedDocuments.Length == 1, "We should have skipped non-linked files in the prior loop.");
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
157
Contract.
ThrowIfTrue
(conflictLocations.Count != 0, "We're the first phase, so we should have no conflict locations yet");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
140
Contract.
ThrowIfTrue
(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
55
Contract.
ThrowIfTrue
(nodes.IsDefault, $"{nameof(nodes)}.{nameof(nodes.IsDefault)}");
56
Contract.
ThrowIfTrue
(edges.IsDefault, $"{nameof(edges)}.{nameof(edges.IsDefault)}");
69
Contract.
ThrowIfTrue
(_nodes.IsDefault, $"{nameof(_nodes)}.{nameof(_nodes.IsDefault)}");
70
Contract.
ThrowIfTrue
(_edges.IsDefault, $"{nameof(_edges)}.{nameof(_edges.IsDefault)}");
Workspace\IsolatedAnalyzerReferenceSet.Core.cs (2)
110
Contract.
ThrowIfTrue
(s_gate.CurrentCount != 0, "Lock must be held");
153
Contract.
ThrowIfTrue
(s_gate.CurrentCount != 0, "Lock must be held");
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
790
Contract.
ThrowIfTrue
(analyzersRemoved.Count == 0 && analyzersAdded.Count == 0, "Should only be called when there is work to do");
Workspace\Solution\Solution.cs (1)
94
Contract.
ThrowIfTrue
(this.WorkspaceKind == CodeAnalysis.WorkspaceKind.RemoteWorkspace, "Access .Workspace off of a RemoteWorkspace Solution is not supported.");
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (3)
234
Contract.
ThrowIfTrue
(generatedDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
241
Contract.
ThrowIfTrue
(existingDocument.Identity != documentIdentity, "Identities must match!");
242
Contract.
ThrowIfTrue
(existingDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
Workspace\Solution\SolutionState.cs (2)
372
Contract.
ThrowIfTrue
(projectInfos.HasDuplicates(static p => p.Id), "Duplicate ProjectId provided");
477
Contract.
ThrowIfTrue
(projectIds.HasDuplicates(), "Duplicate ProjectId provided");
Workspace\Solution\StateChecksums.cs (1)
290
Contract.
ThrowIfTrue
(
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Workspaces\TestHostDocument.cs (1)
205
Contract.
ThrowIfTrue
(IsSourceGenerated, "We shouldn't be producing a DocumentInfo for a source generated document.");
Workspaces\TestWorkspace_XmlCreation.cs (1)
39
Contract.
ThrowIfTrue
(fileContainingFolders.Length != files.Length, "Please specify containing folder for each file.");
Microsoft.VisualStudio.LanguageServices.Implementation (1)
CodeModel\AbstractCodeModelService.cs (1)
1083
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.");