-1

I notice that if i send an array on webservice with array parameter, I encounter the unhandled errorexception but, when i send plain string, i could send the data on webservice with string parameter. I'd searched and follow the threads to pass the array but, it did not work. did i miss something?

click to open the image

client side:
LocalService.Service1Client a = new LocalService.Service1Client();

        LocalService.PersonalDetail[] Entity = new LocalService.PersonalDetail[1];
        LocalService.PersonalDetail Entity2 = null;

        Entity2 = new LocalService.PersonalDetail();
        Entity2.Firstname = "TEST";
        Entity2.Lastname = "TEST";
        Entity2.Middlename = "TEST";
        Entity2.CreatedDate = DateTime.Today;
        Entity[0] = Entity2;

        a.Open();
        Console.Write(a.GetLookOutList(Entity));
        a.Close();




wcf server side.
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetLookOutList(PersonalDetail[] obj);
}
public class Service1 : IService1
{
public string GetLookOutList(PersonalDetail[] obj)
    {
        IResponse Lol = new LookOutList(obj);
        return Lol.Response();
    }
}
    [DataContract(Name = "PersonalDetail")]
public class PersonalDetail
{

    [DataMember(Name = "Firstname")]
    public string Firstname
    { get; set; }

    [DataMember(Name = "Middlename")]
    public string Middlename
    { get; set; }

    [DataMember(Name = "Lastname")]
    public string Lastname
    { get; set; }


    [DataMember(Name = "CreatedDate")]
    public DateTime CreatedDate
    { get; set; }

    }
porknbeans
  • 43
  • 1
  • 8
  • 2
    You need to get your debugger running and find out the base exception that is causing your FaultException. – Paddy Jan 23 '16 at 07:47
  • @Paddy sorry i could not understand, you said i've got to look for the base exception.. do i have to look the "base.channel." ?? or should i click the "View Detail" that I've posted – porknbeans Jan 23 '16 at 08:03
  • The exception message has enough hints how to proceed further and find the error on your own. Did you even read it? – nvoigt Jan 23 '16 at 08:09
  • @nvoigt data: {System.Collections.ListDictionaryInternal} Keys:{System.Collections.ListDictionaryInternal.NodeKeyValueCollection} Values: {System.Collections.ListDictionaryInternal.NodeKeyValueCollection} – porknbeans Jan 23 '16 at 08:14
  • @nvoigt Fault: Reason: {The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.} – porknbeans Jan 23 '16 at 08:15
  • @porknbeans So, *did you* "either turn on IncludeExceptionDetailInFaults [..] or turn on tracing" ? – nvoigt Jan 23 '16 at 08:18
  • @nvoigt ok i set it to true... Additional information: Object reference not set to an instance of an object. Reason:{System.Collections.Generic.SynchronizedReadOnlyCollection} – porknbeans Jan 23 '16 at 08:24

1 Answers1

1
public string GetLookOutList(PersonalDetail[] obj)
{
    IResponse Lol = new LookOutList(obj);
    return Lol.Response();
}

One of those inner lines is throwing an exception.

To verify, try this:

public string GetLookOutList(PersonalDetail[] obj)
{
    return "TEST";
}

This will work.

Now you need to debug your code. Set a breakpoint to the first line IResponse Lol = new LookOutList(obj); and start the debugging process. You can find help on the specific exception you got here.

Community
  • 1
  • 1
nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • @nvgoit... ok this is embarassing.. your right it turns out that the var Lol had a problem... Thanks you just save my butt :D, ok i'll start now to re-code that function :) – porknbeans Jan 23 '16 at 09:02