85 instantiations of NullReferenceException
dotnet-svcutil-lib (2)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReader.cs (2)
1207throw new NullReferenceException(); 1217throw new NullReferenceException();
ErrorPageMiddlewareWebSite (1)
AggregateExceptionController.cs (1)
22throw new NullReferenceException("Foo cannot be null");
InMemory.FunctionalTests (1)
Http3\WebTransport\WebTransportTestUtilities.cs (1)
130throw new NullReferenceException();
Metrics (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Metrics.Legacy (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Microsoft.Build.Tasks.Core (1)
SystemState.cs (1)
263throw new NullReferenceException(nameof(instanceLocalFileStateCache));
Microsoft.CodeAnalysis (2)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.CodeAnalysis.Analyzers (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Microsoft.CodeAnalysis.BannedApiAnalyzers (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Microsoft.CodeAnalysis.CodeStyle (2)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.CodeAnalysis.Collections.Package (2)
Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (1)
758throw outOfMemory ? new OutOfMemoryException() : new NullReferenceException("NullRef!");
SemanticSearch\CSharpSemanticSearchServiceTests.cs (1)
429var expectedMessage = new NullReferenceException().Message;
Microsoft.CodeAnalysis.EditorFeatures (6)
Lightup\LightupHelpers.cs (6)
514throw new NullReferenceException(); 531throw new NullReferenceException(); 546throw new NullReferenceException(); 561throw new NullReferenceException(); 578throw new NullReferenceException(); 595throw new NullReferenceException();
Microsoft.CodeAnalysis.InteractiveHost (2)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Microsoft.CodeAnalysis.ResxSourceGenerator (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Microsoft.CodeAnalysis.Threading.Package (2)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.CodeAnalysis.Workspaces (2)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (2)
1271throw new NullReferenceException(); 1276throw new NullReferenceException();
Microsoft.Extensions.AI.Abstractions.Tests (1)
Contents\FunctionCallContentTests..cs (1)
80var ex = new InvalidOperationException("hello", new NullReferenceException("bye"));
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ActivatorUtilities.cs (1)
1154throw new NullReferenceException();
Microsoft.Maui (1)
SemanticExtensions.cs (1)
27 throw new NullReferenceException("Can't access view from a null handler");
Microsoft.VisualBasic.Core (5)
Microsoft\VisualBasic\CompilerServices\ExceptionUtils.vb (1)
280Return New NullReferenceException(Description)
Microsoft\VisualBasic\CompilerServices\VB6BinaryFile.vb (1)
196Dim JustNeedTheMessage As New NullReferenceException ' We don't have access to the localized resources for this string.
Microsoft\VisualBasic\CompilerServices\VB6File.vb (3)
1359Throw New NullReferenceException 1664Throw New NullReferenceException 2713Dim JustNeedTheMessage As New NullReferenceException ' We don't have access to the localized resources for this string.
PresentationCore (3)
System\Windows\Media\ColorContext.cs (1)
215throw new NullReferenceException();
System\Windows\Media\ImageSourceConverter.cs (1)
146throw new NullReferenceException();
System\Windows\Media\VisualTreeHelper.cs (1)
106throw new NullReferenceException("dpiInfo cannot be null");
PresentationFramework (3)
MS\Internal\IO\Packaging\XpsFilter.cs (1)
111throw new NullReferenceException(SR.FilterNullGetTextBufferPointer);
System\Windows\Controls\Primitives\Popup.cs (2)
1868Exception nre = new NullReferenceException(); 1869throw new NullReferenceException(nre.Message, SavedException);
PresentationUI (1)
MS\Internal\Documents\RightsManagementProvider.cs (1)
749throw new NullReferenceException("template");
ReachFramework (2)
Packaging\XpsDocument.cs (2)
473throw new NullReferenceException("signature.PackageSignature"); 477throw new NullReferenceException("signature.PackageSignature.SignaturePart");
Roslyn.Diagnostics.Analyzers (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
System.Linq.Expressions (1)
System\Linq\Expressions\Interpreter\TypeOperations.cs (1)
349throw new NullReferenceException();
System.Private.CoreLib (6)
src\coreclr\nativeaot\Runtime.Base\src\System\Runtime\ExceptionHandling.cs (1)
326ExceptionIDs.NullReference => new NullReferenceException(),
src\libraries\System.Private.CoreLib\src\Internal\Runtime\CompilerHelpers\ThrowHelpers.cs (1)
18throw new NullReferenceException();
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokerEmitUtil.cs (1)
318throw new NullReferenceException(SR.NullReference_InvokeNullRefReturned);
src\libraries\System.Private.CoreLib\src\System\ThrowHelper.cs (1)
416throw new NullReferenceException(SR.Arg_NullArgumentNullRef);
src\System\RuntimeHandles.cs (2)
1708throw new NullReferenceException(); 1721throw new NullReferenceException();
System.Reflection.MetadataLoadContext (1)
System\Reflection\TypeLoading\General\Assignability.cs (1)
14throw new NullReferenceException();
System.Security.Cryptography.Pkcs (1)
System\Security\Cryptography\Pkcs\CmsRecipientCollection.cs (1)
28throw new NullReferenceException(); //Desktop compat: this is the wrong exception to throw but it is the compatible one.
System.Windows.Forms.Tests (2)
System\Windows\Forms\BindingTests.cs (2)
377yield return new object[] { null, new NullReferenceException() }; 378yield return new object[] { new BindingCompleteEventArgs(null, BindingCompleteState.Success, BindingCompleteContext.ControlUpdate), new NullReferenceException() };
Test.Utilities (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
Text.Analyzers (3)
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (3)
87throw new NullReferenceException(); 141throw new NullReferenceException(); 187throw new NullReferenceException();
463 references to NullReferenceException
Analyzer.Utilities.UnitTests (5)
Lightup\LightupHelpersTests.cs (5)
32Assert.Throws<NullReferenceException>(() => propertyAccessor(null!)); 38Assert.Throws<NullReferenceException>(() => withPropertyAccessor(null!, new object())); 51Assert.Throws<NullReferenceException>(() => propertyAccessor(null!)); 57Assert.Throws<NullReferenceException>(() => withPropertyAccessor(null!, new object())); 70Assert.Throws<NullReferenceException>(() => accessor(null!, 0));
dotnet-svcutil-lib (7)
FrameworkFork\Microsoft.Xml\Xml\XmlException.cs (1)
270e is NullReferenceException
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSSecurityPolicy.cs (4)
1943if (e is NullReferenceException) 2361if (e is NullReferenceException) 2888if (e is NullReferenceException) 2907if (e is NullReferenceException)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSSecurityPolicy11.cs (1)
93if (e is NullReferenceException)
Shared\Utilities\Utilities.cs (1)
14return ex != null && (ex is NullReferenceException || ex is ArgumentNullException);
Microsoft.AspNetCore.Http.Abstractions.Tests (2)
EndpointFilterInvocationContextOfTTests.cs (2)
80Assert.Throws<NullReferenceException>(() => context.GetArgument<int>(1)); 81Assert.Throws<NullReferenceException>(() => context.GetArgument<bool>(2));
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\CompileTimeCreationTests.cs (1)
475_ = await Assert.ThrowsAsync<NullReferenceException>(async () => await endpoint.RequestDelegate(httpContext));
Microsoft.AspNetCore.Mvc.Core.Test (4)
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (1)
729Assert.IsType<NullReferenceException>(modelError.Exception);
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (1)
873Assert.IsType<NullReferenceException>(modelError.Exception);
ModelBinding\Validation\DefaultComplexObjectValidationStrategyTest.cs (2)
150Assert.Throws<NullReferenceException>(() => entry.Model); 156Assert.Throws<NullReferenceException>(() => entry.Model);
Microsoft.AspNetCore.Mvc.IntegrationTests (6)
ValidationIntegrationTests.cs (3)
1489Assert.Throws<NullReferenceException>(() => model.ValidateNeverLength); 1596Assert.Throws<NullReferenceException>(() => model.ControlLength); 1686Assert.Throws<NullReferenceException>(() => model.ControlLength);
ValidationWithRecordIntegrationTests.cs (3)
1333Assert.Throws<NullReferenceException>(() => model.ValidateNeverLength); 1404Assert.Throws<NullReferenceException>(() => model.ControlLength); 1492Assert.Throws<NullReferenceException>(() => model.ControlLength);
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
ExpressionMetadataProvider.cs (1)
89catch (NullReferenceException)
Microsoft.AspNetCore.Shared.Tests (2)
PropertyHelperTest.cs (2)
496Assert.Throws<NullReferenceException>(() => accessor(null)); 510Assert.Throws<NullReferenceException>(() => accessor(null));
Microsoft.Build.Engine.UnitTests (1)
BackEnd\BuildResult_Tests.cs (1)
61Assert.Throws<NullReferenceException>(() =>
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenThrowTests.cs (1)
74var compilation = CompileAndVerifyException<NullReferenceException>(source);
Microsoft.CodeAnalysis.CSharp.Features (2)
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (2)
159var exception = hasUsingSystem ? nameof(NullReferenceException) : $"{nameof(System)}.{nameof(NullReferenceException)}";
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (1)
102catch (NullReferenceException)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Compilation\CompilationAPITests.cs (2)
1324Assert.Throws<NullReferenceException>( 1330Assert.Throws<NullReferenceException>(
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
LexicalAndXml\SyntaxTokenParserTests.cs (1)
22Assert.Throws<NullReferenceException>(() => parser.ParseNextToken());
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
TestExtensionErrorHandler.cs (2)
31if (exception is NullReferenceException && 38if (exception is NullReferenceException &&
Microsoft.CodeAnalysis.Features (1)
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
323catch (NullReferenceException e) when (FatalError.ReportAndCatch(e))
Microsoft.CodeAnalysis.Scripting (1)
Hosting\AssemblyLoader\MetadataShadowCopyProvider.cs (1)
380/// <exception cref="NullReferenceException"><paramref name="fullPath"/> is null.</exception>
Microsoft.CodeAnalysis.UnitTests (29)
Collections\ImmutableArrayExtensionsTests.cs (5)
57Assert.Throws<NullReferenceException>(() => nullOrEmpty.IsEmpty); 143Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single()); 150Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single(isOdd)); 159Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single((_, _) => true, 1)); 164Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single((x, a) => x % a == 1, 2));
Collections\SegmentedArrayTests.cs (17)
52Assert.Throws<NullReferenceException>(() => data[0]); 53Assert.Throws<NullReferenceException>(() => ((IReadOnlyList<IntPtr>)data)[0]); 54Assert.Throws<NullReferenceException>(() => ((IList<IntPtr>)data)[0]); 55Assert.Throws<NullReferenceException>(() => ((IList<IntPtr>)data)[0] = IntPtr.Zero); 56Assert.Throws<NullReferenceException>(() => ((IList)data)[0]); 57Assert.Throws<NullReferenceException>(() => ((IList)data)[0] = IntPtr.Zero); 63Assert.Throws<NullReferenceException>(() => data.Clone()); 64Assert.Throws<NullReferenceException>(() => data.CopyTo(Array.Empty<IntPtr>(), 0)); 65Assert.Throws<NullReferenceException>(() => ((ICollection<IntPtr>)data).CopyTo(Array.Empty<IntPtr>(), 0)); 68Assert.Throws<NullReferenceException>(() => enumerator1.MoveNext()); 71Assert.Throws<NullReferenceException>(() => enumerator1.MoveNext()); 74Assert.Throws<NullReferenceException>(() => enumerator1.MoveNext()); 86Assert.Throws<NullReferenceException>(() => ((IList)data).Clear()); 87Assert.Throws<NullReferenceException>(() => ((IList)data).Contains(IntPtr.Zero)); 88Assert.Throws<NullReferenceException>(() => ((ICollection<IntPtr>)data).Contains(IntPtr.Zero)); 89Assert.Throws<NullReferenceException>(() => ((IList)data).IndexOf(IntPtr.Zero)); 90Assert.Throws<NullReferenceException>(() => ((IList<IntPtr>)data).IndexOf(IntPtr.Zero));
Collections\SegmentedCollectionsMarshalTests.cs (6)
68Assert.Throws<NullReferenceException>(() => SegmentedCollectionsMarshal.GetValueRefOrNullRef(dict, 3).Value = 9); 124Assert.Throws<NullReferenceException>(() => SegmentedCollectionsMarshal.GetValueRefOrNullRef(dict, 3).Value = 9); 203Assert.Throws<NullReferenceException>(() => SegmentedCollectionsMarshal.GetValueRefOrNullRef(dict, 3).Value); 250Assert.Throws<NullReferenceException>(() => SegmentedCollectionsMarshal.GetValueRefOrNullRef(dict, 3).Value = 9); 304Assert.Throws<NullReferenceException>(() => SegmentedCollectionsMarshal.GetValueRefOrNullRef(dict, 3).Value = 9); 358Assert.Throws<NullReferenceException>(() => SegmentedCollectionsMarshal.GetValueRefOrNullRef(dict, 3).Value = 9);
Collections\TestExtensionsMethods.cs (1)
20Assert.Throws<NullReferenceException>(a);
Microsoft.Maui.Controls (1)
TypedBinding.cs (1)
316 catch (Exception ex) when (ex is NullReferenceException || ex is KeyNotFoundException || ex is IndexOutOfRangeException || ex is ArgumentOutOfRangeException)
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\MyServices\Internal\ContextValueTests.cs (1)
12Assert.Throws<NullReferenceException>(() => (new ContextValue<int>()).Value);
Microsoft.VisualStudio.LanguageServices (1)
DocumentOutline\VirtualizingTreeView.cs (1)
42catch (NullReferenceException)
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
377[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.NullReferenceException))]
netstandard (1)
netstandard.cs (1)
1330[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.NullReferenceException))]
PresentationBuildTasks (9)
Microsoft\Build\Tasks\Windows\FileClassifier.cs (1)
100if (e is NullReferenceException || e is SEHException)
Microsoft\Build\Tasks\Windows\MergeLocalizationDirectives.cs (1)
88if (e is NullReferenceException || e is SEHException)
Microsoft\Build\Tasks\Windows\ResourcesGenerator.cs (1)
199if (e is NullReferenceException || e is SEHException)
Microsoft\Build\Tasks\Windows\UidManager.cs (4)
95if (e is NullReferenceException || e is SEHException) 393if (e is NullReferenceException || e is SEHException) 990if (e is NullReferenceException || e is SEHException) 1029if (e is NullReferenceException || e is SEHException)
Microsoft\Build\Tasks\Windows\UpdateManifestForBrowserApplication.cs (1)
127if (e is NullReferenceException || e is SEHException)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\CriticalExceptions.cs (1)
23return ex is NullReferenceException ||
PresentationCore (1)
MS\Internal\Ink\InkSerializedFormat\InkSerializer.cs (1)
145catch (NullReferenceException ex)
PresentationFramework (1)
System\Windows\Shell\JumpList.cs (1)
774if (e is NullReferenceException || e is System.Runtime.InteropServices.SEHException)
System.ComponentModel.Composition (3)
System\ComponentModel\Composition\MetadataViewGenerator.cs (2)
283proxyCtorIL.BeginCatchBlock(typeof(NullReferenceException)); 338proxyCtorIL.BeginCatchBlock(typeof(NullReferenceException));
System\ComponentModel\Composition\MetadataViewProvider.cs (1)
111else if (ex.InnerException.GetType() == typeof(NullReferenceException))
System.Data.Common (2)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (1)
236private static readonly Type s_nullReferenceType = typeof(NullReferenceException);
System\Data\DataSetUtil.cs (1)
94(e.GetType() != typeof(NullReferenceException)) &&
System.Data.Odbc (1)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (1)
236private static readonly Type s_nullReferenceType = typeof(NullReferenceException);
System.Drawing.Common.Tests (48)
mono\System.Drawing\GraphicsTests.cs (1)
1135Assert.Throws<NullReferenceException>(() => g.Restore(null));
System\Drawing\BitmapTests.cs (3)
97AssertExtensions.Throws<ArgumentNullException, NullReferenceException>("type", () => new Bitmap(null, "name")); 314Assert.Throws<NullReferenceException>(() => new Bitmap((Image)null)); 1447Assert.Throws<NullReferenceException>(() => bitmap.Palette = null);
System\Drawing\Drawing2D\LinearGradientBrushTests.cs (2)
419Assert.Throws<NullReferenceException>(() => brush.InterpolationColors = new ColorBlend { Colors = null }); 543Assert.Throws<NullReferenceException>(() => brush.LinearColors = null);
System\Drawing\Drawing2D\PathGradientBrushTests.cs (2)
582Assert.Throws<NullReferenceException>(() => 585Assert.Throws<NullReferenceException>(() =>
System\Drawing\FontTests.cs (1)
308Assert.Throws<NullReferenceException>(() => new Font(null, FontStyle.Regular));
System\Drawing\GraphicsTests.cs (1)
1092Assert.Throws<NullReferenceException>(() => graphics.Transform = null);
System\Drawing\IconTests.cs (1)
260Assert.Throws<NullReferenceException>(() => new Icon(null, "48x48_multiple_entries_4bit.ico"));
System\Drawing\Imaging\ColorMatrixTests.cs (1)
71yield return new object[] { null, typeof(NullReferenceException) };
System\Drawing\Imaging\EncoderParameterTests.cs (24)
216[InlineData(null, new int[] { 1 }, new int[] { 1 }, new int[] { 1 }, typeof(NullReferenceException))] 217[InlineData(new int[] { 1 }, null, new int[] { 1 }, new int[] { 1 }, typeof(NullReferenceException))] 218[InlineData(new int[] { 1 }, new int[] { 1 }, null, new int[] { 1 }, typeof(NullReferenceException))] 219[InlineData(new int[] { 1 }, new int[] { 1 }, new int[] { 1 }, null, typeof(NullReferenceException))] 229Assert.Throws<NullReferenceException>(() => ep.Encoder = null); 235[InlineData(new int[] { 0, 1 }, null, typeof(NullReferenceException))] 236[InlineData(null, new int[] { 0, 1 }, typeof(NullReferenceException))] 245[InlineData(new long[] { 0, 1 }, null, typeof(NullReferenceException))] 246[InlineData(null, new long[] { 0, 1 }, typeof(NullReferenceException))] 255Assert.Throws<NullReferenceException>(() => new EncoderParameter(s_anyEncoder, (string)null)); 261Assert.Throws<NullReferenceException>(() => new EncoderParameter(s_anyEncoder, (byte[])null)); 287Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0)); 288Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0, false)); 289Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, (short)0)); 290Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, numerator: 0, denominator: 0)); 291Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, rangebegin: 0, rangeend: 0)); 292Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0, 0, 0, 0)); 293Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, "anyString")); 294Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<byte>())); 295Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, [], false)); 296Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<short>())); 297Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<long>())); 298Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<int>(), [])); 299Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<long>(), []));
System\Drawing\Imaging\ImageAttributesTests.cs (2)
1235Assert.Throws<NullReferenceException>(() => imageAttr.SetRemapTable([null], ColorAdjustType.Default)); 1315Assert.Throws<NullReferenceException>(() => imageAttr.GetAdjustedPalette(null, ColorAdjustType.Default));
System\Drawing\Printing\PreviewPrintControllerTests.cs (5)
37Assert.Throws<NullReferenceException>(() => controller.OnStartPage(null, e)); 45Assert.Throws<NullReferenceException>(() => controller.OnStartPage(document, null)); 56Assert.Throws<NullReferenceException>(() => controller.OnStartPage(document, printEventArgs)); 65Assert.Throws<NullReferenceException>(() => controller.OnStartPage(document, e)); 111Assert.Throws<NullReferenceException>(() => controller.OnStartPrint(null, new PrintEventArgs()));
System\Drawing\Printing\PrintControllerTests.cs (1)
85Assert.Throws<NullReferenceException>(() => controller.OnStartPrint(null, new PrintEventArgs()));
System\Drawing\Printing\PrinterSettingsTests.cs (3)
503Assert.Throws<NullReferenceException>(() => printerSettings.CreateMeasurementGraphics(null)); 504Assert.Throws<NullReferenceException>(() => printerSettings.CreateMeasurementGraphics(null, true)); 528Assert.Throws<NullReferenceException>(() => printerSettings.GetHdevmode(null));
System\Drawing\RegionTests.cs (1)
160Assert.Throws<NullReferenceException>(() => new Region(regionData));
System.Private.CoreLib (114)
src\libraries\System.Private.CoreLib\src\System\Lazy.cs (1)
439/// <exception cref="NullReferenceException">
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector_1.cs (2)
49/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception> 68/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (2)
967/// <exception cref="NullReferenceException"><paramref name="array" /> is <see langword="null" />.</exception> 987/// <exception cref="NullReferenceException"><paramref name="array" /> is <see langword="null" />.</exception>
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (2)
977/// <exception cref="NullReferenceException"><paramref name="array" /> is <see langword="null" />.</exception> 997/// <exception cref="NullReferenceException"><paramref name="array" /> is <see langword="null" />.</exception>
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector4.cs (2)
1059/// <exception cref="NullReferenceException"><paramref name="array" /> is <see langword="null" />.</exception> 1068/// <exception cref="NullReferenceException"><paramref name="array" /> is <see langword="null" />.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\TaskAwaiter.cs (15)
38/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 62/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 172/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 304/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 310/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 320/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 329/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 402/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 408/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 418/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 426/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 484/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 490/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 500/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception> 509/// <exception cref="NullReferenceException">The awaiter was not properly initialized.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\CollectionsMarshal.cs (1)
108/// <exception cref="NullReferenceException">
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandle.T.cs (1)
44/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandleExtensions.cs (2)
24/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception> 47/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (8)
294catch (NullReferenceException) 318catch (NullReferenceException) 342catch (NullReferenceException) 389catch (NullReferenceException) 405catch (NullReferenceException) 429catch (NullReferenceException) 462catch (NullReferenceException) 513catch (NullReferenceException)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\PinnedGCHandle.T.cs (2)
46/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception> 82/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\WeakGCHandle.T.cs (2)
49/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception> 62/// <exception cref="NullReferenceException">If the handle is not initialized or already disposed.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\ISimdVector_2.cs (4)
183/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 193/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 234/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception> 243/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\SimdVectorExtensions.cs (2)
16/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 32/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (4)
645/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 667/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 873/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception> 894/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (4)
672/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 694/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 900/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception> 921/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (4)
586/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 607/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 804/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception> 824/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (4)
619/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 641/// <exception cref="NullReferenceException"><paramref name="destination" /> is <c>null</c>.</exception> 870/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception> 891/// <exception cref="NullReferenceException"><paramref name="values" /> is <c>null</c>.</exception>
src\libraries\System.Private.CoreLib\src\System\Threading\Interlocked.cs (36)
20/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 29/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 40/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 49/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 61/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 72/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 82/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 120/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 159/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 170/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 181/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 190/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 199/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 217/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 234/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 297/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 309/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 320/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 362/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 405/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 417/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 429/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 439/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 449/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 468/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 486/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 552/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 562/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 584/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 606/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 616/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 638/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 650/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 672/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 682/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 704/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception>
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadLocal.cs (1)
213/// <exception cref="NullReferenceException">
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolBoundHandle.Portable.cs (1)
92catch (NullReferenceException ex)
src\System\Runtime\InteropServices\MemoryMarshal.CoreCLR.cs (2)
15/// <exception cref="NullReferenceException"><paramref name="array"/> is <see langword="null"/>.</exception> 29/// <exception cref="NullReferenceException"><paramref name="array"/> is <see langword="null"/>.</exception>
src\System\Threading\Interlocked.CoreCLR.cs (12)
16/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 23/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 32/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 39/// <exception cref="NullReferenceException">The address of location is a null pointer.</exception> 49/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 70/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 91/// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception> 113/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 135/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 157/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 178/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception> 186/// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception>
System.Private.Windows.Core (1)
System\ExceptionExtensions.cs (1)
17=> ex is NullReferenceException
System.Private.Xml (1)
System\Xml\XmlException.cs (1)
297e is NullReferenceException
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
369[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.NullReferenceException))]
System.Runtime.Serialization.Formatters (1)
System\Runtime\Serialization\ObjectManager.cs (1)
259catch (NullReferenceException)
System.Windows.Forms (5)
System\Windows\Forms\Controls\Labels\LinkArea.LinkAreaConverter.cs (1)
133catch (NullReferenceException nullRef)
System\Windows\Forms\Controls\MonthCalendar\SelectionRangeConverter.cs (1)
152catch (NullReferenceException nullRef)
System\Windows\Forms\DataBinding\ListBindingConverter.cs (1)
95catch (NullReferenceException nullRef)
System\Windows\Forms\NativeWindow.cs (1)
455catch (NullReferenceException e)
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutPanelCellPositionTypeConverter.cs (1)
90catch (NullReferenceException nullRef)
System.Windows.Forms.Design.Tests (4)
System\ComponentModel\Design\ByteViewerTests.cs (2)
397Assert.Throws<NullReferenceException>(() => control.OnLayout(null)); 589Assert.Throws<NullReferenceException>(() => control.OnPaint(null));
System\Windows\Forms\Design\ImageListDesignerOriginalImageCollectionTests.cs (1)
40action.Should().Throw<NullReferenceException>();
System\Windows\Forms\Design\RichTextBoxActionListTests.cs (1)
12action.Should().Throw<NullReferenceException>();
System.Windows.Forms.Primitives (1)
System\Windows\Forms\PaddingConverter.cs (1)
103catch (NullReferenceException nullRef)
System.Windows.Forms.Tests (84)
CheckedListBoxTests.cs (1)
457Assert.Throws<NullReferenceException>(() => control.OnDrawItem(null));
SerializableTypesTests.cs (4)
313Assert.Throws<NullReferenceException>(() => result.CellBorderWidth); 314Assert.Throws<NullReferenceException>(() => result.ColumnCount); 315Assert.Throws<NullReferenceException>(() => result.GrowStyle); 316Assert.Throws<NullReferenceException>(() => result.RowCount);
System\Windows\Forms\AxHost.ConnectionPointCookieTests.cs (1)
48Assert.Throws<NullReferenceException>(() => new AxHost.ConnectionPointCookie(source, null, null));
System\Windows\Forms\AxHostTests.cs (1)
1337Assert.Throws<NullReferenceException>(() => control.DoVerb(verb));
System\Windows\Forms\BaseCollectionTests.cs (3)
16Assert.Throws<NullReferenceException>(() => collection.Count); 43Assert.Throws<NullReferenceException>(() => collection.CopyTo(Array.Empty<object>(), 0)); 59Assert.Throws<NullReferenceException>(() => collection.CopyTo(Array.Empty<object>(), 0));
System\Windows\Forms\ButtonBaseTests.cs (9)
98Assert.Throws<NullReferenceException>(() => control.PreferredSize); 5020Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5024Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5047Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5054Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5740Assert.Throws<NullReferenceException>(() => control.OnKeyDown(null)); 6020Assert.Throws<NullReferenceException>(() => control.OnKeyUp(null)); 6207Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 6822Assert.Throws<NullReferenceException>(() => control.OnMouseMove(null));
System\Windows\Forms\ButtonTests.cs (2)
2355Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 2867Assert.Throws<NullReferenceException>(() => control.OnMouseUp(null));
System\Windows\Forms\ComboBox.ComboBoxUiaTextProviderTests.cs (1)
181Assert.Throws<NullReferenceException>(() => _ = provider.DocumentRange);
System\Windows\Forms\ControlPaintTests.cs (1)
1351Assert.Throws<NullReferenceException>(() => ControlPaint.DrawImageDisabled(graphics, null, 0, 0, Color.Red));
System\Windows\Forms\ControlTests.Handlers.cs (1)
2989Assert.Throws<NullReferenceException>(() => control.OnInvalidated(null));
System\Windows\Forms\ControlTests.Methods.cs (5)
2948Assert.Throws<NullReferenceException>(control.InitLayout); 4267Assert.Throws<NullReferenceException>(() => control.InvokePaint(null, eventArgs)); 4323Assert.Throws<NullReferenceException>(() => control.InvokePaintBackground(null, eventArgs)); 5253Assert.Throws<NullReferenceException>(control.PerformLayout); 5254Assert.Throws<NullReferenceException>(() => control.PerformLayout(new Control(), "AffectedProperty"));
System\Windows\Forms\DataGridViewElementTests.cs (5)
94Assert.Throws<NullReferenceException>(() => element.RaiseCellClick(null)); 146Assert.Throws<NullReferenceException>(() => element.RaiseCellContentClick(null)); 198Assert.Throws<NullReferenceException>(() => element.RaiseCellContentDoubleClick(null)); 250Assert.Throws<NullReferenceException>(() => element.RaiseCellValueChanged(null)); 322Assert.Throws<NullReferenceException>(() => element.RaiseDataError(null));
System\Windows\Forms\DataGridViewHeaderCellTests.cs (2)
4229Assert.Throws<NullReferenceException>(() => cell.OnMouseDown(null)); 4612Assert.Throws<NullReferenceException>(() => cell.OnMouseUp(null));
System\Windows\Forms\DataGridViewTests.cs (2)
2315Assert.Throws<NullReferenceException>(() => control.OnColumnHeadersHeightSizeModeChanged(null)); 2796Assert.Throws<NullReferenceException>(() => control.OnRowHeadersWidthSizeModeChanged(null));
System\Windows\Forms\DataObjectTests.cs (2)
2160((Action)(() => enumerator.Next(1, null, fetched))).Should().Throw<NullReferenceException>(); 2350((Action)(() => enumerator.Next(1, null, fetched))).Should().Throw<NullReferenceException>();
System\Windows\Forms\DomainUpDownTests.cs (1)
1129act.Should().Throw<NullReferenceException>();
System\Windows\Forms\GroupBoxTests.cs (1)
1958Assert.Throws<NullReferenceException>(() => control.OnPaint(null));
System\Windows\Forms\HtmlElementTests.cs (2)
1503Assert.Throws<NullReferenceException>(() => element.AppendChild(null)); 2320Assert.Throws<NullReferenceException>(() => element.InsertAdjacentElement(HtmlElementInsertionOrientation.BeforeEnd, null));
System\Windows\Forms\ImageListTests.cs (3)
1026Assert.Throws<NullReferenceException>(() => list.Draw(null, Point.Empty, 0)); 1027Assert.Throws<NullReferenceException>(() => list.Draw(null, 0, 0, 0)); 1028Assert.Throws<NullReferenceException>(() => list.Draw(null, 0, 0, 10, 10, 0));
System\Windows\Forms\Layout\TableLayoutSettingsTests.cs (6)
37Assert.Throws<NullReferenceException>(() => settings.GrowStyle); 38Assert.Throws<NullReferenceException>(() => settings.ColumnCount); 43Assert.Throws<NullReferenceException>(() => settings.RowCount); 1852Assert.Throws<NullReferenceException>(() => result.ColumnCount); 1853Assert.Throws<NullReferenceException>(() => result.RowCount); 1856Assert.Throws<NullReferenceException>(() => result.GrowStyle);
System\Windows\Forms\NativeWindowTests.cs (1)
167Assert.Throws<NullReferenceException>(() => window.CreateHandle(null));
System\Windows\Forms\NotifyIconTests.cs (2)
312Assert.Throws<NullReferenceException>(() => notifyIcon.Icon = value); 567Assert.Throws<NullReferenceException>(() => notifyIcon.Visible = !value);
System\Windows\Forms\PropertyGridTests.cs (2)
3745Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 3845Assert.Throws<NullReferenceException>(() => control.OnMouseMove(null));
System\Windows\Forms\RadioButtonTests.cs (1)
1272Assert.Throws<NullReferenceException>(() => control.OnMouseUp(null));
System\Windows\Forms\RichTextBoxTests.cs (2)
4949Assert.Throws<NullReferenceException>(() => control.SelectionFont = null); 7914Assert.Throws<NullReferenceException>(() => control.CanPaste(null));
System\Windows\Forms\SplitterTests.cs (1)
2177Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null));
System\Windows\Forms\StatusStripTests.cs (1)
1196Assert.Throws<NullReferenceException>(() => control.OnLayout(null));
System\Windows\Forms\TableLayoutPanelTests.cs (1)
1407Assert.Throws<NullReferenceException>(() => control.OnLayout(null));
System\Windows\Forms\ToolStripButtonTests.cs (1)
1510Assert.Throws<NullReferenceException>(() => item.OnPaint(null));
System\Windows\Forms\ToolStripContentPanelTests.cs (1)
1889Assert.Throws<NullReferenceException>(() => control.OnPaintBackground(null));
System\Windows\Forms\ToolStripDropDownItemTests.cs (2)
468Assert.Throws<NullReferenceException>(() => item.DropDown); 469Assert.Throws<NullReferenceException>(() => item.DropDown);
System\Windows\Forms\ToolStripDropDownTests.cs (1)
4767Assert.Throws<NullReferenceException>(() => control.OnScroll(null));
System\Windows\Forms\ToolStripSeparatorTests.cs (1)
1350Assert.Throws<NullReferenceException>(() => item.OnPaint(null));
System\Windows\Forms\ToolStripTests.cs (3)
5844Assert.Throws<NullReferenceException>(() => control.OnPaint(null)); 6306Assert.Throws<NullReferenceException>(() => control.OnPaintGrip(null)); 6772Assert.Throws<NullReferenceException>(() => control.OnScroll(null));
System\Windows\Forms\TreeViewTests.cs (3)
5847Assert.Throws<NullReferenceException>(() => control.OnKeyDown(null)); 5892Assert.Throws<NullReferenceException>(() => control.OnKeyPress(null)); 5939Assert.Throws<NullReferenceException>(() => control.OnKeyUp(null));
System\Windows\Forms\UnsupportedTypesTests.cs (1)
164((Action)(() => CreateFrameworkTypes.DataGrid_MouseUp(null, null))).Should().Throw<NullReferenceException>();
System\Windows\Forms\UpDownBaseTests.cs (5)
2043Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 2170Assert.Throws<NullReferenceException>(() => control.OnMouseUp(null)); 2222Assert.Throws<NullReferenceException>(() => control.OnMouseWheel(null)); 2338Assert.Throws<NullReferenceException>(() => control.OnPaint(null)); 2425Assert.Throws<NullReferenceException>(() => control.OnTextBoxKeyDown(new object(), null));
System\Windows\Forms\VisualStyles\VisualStyleRendererTests.cs (1)
75Assert.Throws<NullReferenceException>(() => new VisualStyleRenderer(null));
TrackBarTests.cs (1)
2602Assert.Throws<NullReferenceException>(() => control.OnMouseWheel(null));
System.Xaml (1)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\CriticalExceptions.cs (1)
23return ex is NullReferenceException ||
System.Xaml.Tests (73)
System\Xaml\Schema\XamlTypeNameTests.cs (4)
177Assert.Throws<NullReferenceException>(() => typeName.ToString()); 178Assert.Throws<NullReferenceException>(() => typeName.ToString(null)); 179Assert.Throws<NullReferenceException>(() => typeName.ToString(prefixLookup)); 180Assert.Throws<NullReferenceException>(() => XamlTypeName.ToString(new XamlTypeName[] { typeName }, prefixLookup));
System\Xaml\XamlMemberTests.cs (23)
384Assert.Throws<NullReferenceException>(() => member.PreferredXamlNamespace); 485Assert.Throws<NullReferenceException>(() => member.LookupDeferringLoaderEntry()); 486Assert.Throws<NullReferenceException>(() => member.DeferringLoader); 499Assert.Throws<NullReferenceException>(() => member.LookupDeferringLoaderEntry()); 500Assert.Throws<NullReferenceException>(() => member.DeferringLoader); 645Assert.Throws<NullReferenceException>(() => member.LookupDependsOnEntry()); 646Assert.Throws<NullReferenceException>(() => member.DependsOn); 659Assert.Throws<NullReferenceException>(() => member.LookupDependsOnEntry()); 660Assert.Throws<NullReferenceException>(() => member.DependsOn); 1363Assert.Throws<NullReferenceException>(() => member.LookupMarkupExtensionBracketCharactersEntry()); 1364Assert.Throws<NullReferenceException>(() => member.MarkupExtensionBracketCharacters); 1377Assert.Throws<NullReferenceException>(() => member.LookupMarkupExtensionBracketCharactersEntry()); 1378Assert.Throws<NullReferenceException>(() => member.MarkupExtensionBracketCharacters); 1487Assert.Throws<NullReferenceException>(() => member.SerializationVisibility); 1500Assert.Throws<NullReferenceException>(() => member.SerializationVisibility); 1777Assert.Throws<NullReferenceException>(() => member.LookupTypeConverterEntry()); 1778Assert.Throws<NullReferenceException>(() => member.TypeConverter); 1791Assert.Throws<NullReferenceException>(() => member.LookupTypeConverterEntry()); 1792Assert.Throws<NullReferenceException>(() => member.TypeConverter); 2128Assert.Throws<NullReferenceException>(() => member.LookupValueSerializerEntry()); 2129Assert.Throws<NullReferenceException>(() => member.ValueSerializer); 2142Assert.Throws<NullReferenceException>(() => member.LookupValueSerializerEntry()); 2143Assert.Throws<NullReferenceException>(() => member.ValueSerializer);
System\Xaml\XamlSchemaContextTests.cs (3)
344Assert.Throws<NullReferenceException>(() => context.GetPreferredPrefix("xmlns")); 372Assert.Throws<NullReferenceException>(() => context.GetPreferredPrefix("xmlns")); 943Assert.Throws<NullReferenceException>(() => context.GetXamlType(type));
System\Xaml\XamlTypeTests.cs (43)
198Assert.Throws<NullReferenceException>(() => type.PreferredXamlNamespace); 374Assert.Throws<NullReferenceException>(() => type.GetXamlNamespaces()); 406Assert.Throws<NullReferenceException>(() => type.GetXamlNamespaces()); 645Assert.Throws<NullReferenceException>(() => type.LookupAliasedPropertyEntry(directive)); 646Assert.Throws<NullReferenceException>(() => type.GetAliasedProperty(directive)); 660Assert.Throws<NullReferenceException>(() => type.LookupAliasedPropertyEntry(directive)); 661Assert.Throws<NullReferenceException>(() => type.GetAliasedProperty(directive)); 1451Assert.Throws<NullReferenceException>(() => type.LookupAllowedContentTypesEntry()); 1452Assert.Throws<NullReferenceException>(() => type.AllowedContentTypes); 1465Assert.Throws<NullReferenceException>(() => type.LookupAllowedContentTypesEntry()); 1466Assert.Throws<NullReferenceException>(() => type.AllowedContentTypes); 2055Assert.Throws<NullReferenceException>(() => type.LookupContentPropertyEntry()); 2056Assert.Throws<NullReferenceException>(() => type.ContentProperty); 2069Assert.Throws<NullReferenceException>(() => type.LookupContentPropertyEntry()); 2070Assert.Throws<NullReferenceException>(() => type.ContentProperty); 2239Assert.Throws<NullReferenceException>(() => type.LookupContentWrappersEntry()); 2240Assert.Throws<NullReferenceException>(() => type.ContentWrappers); 2253Assert.Throws<NullReferenceException>(() => type.LookupContentWrappersEntry()); 2254Assert.Throws<NullReferenceException>(() => type.ContentWrappers); 2418Assert.Throws<NullReferenceException>(() => type.LookupDeferringLoaderEntry()); 2419Assert.Throws<NullReferenceException>(() => type.DeferringLoader); 2432Assert.Throws<NullReferenceException>(() => type.LookupDeferringLoaderEntry()); 2433Assert.Throws<NullReferenceException>(() => type.DeferringLoader); 3389Assert.Throws<NullReferenceException>(() => type.LookupMarkupExtensionReturnTypeEntry()); 3390Assert.Throws<NullReferenceException>(() => type.MarkupExtensionReturnType); 3403Assert.Throws<NullReferenceException>(() => type.LookupMarkupExtensionReturnTypeEntry()); 3404Assert.Throws<NullReferenceException>(() => type.MarkupExtensionReturnType); 3822Assert.Throws<NullReferenceException>(() => type.LookupSetMarkupExtensionHandlerEntry()); 3835Assert.Throws<NullReferenceException>(() => type.LookupSetMarkupExtensionHandlerEntry()); 4021Assert.Throws<NullReferenceException>(() => type.LookupSetTypeConverterHandlerEntry()); 4034Assert.Throws<NullReferenceException>(() => type.LookupSetTypeConverterHandlerEntry()); 4317Assert.Throws<NullReferenceException>(() => type.LookupTypeConverterEntry()); 4318Assert.Throws<NullReferenceException>(() => type.TypeConverter); 4331Assert.Throws<NullReferenceException>(() => type.LookupTypeConverterEntry()); 4332Assert.Throws<NullReferenceException>(() => type.TypeConverter); 4547Assert.Throws<NullReferenceException>(() => type.LookupUsableDuringInitializationEntry()); 4548Assert.Throws<NullReferenceException>(() => type.IsUsableDuringInitialization); 4561Assert.Throws<NullReferenceException>(() => type.LookupUsableDuringInitializationEntry()); 4562Assert.Throws<NullReferenceException>(() => type.IsUsableDuringInitialization); 4725Assert.Throws<NullReferenceException>(() => type.LookupValueSerializerEntry()); 4726Assert.Throws<NullReferenceException>(() => type.ValueSerializer); 4739Assert.Throws<NullReferenceException>(() => type.LookupValueSerializerEntry()); 4740Assert.Throws<NullReferenceException>(() => type.ValueSerializer);
UIAutomationClient (2)
MS\Internal\Automation\Accessible.cs (1)
105&& !(e is NullReferenceException)
MS\Internal\Automation\Misc.cs (1)
211return e is NullReferenceException || e is StackOverflowException || e is OutOfMemoryException || e is System.Threading.ThreadAbortException;
UIAutomationClientSideProviders (5)
MS\Internal\AutomationProxies\Accessible.cs (4)
653if (!(e is NullReferenceException) && HandleIAccessibleException(e)) 1094if (Misc.IsCriticalException(e) && ! (e is NullReferenceException)) 1269if (Misc.IsCriticalException(e) && ! (e is NullReferenceException)) 1296if (e is NullReferenceException)
MS\Internal\AutomationProxies\Misc.cs (1)
803return e is NullReferenceException || e is StackOverflowException || e is OutOfMemoryException || e is System.Threading.ThreadAbortException;
WindowsBase.Tests (31)
System\ComponentModel\CurrentChangingEventManagerTests.cs (2)
381Assert.Throws<NullReferenceException>(() => CurrentChangingEventManager.AddHandler(null, handler)); 384Assert.Throws<NullReferenceException>(() => CurrentChangingEventManager.RemoveHandler(null, handler));
System\ComponentModel\PropertyChangedEventManagerTests.cs (2)
398Assert.Throws<NullReferenceException>(() => PropertyChangedEventManager.AddHandler(null, handler, "propertyName")); 401Assert.Throws<NullReferenceException>(() => PropertyChangedEventManager.AddHandler(null, handler, "propertyName"));
System\Windows\DependencyObjectTests.cs (1)
1161Assert.Throws<NullReferenceException>(() => obj.CoerceValue(null!));
System\Windows\DependencyPropertyChangedEventArgsTests.cs (2)
32Assert.Throws<NullReferenceException>(() => new DependencyPropertyChangedEventArgs(null, "oldValue", "newValue")); 78Assert.Throws<NullReferenceException>(() => args.Equals(null));
System\Windows\ExpressionConverterTests.cs (3)
73Assert.Throws<NullReferenceException>(() => converter.ConvertTo(value, null!)); 74Assert.Throws<NullReferenceException>(() => converter.ConvertTo(null, null, value, null!)); 75Assert.Throws<NullReferenceException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, value, null!));
System\Windows\FreezableTests.cs (5)
2201Assert.Throws<NullReferenceException>(() => freezable.CloneCore(null!)); 3087Assert.Throws<NullReferenceException>(() => freezable.CloneCurrentValueCore(null!)); 3564Assert.Throws<NullReferenceException>(() => obj.CoerceValue(null!)); 5200Assert.Throws<NullReferenceException>(() => freezable.GetAsFrozenCore(null!)); 6051Assert.Throws<NullReferenceException>(() => freezable.GetCurrentValueAsFrozenCore(null!));
System\Windows\Input\ModifierKeysConverterTests.cs (3)
133Assert.Throws<NullReferenceException>(() => converter.ConvertTo(value, typeof(string))); 134Assert.Throws<NullReferenceException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), null, value, typeof(string))); 135Assert.Throws<NullReferenceException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, value, typeof(string)));
System\Windows\Input\ModifierKeysValueSerializerTests.cs (2)
63Assert.Throws<NullReferenceException>(() => serializer.ConvertToString(value, null)); 64Assert.Throws<NullReferenceException>(() => serializer.ConvertToString(value, new CustomValueSerializerContext()));
System\Windows\LocalValueEntryTests.cs (1)
82Assert.Throws<NullReferenceException>(() => entry.Equals(null));
System\Windows\NameScopeTests.cs (1)
532Assert.Throws<NullReferenceException>(() => nameScope.CopyTo(null, 0));
System\Windows\WeakEventManagerTests.cs (6)
2671Assert.Throws<NullReferenceException>(() => manager.Purge(source, null!, false)); 2812Assert.Throws<NullReferenceException>(() => manager.Purge(source, null!, false)); 3305Assert.Throws<NullReferenceException>(() => ListenerList.PrepareForWriting(ref list)); 3912Assert.Throws<NullReferenceException>(() => list.AddHandler(null)); 4294Assert.Throws<NullReferenceException>(() => list.CopyTo(null!)); 5641Assert.Throws<NullReferenceException>(() => list.RemoveHandler(null));
System\Windows\WeakEventManagerTTests.cs (3)
189Assert.Throws<NullReferenceException>(() => WeakEventManager<object, EventArgs>.AddHandler(new object(), null, (sender, e) => { })); 192Assert.Throws<NullReferenceException>(() => WeakEventManager<object, EventArgs>.AddHandler(new object(), null, (sender, e) => { })); 351Assert.Throws<NullReferenceException>(() => WeakEventManager<object, EventArgs>.RemoveHandler(new object(), null, (sender, e) => { }));