[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Object reference not set to an instance of an object...

Posted on 2011-03-01
7
Medium Priority
?
321 Views
Last Modified: 2012-05-11
Hi,

This following C# code snippet throwing an error when I execute in my program.

 ResultCode leResultCode = moSearch.WebDedupeContact(ref lsErrorInfo, ref loIXMLDoc, lsFirstName + " " + lsLastName, "", "", "", "", "", "", Constants.IntelliSearch.MinimumMatchScore);

The error is: Object reference not set to an instance of an object...

I have view the definition for the class ResultCode as shwon below:

ResultCode WebDedupeContact(ref string ErrorInfo, ref IXMLDOMDocument2 XMLDoc, string SlxContact, string SlxAccountID, string Address, string City, string State, string Postcode, string Country, short MinimumMatchScore);
        [DispId(1610809829)]

And on the top of interface where we got this declaration also have these attribute as well for the interface:
 [Guid("903FB89C-F136-418D-A72D-0B917B1748BB")]
    [TypeLibType(4304)]

What are these mean? and most importantly where could this error be generated from?
0
Comment
Question by:ube100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 1000 total points
ID: 35007972
Where do you get that error ?
Is the object moSearch initialized ?
0
 

Author Comment

by:ube100
ID: 35007978
Sorry Just a small correction:

ResultCode is not a class it is a enum class and that definition is for WebDedupeContact which was defined in a interfcace.
0
 

Author Comment

by:ube100
ID: 35007993
As soon as I hit this line:

ResultCode leResultCode = moSearch.WebDedupeContact(ref lsErrorInfo, ref loIXMLDoc, lsFirstName + " " + lsLastName, "", "", "", "", "", "", Constants.IntelliSearch.MinimumMatchScore);
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 1000 total points
ID: 35008044
Check if one of your variables return null. I expect moSearch

(do you have somewhere in your code: YourType moSearch = new YourType())
0
 

Author Comment

by:ube100
ID: 35008116
yes,

moSearch has been initialized.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 35008138
Check all the other variables, fe ref lsErrorInfo, ref loIXMLDoc

Do you have that functions also in debug (perhaps there is an issue in that function)
0
 

Author Comment

by:ube100
ID: 35008280
I have check the moSearch and that is null when we executing it so what should look for?

 private iSearchSLX moSearch

public iSearchSLX Search
        {
            get
            {
                return moSearch;
            }
        }
This is how it's been created. This code is perfectly working code but I'm investigating something at the moment and propbably it is not creating the object under the condition I'm working? How do I find out about what causing it to not to create that object? Something to with Singleton pattern?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question