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
0
votes
1 answer

_userManager.FindByEmailAsync(User.FindFirstValue(ClaimTypes.Email)) returns null

I am having an issue with Claims not populating with ClaimsPrinciple after creating a JWT. I am using ASP.NET Core 6 on VS 2022. The issue raised after configuring identity to include Roles and RolesUsers. I had no issues prior to including these 2…
0
votes
0 answers

Getting ArgumentNullException: Value cannot be null when using DateTimePicker

Before I use it DateTimePicker everything was working fine, but after adding some javascript code for datetimepicker I am getting ArgumentNullException for @Html.DropDownListFor(x => x.LeagueId, new SelectList(ViewBag.Leagues, "Id", "LeagueType"),…
0
votes
0 answers

ArgumentNullException when unregistering reminder despite null check

I am using Reminders in my Orleans application, and i have a JournaledGrain that does implement the IRemindable interface. At the end of the flow i make sure i use UnregisterAsync. The reminder gets registered with the grain's identity.The IReminder…
Bercovici Adrian
  • 8,794
  • 17
  • 73
  • 152
0
votes
0 answers

Asp.net 3.1 Selecting Data Error-ArgumentNullException: Value cannot be null. (Parameter 'source')

Upgrading from Asp.Net 2.1 to 3.1 I am getting errors on a number of routines that select data with the error ArgumentNullException: Value cannot be null. (Parameter 'source') The following worked fine in 2.1 but produces this error in 3.1: Lines =…
0
votes
1 answer

to avoid nulls how can one formulate a better logic to pass through api results to objects in my project

here is a small part of the code if anyone has ideas feel free to hoit me up! public decimal getBook(string pair, decimal amount, string type, string operation, bool division = true) { try { //book is null …
0
votes
1 answer

Value cannot be null. Parameter name DropdownList in ASP. NET CORE

I have a problem in mi code, when show the error message appears the message of the title This is the code of my form Register
@if…
Carrobe90
  • 229
  • 1
  • 3
  • 11
0
votes
1 answer

SelectList(Model.RoleDropDownDisp,"RoleId","RoleName") causes an ArgumentNullException: Value cannot be null. (Parameter 'items')

on post I have some error checking before saving and if true I return to Page() In debugging I found out that it is a problem with my Drop Down Selection
0
votes
1 answer

Visual Studio - Code Snippet Error / Not Working AgumentNullException

Since i tried to add a spécific code snippet, non of my snippets works. I've tried to repare and uninstal and reinstall Visual Studio but it does not work. When i write : prop and tabulation i have an Argument null Exception Argument Null…
0
votes
1 answer

ArgumentNullException: Value cannot be null. (Parameter 'user')

I have problem with my code based on this tutorial. I tried to make list of roles and add or delete user from specific role. This is my code in controller: [HttpPost] public async Task EditUsersInRole(List
Piotr
  • 5
  • 5
0
votes
1 answer

FirstOrDefault() i'm getting a ArgumentNullException

I'm getting a ArgumentNullException and i dont know how to fix this. Ive tried DefaultIfEmpty but it still doesnt work. Here is the code: if (controller != "Home") { var defaultActionForController =…
0
votes
2 answers

wpf binging throws argumentnullexception

How do you handle when the editor (xaml / design) in visual studio throws an argumentnullexception, "value cannot be null" ? I am reading some values from the database using entity framework and storing them in an observable collection so I can bind…
amb
  • 1,599
  • 2
  • 11
  • 18
0
votes
1 answer

FirstOrDefault throws ArgumentnullException

My goal is to extract a specific record that has a parameter value specified by me. The data is taken from an external API. My query looks like this: var productId = productsResponse.Where(x => x.Parameters.Any(y => y.Values.Any(z =>…
Troom
  • 431
  • 6
  • 10
0
votes
1 answer

CLR SplitString Exception while executing in SQL Server

Hi I'm new in C# programming and just copied and pasted the CLR function from @Aaronaught's answer to use it in a SQL Server 2012: using System; using System.Collections; using System.Data; using System.Data.SqlClient; using…
user8554358
0
votes
1 answer

how to define null array in c#

What I want to do is to edit the database text file with the data in the text box, and if the text box is empty or whitespace data won't be changed. Reading and Writing methods in the database works properly I just need to pass the data in a string…
MRK
  • 87
  • 1
  • 8
0
votes
0 answers

Skip empty arrays in JSON deserialize

I'm trying to read a JSON document from a REST web service with Newsoft.JsonNET The document contains some empty arrays: { "values": [null] } This is how a filled array looks like: { "values": ["first", "second", "third"] } My model class…