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