Questions tagged [nullreferenceexception]

The .NET exception that is thrown when there is an attempt to reference (or use) a null or uninitialized object.

A NullReferenceException occurs when you try to reference an object in your code that does not exist. For example, you may have tried to use an object without using the New keyword first, or tried to use an object whose value is set to null (Nothing in Visual Basic).

Troubleshooting Exceptions: System.NullReferenceException

Also, see "What is a NullReferenceException in .NET and how do I fix it?" for some hints.

2780 questions
0
votes
1 answer

Xamarin SimpleAudioPlayer problem .. unable to make it work, Stream is null

I'm having problems with a simple app, trying to use SimpleAudioPlayer Plugin in Xamarin, with Visual Studio 2019 and creating an Android app. Atream always returns null. File meulanchinho.mp3 is placed in Friday.Android project, inside Assets…
0
votes
0 answers

Find Control returning null

When I try to find a control on the current page, it returns null every time and the control is right there. HTML: Code Behind HtmlInputRadioButton control =…
Walters
  • 119
  • 16
0
votes
1 answer

Why does FluentNhibernate return NullReference for existing row?

I do not get an object from this setup table SPEC ( Special_Name varchar2 pk Signal integer Created_At date) namespace App { public class Strategy { public virtual string Id { get; private set; } public virtual int…
mrt181
  • 5,080
  • 8
  • 66
  • 86
0
votes
0 answers

NullReferenceException: How to find the null

I am getting the following error. NullReferenceException: Object reference not set to an instance of an object. Which I think means there is a null object where there should be. However I've checked the db and can't find anywhere it would be a…
Conor8630
  • 345
  • 1
  • 17
0
votes
3 answers

NullReferenceException error in VB Application?

I'm building a voting system for calls, and have tried to build it in VB. So far this is what I have: Dim con As New OleDb.OleDbConnection Dim dbProvider As String Dim dbSource As String dbProvider =…
mickburkejnr
  • 3,652
  • 12
  • 76
  • 109
0
votes
0 answers

DataGrid.Refresh generates "Object reference not set to an instance of an object" message in c# WPF

In my WPF project I display data from a List of a class in a DataGrid. Every time the information from that list changes the DataGrid gets refreshed. This works correctly when a new item is added to the list, when an item changes and even works when…
0
votes
1 answer

Why does my object remain null while it has a value?

i try to show the number vote in my itemDetails page I receive my data from the page items all my data is readable yet (string Titre, string Description, int Vote) when i click on my button to acces on the items details page I receive the error…
0
votes
2 answers

Getting a null reference while trying to verify a signature using MimeKit

I'm currently working on a proof of concept to implement an AS2 client. I have set up a consle application that works as the sender, and a ASP .Net API that works as the receiver. I tried to achieve this using the Windows.Security library but there…
Chrilleson
  • 1
  • 1
  • 2
0
votes
1 answer

Are SystemExceptions and ApplicationException in Mono the same as unchecked and checked exception in Java?

In Java, there are two types of Exceptions, mainly unchecked and checked exceptions. Checked exceptions allow the program to recover when they are caught and handled in a ‘catch’ block. Unchecked exceptions just cause your program to crash, since…
leeand00
  • 25,510
  • 39
  • 140
  • 297
0
votes
5 answers

How do I properly initialize this array before use when I don't know the upper values?

I have the following section of code that acts on values in nodes from an xml file: var tests = new ServicesTests(); var testcase = new TestData(); var x = 0; foreach (XPathNavigator test in Service.Select("Testname")) { …
Jason
  • 463
  • 1
  • 11
  • 25
0
votes
0 answers

Async seems to be running the tasks to completion before getting to the Await tag

I'm working on a backup manager for some Quest (critical infrastructure monitoring devices) when running the Code it seems to be running my tasks as its adding them to a task list before calling .WhenAll. then when calling .WhenAll i get null ref…
0
votes
2 answers

How do I fix SonarQube "variable is null on at least one execution path"?

using sonarqube to analyze my code and being told "'alloc' is null on at least one execution path" for the following code public RetirementAdvantageProgramSleeveAllocation(VariableDVAPolicy policy, Fund fund) : base(policy, fund) { …
testing
  • 363
  • 1
  • 4
  • 10
0
votes
1 answer

'var' is null on at least one execution path - sonarqube

using sonarqube to analyze my code and being told "'actor' is null on at least one execution path" for the following code if (actor.ProducerAgreementIds != null && actor.ProducerAgreementIds.Count > 0) { actor.ProducerAgreementIds is a…
testing
  • 363
  • 1
  • 4
  • 10
0
votes
0 answers

C# debugger reports incorrect field name as null when NullReferenceException is thrown

I have a very strange case where I have a null parameter in my class that I attempt to access (and hence cause a NullReferenceException which is expected) however the debugger reports a field from another entirely unrelated class is null instead. I…
rollsch
  • 2,518
  • 4
  • 39
  • 65
0
votes
1 answer

System.NullReferenceException - Calling secondary page

my component (ascx): This component is part of my page, with him, i open one new page (the next code). public void LoadSeller(string name, string id) { this.txtSeller.Text = name; this.hdnSellerID.Value = id; } my pop up…
Michel Ayres
  • 5,891
  • 10
  • 63
  • 97