© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
11 replies
Jawad

❔ System.NullReferenceException: 'Object reference not set to an instance of an object.'

Need some help please with this exception

try
{
EntityCollection collection = service.RetrieveMultiple(new FetchExpression(query));


foreach (Entity contact in collection.Entities)
{
Console.WriteLine(contact.Attributes["fullname"].ToString());
}
}
catch (NullReferenceException e)
{
//eventListener.HandleEvent(Severity.Informational, line.GetType().Name, String.Format("Could not find the customer corresponding to the taxId '{0}' Applicant address will not be imported.", new TaxId(line.TaxId).Masked));
//eventListener.HandleEvent(Severity.Informational, line.GetType().Name, e.Message);
Console.WriteLine(e.Message);
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

System.NullReferenceException : 'Object reference not set to an instance of an object.'
C#CC# / help
2y ago
System.NullReferenceException: Object reference not set to an instance of an object.
C#CC# / help
3y ago
❔ System.NullReferenceException 'Object reference not set to an instance of an object.'
C#CC# / help
4y ago