I’m receiving an exception when using the CsvServiceClient but not the Json or Xml clients. The issue appears to be because I have a dictionary in my response DTO.
An exception of type 'System.IndexOutOfRangeException' occurred in ServiceStack.Client.dll but was not handled in user code
Additional information: Index was outside the bounds of the array.
My service
namespace ImplementSoap.ServiceInterface
{
public class MyServices : Service
{
public object Any(Hello request)
{
return new HelloResponse { Result = "Hello, {0}!".Fmt(request.Name) };
}
}
}
My DTOs
namespace ImplementSoap.ServiceModel
{
[DataContract]
[Route("/hello/{Name}")]
public class Hello : IReturn<HelloResponse>
{
[DataMember]
public string Name { get; set; }
}
[DataContract]
public class HelloResponse
{
[DataMember]
public string Result { get; set; }
[DataMember]
List<ComplexFlatObject> { get; set; }
[DataMember]
public Dictionary<string, string> CustomDict { get; set; }
}
}
My test
namespace ImplementSoap.Tests
{
[TestFixture]
public class MyServiceTests
{
[Test]
public void X_X_X()
{
using (var client = new CsvServiceClient("http://localhost:8088"))
{
Hello request = new Hello { Name = "Bob" };
var response = client.Get(request);
}
}
}
}