Link to home
Start Free TrialLog in
Avatar of ube100
ube100Flag for United Kingdom of Great Britain and Northern Ireland

asked on

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

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?
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ube100

ASKER

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.
Avatar of ube100

ASKER

As soon as I hit this line:

ResultCode leResultCode = moSearch.WebDedupeContact(ref lsErrorInfo, ref loIXMLDoc, lsFirstName + " " + lsLastName, "", "", "", "", "", "", Constants.IntelliSearch.MinimumMatchScore);
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ube100

ASKER

yes,

moSearch has been initialized.
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)
Avatar of ube100

ASKER

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?