core icon indicating copy to clipboard operation
core copied to clipboard

Serialization error in .net core 2.0, same code was working in .net core 1.1

Open chintan3100 opened this issue 9 years ago • 6 comments

public class CustomClass { [Required] public System.Guid? clientId { get; set; } }

"\"bb2f3da7-bf79-4d14-9d54-0a1f7ff5f902\""

system.argumentexception Could not cast or convert from System.String to System.Guid. newtonsoft.json

at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)

chintan3100 avatar Sep 11 '17 21:09 chintan3100

I can not change client call who calling API with "\"bb2f3da7-bf79-4d14-9d54-0a1f7ff5f902\"". Client has code freeze.

chintan3100 avatar Sep 11 '17 21:09 chintan3100

Hi .net core 1.1 : When we return string from api it like "bb2f3da7-bf79-4d14-9d54-0a1f7ff5f902" .net core 2.0

"\"bb2f3da7-bf79-4d14-9d54-0a1f7ff5f902\""

chintan3100 avatar Sep 12 '17 06:09 chintan3100

@ViktorHofer @danmosemsft can you take a look?

Petermarcu avatar Sep 12 '17 15:09 Petermarcu

@chintan3100 I spent some time trying to reproduce your issue but I don't have enough information to understand what's going on here.

Please post a small reproduction code. I don't know which APIs you are using (even it they aren't .NET Core related but Json.NET).

ViktorHofer avatar Sep 12 '17 16:09 ViktorHofer

@ViktorHofer can you move this issue over to dotnet/corefx to track it?

Petermarcu avatar Oct 05 '17 23:10 Petermarcu

Issue moved to dotnet/corefx #24473 via ZenHub

ViktorHofer avatar Oct 06 '17 12:10 ViktorHofer