I have a Azure function(v1) which references a class library project(net46). I'm getting the following error while deserialising a json with in the class library.
Error resolving type specified in JSON 'Reporting.Services.CreationRequest, Reporting.Services'. Path '$type', line 1, position 103.
SchedulerService.cs (Part of class librray)
public async Task QueueReport(IList<ReportJob> reportJobs)
{
...
var _serializerSetting = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
reportCreationRequest = JsonConvert.DeserializeObject<ReportCreationRequest>(reportJob.JobQueueMessage, _serializerSetting);
...
}
Stack Trace:
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolveTypeName(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, String qualifiedTypeName)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadMetadataProperties(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue, Object& newValue, String& id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
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 Normandy.Portal.Reporting.Services.ReportingSchedulerV2.<QueueReportJobs>d__29.MoveNext() in C:\miis-source\Portal\src\Normandy.Portal.Reporting.Services\ReportingSchedulerV2.cs:line 436
Inner Exception: "Could not load assembly 'Reporting.Services'."
I have referenced this project in azure functions and also I can see this dll in Azure function's bin. But I still get this error. Any insights on this issue would be helpful.