88 references to Throws
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
SourceGeneration\AdditionalSourcesCollectionTests.cs (1)
183var exception = Assert.Throws<ArgumentException>("hintName", () => asc.CopyTo(asc2));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
Compilation\CompilationAPITests.cs (17)
2793Assert.Throws<ArgumentException>("name", () => 2797Assert.Throws<ArgumentException>("name", () => 2801Assert.Throws<ArgumentException>(null, () => 2805Assert.Throws<ArgumentException>(null, () => 2809Assert.Throws<ArgumentException>(null, () => 2818Assert.Throws<ArgumentNullException>("returnType", () => compilation.CreateBuiltinOperator( 2820Assert.Throws<ArgumentNullException>("leftType", () => compilation.CreateBuiltinOperator( 2822Assert.Throws<ArgumentNullException>("rightType", () => compilation.CreateBuiltinOperator( 2983Assert.Throws<ArgumentException>("name", () => 2987Assert.Throws<ArgumentException>(null, () => 2991Assert.Throws<ArgumentException>(null, () => 2995Assert.Throws<ArgumentException>("name", () => 2999Assert.Throws<ArgumentException>("name", () => 3003Assert.Throws<ArgumentException>("name", () => 3007Assert.Throws<ArgumentException>("name", () => 3016Assert.Throws<ArgumentNullException>("returnType", () => compilation.CreateBuiltinOperator( 3018Assert.Throws<ArgumentNullException>("operandType", () => compilation.CreateBuiltinOperator(
Microsoft.CodeAnalysis.Scripting.UnitTests (2)
ScriptOptionsTests.cs (2)
123Assert.Throws<ArgumentNullException>("imports[0]", () => options.AddImports([null])); 144Assert.Throws<ArgumentNullException>("imports[0]", () => options.WithImports([null]));
Microsoft.CodeAnalysis.UnitTests (33)
Analyzers\AnalyzerFileReferenceTests.cs (2)
47Assert.Throws<ArgumentNullException>("fullPath", () => new AnalyzerFileReference(null!, s_analyzerLoader)); 51Assert.Throws<ArgumentException>("fullPath", () => new AnalyzerFileReference("a.dll", s_analyzerLoader));
Collections\ImmutableSegmentedDictionaryTest.cs (2)
201Assert.Throws<ArgumentException>(null, () => map.WithComparer(StringComparer.OrdinalIgnoreCase)); 209var exception = Assert.Throws<ArgumentException>(null, () => map.Add("firstKey", "3"));
Collections\ImmutableSegmentedListTest.cs (12)
296Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(1, nonEmptyList)); 297Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, nonEmptyList)); 305Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(106, nonEmptyList)); 306Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, nonEmptyList)); 621Assert.Throws<ArgumentOutOfRangeException>("index", () => list.RemoveRange(-1, 0)); 622Assert.Throws<ArgumentOutOfRangeException>("count", () => list.RemoveRange(0, -1)); 642Assert.Throws<ArgumentNullException>("items", () => list.RemoveRange(null!)); 725Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[-1]); 726Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[0]); 727Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[1]); 730Assert.Throws<ArgumentOutOfRangeException>("index", () => listOfOne[-1]); 732Assert.Throws<ArgumentOutOfRangeException>("index", () => listOfOne[1]);
Collections\List\SegmentedList.Generic.Tests.BinarySearch.cs (2)
69Assert.Throws<ArgumentException>(null, () => list.BinarySearch(0, count + 1, element, GetIComparer())); //"Finding items longer than array should throw ArgumentException" 72Assert.Throws<ArgumentException>(null, () => list.BinarySearch(count + 1, count, element, GetIComparer())); //"ArgumentException should be thrown on index greater than length of array."
Collections\List\SegmentedList.Generic.Tests.cs (2)
73Assert.Throws<ArgumentException>(null, () => list.CopyTo(0, new T[0], 0, count + 1)); 74Assert.Throws<ArgumentException>(null, () => list.CopyTo(count, new T[0], 0, 1));
Collections\List\SegmentedList.Generic.Tests.Reverse.cs (1)
139Assert.Throws<ArgumentException>(null, () => list.Reverse(invalidSet.Item1, invalidSet.Item2));
Collections\List\SegmentedList.Generic.Tests.Sort.cs (1)
200Assert.Throws<ArgumentException>(null, () => list.Sort(invalidSet.Item1, invalidSet.Item2, GetIComparer()));
Emit\SemanticEditTests.cs (11)
31Assert.Throws<ArgumentNullException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: null, newSymbol: type)); 32Assert.Throws<ArgumentNullException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Delete, oldSymbol: null, newSymbol: type)); 34Assert.Throws<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: type, newSymbol: null)); 35Assert.Throws<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Insert, oldSymbol: type, newSymbol: null)); 36Assert.Throws<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Replace, oldSymbol: type, newSymbol: null)); 39Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Replace, oldSymbol: method, newSymbol: method, instrumentation: instrumentation)); 40Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Insert, oldSymbol: method, newSymbol: method, instrumentation: instrumentation)); 41Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Delete, oldSymbol: method, newSymbol: method, instrumentation: instrumentation)); 43Assert.Throws<ArgumentException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: type, newSymbol: method, instrumentation: instrumentation)); 44Assert.Throws<ArgumentException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: method, newSymbol: type, instrumentation: instrumentation)); 49Assert.Throws<ArgumentOutOfRangeException>("Kinds", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: method, newSymbol: method,
Microsoft.CodeAnalysis.Workspaces.UnitTests (25)
Simplifier\SimplifierTests.cs (3)
51Assert.Throws<ArgumentNullException>("services", () => Simplifier.Expand(node, semanticModel, services: null!)); 52Assert.Throws<ArgumentNullException>("workspace", () => Simplifier.Expand(node, semanticModel, workspace: null!)); 54Assert.Throws<ArgumentNullException>("workspace", () => Simplifier.Expand(token: default, semanticModel, workspace: null!));
SolutionTests\ProjectInfoTests.cs (6)
40Assert.Throws<ArgumentException>("documents[1]", 46Assert.Throws<ArgumentException>("additionalDocuments[1]", 53Assert.Throws<ArgumentException>("projectReferences[1]", 56Assert.Throws<ArgumentNullException>("analyzerReferences[0]", () => ProjectInfo.Create(pid, VersionStamp.Default, name: "Goo", assemblyName: "Bar", language: "C#", 60Assert.Throws<ArgumentException>("analyzerReferences[1]", 67Assert.Throws<ArgumentException>("metadataReferences[1]",
SolutionTests\SolutionTests.cs (16)
1934Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectReferences(null!, [projectRef])); 1986Assert.Throws<ArgumentNullException>("projectId", () => solution.AddProjectReferences(null!, [projectRef2])); 1988Assert.Throws<ArgumentNullException>("projectReferences[0]", () => solution.AddProjectReferences(projectId, [null!])); 1989Assert.Throws<ArgumentException>("projectReferences[1]", () => solution.AddProjectReferences(projectId, [projectRef2, projectRef2])); 1990Assert.Throws<ArgumentException>("projectReferences[1]", () => solution.AddProjectReferences(projectId, [new ProjectReference(projectId2), new ProjectReference(projectId2)])); 2085Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectMetadataReferences(null!, [metadataRef])); 2105Assert.Throws<ArgumentNullException>("projectId", () => solution.AddMetadataReferences(null!, [metadataRef1])); 2107Assert.Throws<ArgumentNullException>("metadataReferences[0]", () => solution.AddMetadataReferences(projectId, [null!])); 2108Assert.Throws<ArgumentException>("metadataReferences[1]", () => solution.AddMetadataReferences(projectId, [metadataRef1, metadataRef1])); 2155Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectAnalyzerReferences(null!, [analyzerRef])); 2178Assert.Throws<ArgumentNullException>("projectId", () => solution.AddAnalyzerReferences(null!, [analyzerRef1])); 2180Assert.Throws<ArgumentNullException>("analyzerReferences[0]", () => solution.AddAnalyzerReferences(projectId, [null!])); 2181Assert.Throws<ArgumentException>("analyzerReferences[1]", () => solution.AddAnalyzerReferences(projectId, [analyzerRef1, analyzerRef1])); 2204Assert.Throws<ArgumentNullException>("projectId", () => solution.RemoveAnalyzerReference(null!, analyzerRef1)); 2375Assert.Throws<ArgumentNullException>("documentId", () => solution.AddDocument(documentId: null!, "name", loader)); 2376Assert.Throws<ArgumentNullException>("name", () => solution.AddDocument(documentId, name: null!, loader));
System.Windows.Forms.Tests (10)
System\Windows\Forms\ColumnHeaderCollectionTests.cs (1)
426Assert.Throws<ArgumentNullException>("values", () => collection.AddRange([null]));
System\Windows\Forms\ImageList.ImageCollectionTests.cs (1)
874Assert.Throws<ArgumentNullException>("value", () => collection.AddRange([null]));
System\Windows\Forms\ListBox.ObjectCollectionTests.cs (1)
3657Assert.Throws<ArgumentNullException>("item", () => collection.AddRange((object[])[null]));
System\Windows\Forms\ListViewGroupCollectionTests.cs (1)
588Assert.Throws<ArgumentNullException>("group", () => collection.AddRange((ListViewGroup[])[group, null]));
System\Windows\Forms\MessageBoxTests.cs (3)
15Assert.Throws<InvalidEnumArgumentException>( 58Assert.Throws<InvalidEnumArgumentException>( 100Assert.Throws<InvalidEnumArgumentException>(
System\Windows\Forms\ToolStripTests.cs (1)
332Assert.Throws<ArgumentNullException>("value", () => new ToolStrip([null]));
System\Windows\Forms\TreeNodeTests.cs (2)
241Assert.Throws<ArgumentNullException>("node", () => new TreeNode("text", [null])); 242Assert.Throws<ArgumentNullException>("node", () => new TreeNode("text", 0, 0, [null]));