43 references to ThrowIfTrue
Microsoft.CodeAnalysis.CSharp.Features (1)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (1)
141Contract.ThrowIfTrue(
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
80Contract.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)
41Contract.ThrowIfTrue(positions.IsEmpty && spans.IsEmpty, "Expected at least one test position"); 42Contract.ThrowIfTrue(!positions.IsEmpty && !spans.IsEmpty, "Cannot test positions and spans at the same time");
Completion\AbstractArgumentProviderTests`1.cs (2)
102Contract.ThrowIfTrue(arguments.Any(argument => syntaxFacts.IsNamedArgument(argument)), "Named arguments are not currently supported by this test."); 103Contract.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)
29Contract.ThrowIfTrue(checksum == Checksum.Null && solution is null, "Either a Checksum or a Solution must be provided."); 30Contract.ThrowIfTrue(checksum != Checksum.Null && solution is not null, "Only one of Checksum or Solution can be provided.");
Microsoft.CodeAnalysis.Features (7)
Copilot\ICopilotChangeAnalysisService.cs (2)
59Contract.ThrowIfTrue(!changes.IsSorted(static (c1, c2) => c1.Span.Start - c2.Span.Start), "'changes' was not sorted."); 60Contract.ThrowIfTrue(new NormalizedTextSpanCollection(changes.Select(c => c.Span)).Count != changes.Length, "'changes' was not normalized.");
ExtractMethod\MethodExtractor.Analyzer.cs (2)
500Contract.ThrowIfTrue(bestEffort, "Should never fail if bestEffort is true"); 612Contract.ThrowIfTrue(bestEffort, "Should never fail if bestEffort is true");
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.SymbolItem.cs (3)
83Contract.ThrowIfTrue(inDocumentInfo == null && otherDocumentInfo == null, "Both locations were null"); 84Contract.ThrowIfTrue(inDocumentInfo != null && otherDocumentInfo != null, "Both locations were not null"); 88Contract.ThrowIfTrue(inDocumentInfo.Value.spans.IsEmpty, "If location is in document, it must have non-empty spans");
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\Rename\RenameHandler.cs (1)
73Contract.ThrowIfTrue(!includeSourceGenerated && !renamedSolution.CompilationState.FrozenSourceGeneratedDocumentStates.IsEmpty, "Renaming in generated documents is not allowed, but there are changes in source generated documents.");
Microsoft.CodeAnalysis.Workspaces (25)
FindSymbols\Declarations\DeclarationFinder.cs (2)
28Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API"); 78Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
28Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
FindSymbols\IStreamingFindReferencesProgress.cs (1)
35Contract.ThrowIfTrue(symbols.IsDefaultOrEmpty, "Symbols should be non empty");
FindSymbols\SymbolTree\SymbolTreeInfo.cs (3)
124Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API"); 136Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API"); 148Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
136Contract.ThrowIfTrue(info.Checksum != checksum, "How could the info stored for a particular PEReference now have a different checksum?");
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (2)
181Contract.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum."); 203Contract.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (1)
62Contract.ThrowIfTrue(relatedDocuments.Length == 1, "We should have skipped non-linked files in the prior loop.");
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
157Contract.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)
140Contract.ThrowIfTrue(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
55Contract.ThrowIfTrue(nodes.IsDefault, $"{nameof(nodes)}.{nameof(nodes.IsDefault)}"); 56Contract.ThrowIfTrue(edges.IsDefault, $"{nameof(edges)}.{nameof(edges.IsDefault)}"); 69Contract.ThrowIfTrue(_nodes.IsDefault, $"{nameof(_nodes)}.{nameof(_nodes.IsDefault)}"); 70Contract.ThrowIfTrue(_edges.IsDefault, $"{nameof(_edges)}.{nameof(_edges.IsDefault)}");
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
790Contract.ThrowIfTrue(analyzersRemoved.Count == 0 && analyzersAdded.Count == 0, "Should only be called when there is work to do");
Workspace\Solution\Solution.cs (1)
95Contract.ThrowIfTrue(this.WorkspaceKind == CodeAnalysis.WorkspaceKind.RemoteWorkspace, "Access .Workspace off of a RemoteWorkspace Solution is not supported.");
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (3)
205Contract.ThrowIfTrue(generatedDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!"); 212Contract.ThrowIfTrue(existingDocument.Identity != documentIdentity, "Identities must match!"); 213Contract.ThrowIfTrue(existingDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
Workspace\Solution\SolutionState.cs (2)
359Contract.ThrowIfTrue(projectInfos.HasDuplicates(static p => p.Id), "Duplicate ProjectId provided"); 464Contract.ThrowIfTrue(projectIds.HasDuplicates(), "Duplicate ProjectId provided");
Workspace\Solution\StateChecksums.cs (1)
290Contract.ThrowIfTrue(
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Workspaces\TestHostDocument.cs (1)
205Contract.ThrowIfTrue(IsSourceGenerated, "We shouldn't be producing a DocumentInfo for a source generated document.");
Workspaces\TestWorkspace_XmlCreation.cs (1)
39Contract.ThrowIfTrue(fileContainingFolders.Length != files.Length, "Please specify containing folder for each file.");