Problem deserializing using DTO - tfl.api.common not found


#1

Hi,

I’m new to the tfl api so I am just at the moment exploring. I’ve set up a cross-platform app in Visual Studio using Xamarin Forms and .net-standard 2.0, and I’m trying to deserialize some Json containing a stoppoint object.

I’m using the DTO that I have downloaded and referenced in my project, and Json.Net to handle the deserialization.

I am getting an exception when I try to deserialize with as follows:

{System.IO.FileNotFoundException: Could not load file or assembly ‘Tfl.Api.Common, Version=0.0.0.3978, Culture=neutral, PublicKeyToken=null’. The system cannot find the file specified.
File name: ‘Tfl.Api.Common, Version=0.0.0.3978, Culture=neutral, PublicKeyToken=null’
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParameters()
at Newtonsoft.Json.Serialization.DefaultContractResolver.GetCallbackMethodsForType(Type type, List1& onSerializing, List1& onSerialized, List1& onDeserializing, List1& onDeserialized, List`1& onError)
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveCallbackMethods(JsonContract contract, Type t)
at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract(JsonContract contract)
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at TodoREST.RestService.d__6.MoveNext()
}

The deserialization call is:

Items = JsonConvert.DeserializeObject<Tfl.Api.Presentation.Entities.StopPoint>(content, new JsonSerializerSettings
{
TraceWriter = traceWriter,
TypeNameHandling = TypeNameHandling.All
});

Am I missing something obvious?

Regards

Simon.