Questions tagged [argumentnullexception]

[MSDN] The exception that is thrown when a null reference is passed to a method that does not accept it as a valid argument.

MSDN ArgumentNullException is thrown when a method is invoked and at least one of the passed arguments is null but should never be null.

ArgumentNullException behaves identically to ArgumentException. It is provided so that application code can differentiate between exceptions caused by null arguments and exceptions caused by arguments that are not null. For errors caused by arguments that are not null, see ArgumentOutOfRangeException.

ArgumentNullException uses the HRESULT E_POINTER, which has the value 0x80004003.

For a list of initial property values for an instance of ArgumentNullException, see the ArgumentNullException constructors.

166 questions
1
vote
3 answers

ArgumentNullException was unhandled - Value cannot be null. Parameter name: first

I am currently using the DotSpatial library for .NET (GIS Library). I am getting an error within my AppManager class. The AppManager is a Component that manages the loading of extensions (including data providers), and helps with file…
Logan B. Lehman
  • 4,867
  • 7
  • 32
  • 45
1
vote
2 answers

REST 4.0 & Ninject.Extensions.Wcf 2.3 NullReferenceException

I am trying to make a simple REST Service with .NET 4.0 that uses ninject to inject any dependencies for the service. This is what my service looks like currently: [ServiceContract] [AspNetCompatibilityRequirements(RequirementsMode =…
shuniar
  • 2,592
  • 6
  • 31
  • 38
1
vote
2 answers

JavaScriptSerializer throwing ArgumentNullException on deserialization

I'm writing an application that posts and gets JSON to/from a backend in Visual C# 4.0. Obviously, the easiest way to serialize/deserialize the JSON is System.Web.Script.Serialization.JavaScriptSerializer, but I'm having a weird error where it's…
1
vote
3 answers

ASP.NET Core 5 MVC: ArgumentNullException: Value cannot be null. (Parameter 'items')

I have this list in the GET method for a create page: List users = (from c in _context.NR_Users select c.Name).ToList(); users.Insert(0, "Select"); ViewBag.users = users; It is displayed like this:
1
vote
0 answers

How to fix an ArgumentNullException (or NullReferenceException?) occurring in Enumerable.ToDictionary? (C# ASP.NET MVC)

I have an exception that is occurring, but I don't quite understand how it can be occurring. I would appreciate any tips on how to fix it, or advice on how I can better understand why the error is occurring. Background Info The error was logged to…
1
vote
1 answer

How to unit test Umbraco Api controller - System.ArgumentNullException: 'Value cannot be null. Parameter name: umbracoContext'

I'm trying to write unit tests for an UmbracoApiController but when running the tests I'm getting an error when creating a new instance of the api controller. I've started to look into mocking the umbraco context but haven't made much progress as…
Nathelol
  • 577
  • 7
  • 25
1
vote
1 answer

ArgumentNullException: Value cannot be null. Parameter name: entity

I am encountering the following Internal Server Error whenever I try to save the data entered on a website: ArgumentNullException: Value cannot be null. Parameter name: entity I am able to write from the database and see it on the website but I am…
Gh17
  • 76
  • 2
  • 9
1
vote
1 answer

How can I find which values I'm missing while debugging?

I try to add something to my dbcontext asynchronously using the following code: var entry = await _context.AddAsync(person); However, I get the following exception: System.ArgumentNullException: Value cannot be null. Parameter name: key at…
Friso
  • 2,328
  • 9
  • 36
  • 72
1
vote
0 answers

Argument null Exception on mvc when using Dropdown List

I am new to Mvc I get the following error in the browser window when i used ef to bind data to dropdownlist (Error):argument null exception was unhandled by user code and value Can't be null Controller: var ob =…
1
vote
1 answer

NullPointerException when using getSupportActionBar

I am trying to implement a simple navigation drawer in my Android app but I am not able to solve a certain bug. Attempting to run an app throws a NullPointerException: Process: com.emertonalex.whiskynotes04, PID: 22225 …
1
vote
1 answer

Extension Method on a null List with inner instantiation

Can I use an extension method over a list that may be null, and if that is the case then instanciate it just inside the Extension method?? Instanciate the list INSIDE the extension method that applies over it... sounds like when you try to add or…
Fernando Torres
  • 1,070
  • 8
  • 19
1
vote
0 answers

Xamarin Forms InitalizeComponent call does not initialize page controls

I have a pretty straightforward page that has a few controls on it. My problem only occurs on an actual device and only occurs on my Lumia 1520 running Win10 Mobile version 1607 Build 10.0.14946.1000. It does not happen on my Lumia 950 running…
1
vote
2 answers

The exception instead of NullReferenceException to throw?

code of c# void method(int a) { int b = get(a); if ( b == 0 ) { throw new NullReferenceException(); } } If I throw NullReferenceException, it will generate a warning, and it is not a good way. So if there is any exception…
1
vote
2 answers

WCF service is receiving null value from client

I wrote a service that implements functions performing video process. From the client (console project), I call a function of the service, using the client service reference, and send as parameter to the function a FileStream (I verified that indeed…
1
vote
1 answer

What could be null here?

My app is crashing after I clear the Bing Map of its pushpins and then open a flyout. This is what I see in the debugger: The textblock is definitely not null - it is defined declaratively in XAML. The List of String (CurrentlyMappedPhotosets) is…
1 2
3
11 12