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.
167
questions
0
votes
0
answers
45
views
Send email with WPF Console on C#
I'm trying to build a WPF Application on C# (.NET 6.0).
This app has to send mail. I give as parameters: mailFrom, mailTo, host, password, subject and the message's body. The class which responds to ...
-1
votes
1
answer
58
views
ArgumentNullException in Newtonsoft.Json when parsing? [duplicate]
I've been trying to write a script to reformat some large .json files, and had a functional prototype. However, when implementing functionality to parse the actions, reactions, legendary_actions, and ...
-1
votes
1
answer
135
views
Newtonsoft.Json.JsonSerializationException: Error setting value to 'StringProperty' on 'MyComponent' with inner ArgumentNullException
I'm attempting to create a 'Has Been Edited' tracker for my component classes, like this:
public class MyComponent : ObservableObject
{
// If any changes are made to properties that have the ...
0
votes
1
answer
601
views
Rest API : Value cannot be null. (Parameter 'text') on GET Method
In my REST Api in .net core, I created a route that returns me for an article code, the description of the article. But if the article does not exist or if the Description column of the article is ...
0
votes
0
answers
33
views
IFontResolver return buffer null
I'm using PDFSharpCore to create a pdf, when I came across the problem that there are no fonts on my android device (I'm using a physical android device since emulators are not working on my computer),...
-1
votes
3
answers
2k
views
ASP.NET .NET6 System.ArgumentNullException: "Value cannot be null. Arg_ParamName_Name"
I have a TryGetByStatementId method, which, using the FirstOrDefault method, returns me the id from the database.
I also have a database that stores information about the uploaded file.
I upload the ...
0
votes
0
answers
342
views
System.ArgumentNullException: 'Value cannot be null. Arg_ParamName_Name' + _ViewStart.cshtml + Razor + C#.Net
Error in _ViewStart.cshtml with DotRez Razor
Steps
I'm trying debug my app (with IIS Express or IIS) but appear error of ArgumentNullException, but if I open de app only with IIS without attach the ...
0
votes
1
answer
144
views
_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 ...
0
votes
0
answers
48
views
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, ...
0
votes
0
answers
82
views
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 ...
0
votes
0
answers
47
views
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 ...
0
votes
1
answer
35
views
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
{ ...
1
vote
3
answers
1k
views
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<string> users = (from c in _context.NR_Users select c.Name).ToList();
users.Insert(0, "Select");
ViewBag.users = users;
It ...
0
votes
1
answer
118
views
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
<div class="form-group col-md-6">
...
1
vote
0
answers
421
views
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 ...
0
votes
1
answer
19
views
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
<div class="form-group">
...
0
votes
1
answer
97
views
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 ...
0
votes
1
answer
1k
views
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<...
0
votes
1
answer
527
views
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 ...
0
votes
1
answer
212
views
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....
0
votes
1
answer
138
views
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 ...
0
votes
1
answer
79
views
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 ...
0
votes
0
answers
247
views
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:
{
&...
0
votes
0
answers
94
views
ASP.NET CORE: IConfiguration can not access ConnectionString inside Class Library
I have a class library for a Repository to handle the Database operation, and I tried to create DbContext and set ConnectionString as well, but it did not work.
namespace CoreCrud.Repository
{
...
0
votes
1
answer
169
views
Why I can't remove image in canvas WPF C#?
I have my class in Anobject.cs file:
public class AnObject
{
public string Name { get; set; }
public int? X { get; set; }
public int? Y { get; set; }
public AnObject(string name = null,...
3
votes
3
answers
14k
views
Navigate to new view on button click in ASP.NET Core 3.1 MVC
I am trying to navigate the user to a new page with a button click. I am having issues with rendering the new view. Any time I do click on the button, I either get an error for a dropdown on my page, ...
0
votes
0
answers
139
views
ArgumentNullException when using custom WinForms control in a form
I am creating a custom WinForms control, containing a DataGridView and some buttons. I have two projects in a solution, one for the control, and one is a test application with a single form containing ...
0
votes
3
answers
322
views
Syncfusion Datagrid crashes Xamarin IOS application due to initiallising of control
I have a Xamarin application in which I have included the Syncfusion Datagrid control. I am trying to deploy this to an IOS simulator in visual studio. I have added the NuGet package and included a ...
2
votes
2
answers
4k
views
MSTest Unit Test asserting specific exception messages
I'm writing my first Unit test for very small project. Here the expected result and result both return a ArgumentNullException but the test still fails. Any idea why?
[TestMethod]
...
0
votes
1
answer
242
views
asp.net mvc 4.6 dropdownlist give "System.ArgumentNullException: 'Value cannot be null. Parameter name: items' " Error
I tried MVC model to have a Store Procedure, Class, API controller, CreateController and Create View.
For some reason, when I try to use the Dropdownlist, it have error and point to the View
System....
0
votes
2
answers
117
views
How to manage NullReferenceException?
I want to make a form that user have to fill out it.
But I'm getting an error.
Model:
public UserReport Input;
[Key]
//[Required]
public string ReportID { get; set; }
[Required]
public string ...
0
votes
3
answers
191
views
xamarin forms: System.ArgumentNullException has been thrown (IOS)
I am using webview for parsing my HTML data. For this, I am using a custom render.
In the Main Project:
public class MyWebView : WebView
{
public static readonly BindableProperty UrlProperty = ...
0
votes
1
answer
1k
views
Xamarin Forms: Custom webview is not working in IOS
I am using Custom Webview for solving ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs. and parsing HTML data.
My Code:
MyWebView.cs
using ...
3
votes
1
answer
1k
views
C# ArgumentNullException type or namespace could not be found. VS Code
Part Of My Code:
public void Move(Point newLocation)
{
if (newLocation == null)
throw new ArgumentNullException("newLocation");
Move(newLocation.X, newLocation.Y);
...
2
votes
0
answers
356
views
Random occurence of System.ArgumentNullException in Windows Service
I have been facing this weird issue with my WCF service which is already Deployed.
It has been set to automatic restart in case of errors.
I have been observing my service is getting stopped randomly....
-2
votes
2
answers
978
views
StreamReader reads null in while loop
Using this method I am looping through a file removing lines with a 'T' in them and storing them to a list. At the end of the loop it should exit, however it reads the null value and continues to pass ...
1
vote
1
answer
290
views
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 ...
0
votes
0
answers
541
views
System.ArgumentNullException: 'Value cannot be null. Parameter name: source' On my code
I tended to copy this code from a tutorial and fix it on my database tables however i keep on getting a thrown exception which is the one mentioned above..
i tried adding data source, didnt work.
...
-3
votes
1
answer
80
views
Why am I having a pop up in Visual Studio saying System ArgumentNullExpection has been thrown? [duplicate]
I am trying to run some code, it worked smoothly before, but now it says System.ArgumentNullExpection has been thrown.
I have tried running the code but that message now always appears
Console....
-2
votes
1
answer
68
views
NullPointerException when i run my project [duplicate]
i have a problem with my code, this is error
java.lang.NullPointerException: Attempt to invoke virtual method
'void android.widget.ImageView.setImageResource(int)' on a null object
reference
...
1
vote
1
answer
3k
views
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 ...
2
votes
0
answers
835
views
Using Null-Propagation operator with null-coalescing-operator to throw a null exception
I'm trying to get the value that is null in my chained variable
I've created three scripts. Level1, level2, level3. Level 1 has a public variable of level2, level2 has public variables of level3 and ...
0
votes
1
answer
1k
views
Selenium - System.ArgumentNullException: text cannot be null Parameter name: text
When I am trying to run the code then I get this error "System.ArgumentNullException: text cannot be null Parameter name: text" it doesn't pull the data from excel file; can anyone please give me the ...
-1
votes
1
answer
478
views
ConnectionString NULL
I'm getting this error:
An unhandled exception occurred while processing the request.
ArgumentNullException: Value cannot be null.
Parameter name: connectionString
My DbContext:
public class ...
-1
votes
1
answer
78
views
Error in VB code which is "System.ArgumentNullException" in vb.net
I get this error when I added this only code :
table.Columns.Add("Grade", Type.GetType("System.string"))
I have tried to change data type to Char but also was useless
what I is to add the "...
0
votes
1
answer
42
views
DropDownList with foreignkey model c#
I have a model with a foreignkey to another models. From this foreignkey, i want to show into my form a DropDownList with the name of my second models. When i go to create.cshtml or edit.cshtml i have ...
1
vote
1
answer
314
views
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: ...
0
votes
1
answer
412
views
ArgumentNullException/PlatformNotSupportedException from mscorlib only in debugger
I have been seeing a pair of exceptions when debugging (VS 2015) which occur when clicking in a Textbox. They do not always occur but they always seem to occur under the same circumstances (I can't ...
0
votes
0
answers
208
views
ArgumentNullException in custom IQueryProvider
At first some background for understanding why I try to create a custom IQueryProvider:
I'm looking for a solution for a generic OData client that supports IQueryable. I don't want to use the OData ...
0
votes
1
answer
598
views
Exception to throw when the internals of an Argument are invalid
I have asked myself this many times, but until this day I have not found a good answer. What is the correct exception to throw, if you realize there is an invalid state in the argument that has passed ...