Hi.
I have wasted a whole day to figureout why my code fails. I am getting {“The method or operation is not implemented.”}. I am able to get serialized object with other IEnumeration object.
Couchbase community edition 2.2
.NET 4.5.1
IEnumerable Sdata = SensorRepository.DoorEventsRepository.GetAllByAlarms();
HttpResponseMessage Response = new HttpResponseMessage();
if (Sdata != null)
{
var JsonData = JsonConvert.SerializeObject(Sdata);// FAILS with error
StringContent SData = new StringContent(JsonData);
SData.Headers.ContentType = new MediaTypeHeaderValue("application/json");
Response.Content = SData;
}
else
{
Response.Content = new StringContent("Nothing");
}
Here is the complete error log:
System.NotImplementedException was unhandled by user code
HResult=-2147467263
Message=The method or operation is not implemented.
Source=Couchbase
StackTrace:
at Couchbase.CouchbaseViewBase1.System.Collections.IEnumerable.GetEnumerator() at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at LynxCouchBase.Controllers.RemoteLoginController.Sensors(FormDataCollection Value) in d:\Software_Projects\Project_files\WirelessProtocols\DataBase\LynxCouchBase\LynxCouchBase\Controllers\RemoteLoginController.cs:line 129 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary
2 arguments, CancellationToken cancellationToken)
InnerException:
Any help is much appreciated. I have given up on this.
-PP