From fc3fca830b0310882c2ddab857caea92e7546eec Mon Sep 17 00:00:00 2001 From: Steve Dunn Date: Tue, 30 Apr 2024 07:22:14 +0100 Subject: [PATCH 1/2] First pass --- .../Guid/Guid_SystemTextJsonConverter.cs | 11 +++-- tests/ConsumerTests/BugFixTests/BugFix581.cs | 34 +++++++++++++++ ...tjDeserializer_throws_correct_exception.cs | 43 +++++++++++++++++++ 3 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 tests/ConsumerTests/BugFixTests/BugFix581.cs create mode 100644 tests/SnapshotTests/BugFixes/Bug581_StjDeserializer_throws_correct_exception.cs diff --git a/src/Vogen/Templates/Guid/Guid_SystemTextJsonConverter.cs b/src/Vogen/Templates/Guid/Guid_SystemTextJsonConverter.cs index 9179031ed1..3f17800ce1 100644 --- a/src/Vogen/Templates/Guid/Guid_SystemTextJsonConverter.cs +++ b/src/Vogen/Templates/Guid/Guid_SystemTextJsonConverter.cs @@ -3,7 +3,7 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso { public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return VOTYPE.Deserialize(System.Guid.Parse(reader.GetString())); + return VOTYPE.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, VOTYPE value, global::System.Text.Json.JsonSerializerOptions options) @@ -11,10 +11,15 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, VOTYPE value, writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override VOTYPE ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return VOTYPE.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return VOTYPE.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of VOTYPE"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, VOTYPE value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/ConsumerTests/BugFixTests/BugFix581.cs b/tests/ConsumerTests/BugFixTests/BugFix581.cs new file mode 100644 index 0000000000..9285ddf308 --- /dev/null +++ b/tests/ConsumerTests/BugFixTests/BugFix581.cs @@ -0,0 +1,34 @@ +using System.Text.Json; + +namespace ConsumerTests.BugFixTests.BugFix581; + +public class ObjectContainerForVo +{ + public required ObjectType Ot { get; set; } +} + +[ValueObject(Conversions.Default)] +public readonly partial struct ObjectType +{ +} + +/// +/// Fixes bug https://github.com/SteveDunn/Vogen/issues/581 where GUIDs that are deserialized +/// with null, throw a NullReferenceException instead of System.Text.JsonException. +/// +public class Tests +{ + [Fact] + public void Should_throw_Stj_exception_with_null_passed() + { + Action a = () => JsonSerializer.Deserialize("""{"Ot":null}"""); + a.Should().ThrowExactly().WithMessage("The JSON value could not be converted to ConsumerTests.BugFixTests.BugFix581.ObjectType. Path: $.Ot | LineNumber: 0 | BytePositionInLine: 10."); + } + + [Fact] + public void Should_throw_Stj_exception_with_invalid_guid_passed() + { + Action a = () => JsonSerializer.Deserialize("""{"Ot":"Trevor woz ere"}"""); + a.Should().ThrowExactly().WithMessage("The JSON value could not be converted to ConsumerTests.BugFixTests.BugFix581.ObjectType. Path: $.Ot | LineNumber: 0 | BytePositionInLine: 22."); + } +} diff --git a/tests/SnapshotTests/BugFixes/Bug581_StjDeserializer_throws_correct_exception.cs b/tests/SnapshotTests/BugFixes/Bug581_StjDeserializer_throws_correct_exception.cs new file mode 100644 index 0000000000..498501e4c3 --- /dev/null +++ b/tests/SnapshotTests/BugFixes/Bug581_StjDeserializer_throws_correct_exception.cs @@ -0,0 +1,43 @@ +using System.Threading.Tasks; +using Shared; +using VerifyXunit; +using Vogen; + +namespace SnapshotTests.BugFixes; + +// See https://github.com/SteveDunn/Vogen/issues/581 +[UsesVerify] +public class Bug581_StjDeserializer_throws_correct_exception +{ + // The System.Text.Json converter called Guid.Parse, which in turn threw a NullReferenceException. + // It should now use Guid.TryParse and return an STJ exception. + // This test just verifies that the correct code is generated. The consumer tests verify the runtime + // behaviour. + [Fact] + public async Task Test() + { + var source = """ + + using System; + using Vogen; + using System.Text.Json; + + [ValueObject(typeof(Guid))] + public partial struct Vo + { + } + + + """; + + await RunTest(source); + } + + + private static Task RunTest(string source) => + new SnapshotRunner() + .WithSource(source) + .IgnoreInitialCompilationErrors() + .RunOnAllFrameworks(); + +} \ No newline at end of file From 8b90b5448f8184879f5b0c197c98ea1aca9bb8bf Mon Sep 17 00:00:00 2001 From: Steve Dunn Date: Tue, 30 Apr 2024 08:11:46 +0100 Subject: [PATCH 2/2] Updated snapshots --- ...throws_correct_exception.Test.verified.txt | 344 +++++++++++++++ ...throws_correct_exception.Test.verified.txt | 310 +++++++++++++ ...throws_correct_exception.Test.verified.txt | 310 +++++++++++++ ...throws_correct_exception.Test.verified.txt | 344 +++++++++++++++ ...throws_correct_exception.Test.verified.txt | 344 +++++++++++++++ ...throws_correct_exception.Test.verified.txt | 412 ++++++++++++++++++ ...throws_correct_exception.Test.verified.txt | 412 ++++++++++++++++++ .../snap-v3.1/01NnWIXrcn.verified.txt | 11 +- .../snap-v3.1/0TqwlvOnlT.verified.txt | 11 +- .../snap-v3.1/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v3.1/13cxXzX7TM.verified.txt | 11 +- .../snap-v3.1/1QFtVlpDn8.verified.txt | 11 +- .../snap-v3.1/2c0dGifBVP.verified.txt | 11 +- .../snap-v3.1/3Giiro8Q8a.verified.txt | 11 +- .../snap-v3.1/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v3.1/5BpY9bPVhd.verified.txt | 11 +- .../snap-v3.1/5oRtW5ow6k.verified.txt | 11 +- .../snap-v3.1/682UtC0nRt.verified.txt | 11 +- .../snap-v3.1/7VnqvOkqeY.verified.txt | 11 +- .../snap-v3.1/7fIqW0n1tE.verified.txt | 11 +- .../snap-v3.1/8SEUfvOnjd.verified.txt | 11 +- .../snap-v3.1/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v3.1/91n32T1eTx.verified.txt | 11 +- .../snap-v3.1/ASzheSCTPW.verified.txt | 11 +- .../snap-v3.1/CDaLgcRGEb.verified.txt | 11 +- .../snap-v3.1/Cxb5K2w4um.verified.txt | 11 +- .../snap-v3.1/D143iuJmQ9.verified.txt | 11 +- .../snap-v3.1/D5ti90Gtnc.verified.txt | 11 +- .../snap-v3.1/DoB0bQElXk.verified.txt | 11 +- .../snap-v3.1/EDRYu8H5Of.verified.txt | 11 +- .../snap-v3.1/EFai6tQHAL.verified.txt | 11 +- .../snap-v3.1/G4kzRbHutt.verified.txt | 11 +- .../snap-v3.1/Gf6nI9k93r.verified.txt | 11 +- .../snap-v3.1/GuO937nBp2.verified.txt | 11 +- .../snap-v3.1/GxLmdQIzuz.verified.txt | 11 +- .../snap-v3.1/HpOb1fz8q6.verified.txt | 11 +- .../snap-v3.1/IDHFkHqWK3.verified.txt | 11 +- .../snap-v3.1/IIUm0SlNvB.verified.txt | 11 +- .../snap-v3.1/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v3.1/IuELCZKXqm.verified.txt | 11 +- .../snap-v3.1/KfG1verOpN.verified.txt | 11 +- .../snap-v3.1/Kh16boKdpD.verified.txt | 11 +- .../snap-v3.1/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v3.1/LJFykMMPMi.verified.txt | 11 +- .../snap-v3.1/MZr4q8iotQ.verified.txt | 11 +- .../snap-v3.1/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v3.1/OYR7FJClTd.verified.txt | 11 +- .../snap-v3.1/PRIZHoHaqK.verified.txt | 11 +- .../snap-v3.1/PVKCOm5VKp.verified.txt | 11 +- .../snap-v3.1/SOyh0mHHcC.verified.txt | 11 +- .../snap-v3.1/TxZpwiB5Py.verified.txt | 11 +- .../snap-v3.1/UoYkE8YBpS.verified.txt | 11 +- .../snap-v3.1/W0HLD96mZV.verified.txt | 11 +- .../snap-v3.1/XPRo52TbpR.verified.txt | 11 +- .../snap-v3.1/XUcwhxLebL.verified.txt | 11 +- .../snap-v3.1/XreN72ITLR.verified.txt | 11 +- .../snap-v3.1/YbCUikIKwS.verified.txt | 11 +- .../snap-v3.1/azKU9DBVTH.verified.txt | 11 +- .../snap-v3.1/bY1HiMJXbA.verified.txt | 11 +- .../snap-v3.1/cKervgfNdC.verified.txt | 11 +- .../snap-v3.1/cgwp0MF0Co.verified.txt | 11 +- .../snap-v3.1/cxzejiZpAp.verified.txt | 11 +- .../snap-v3.1/cyUPie9s11.verified.txt | 11 +- .../snap-v3.1/dO4Vghni19.verified.txt | 11 +- .../snap-v3.1/dT6HjvXbRF.verified.txt | 11 +- .../snap-v3.1/dxWQFs9gJB.verified.txt | 11 +- .../snap-v3.1/edwx2bhfuH.verified.txt | 11 +- .../snap-v3.1/enQTvFpMic.verified.txt | 11 +- .../snap-v3.1/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v3.1/fHtz3V4XWi.verified.txt | 11 +- .../snap-v3.1/fLYsGHdYeN.verified.txt | 11 +- .../snap-v3.1/fx58SkLtj3.verified.txt | 11 +- .../snap-v3.1/gInCG5Y2j8.verified.txt | 11 +- .../snap-v3.1/hgqNJypuYE.verified.txt | 11 +- .../snap-v3.1/iy1QcvZOx2.verified.txt | 11 +- .../snap-v3.1/jrSWfblfeS.verified.txt | 11 +- .../snap-v3.1/k5WWxntUWB.verified.txt | 11 +- .../snap-v3.1/m4VqtM7gHq.verified.txt | 11 +- .../snap-v3.1/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v3.1/mLWPIS3yd2.verified.txt | 11 +- .../snap-v3.1/n7sHbRIXCw.verified.txt | 11 +- .../snap-v3.1/nF9y283Wqy.verified.txt | 11 +- .../snap-v3.1/nPDrj3Ap19.verified.txt | 11 +- .../snap-v3.1/oSvyQ6crWd.verified.txt | 11 +- .../snap-v3.1/p4S0UBmC7f.verified.txt | 11 +- .../snap-v3.1/pwXSeSrgmm.verified.txt | 11 +- .../snap-v3.1/tDpDS6XRtP.verified.txt | 11 +- .../snap-v3.1/vc8nR4GrUP.verified.txt | 11 +- .../snap-v3.1/x2F1RAj3hL.verified.txt | 11 +- .../snap-v3.1/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v3.1/y5C3WURWjE.verified.txt | 11 +- .../snap-v3.1/yFUY8IWQLx.verified.txt | 11 +- .../snap-v3.1/yXVwJLsc3o.verified.txt | 11 +- .../snap-v3.1/z5S8OyQMtF.verified.txt | 11 +- .../snap-v3.1/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v3.1/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v3.1/zywK4YpKwk.verified.txt | 11 +- .../snap-v4.6.1/01NnWIXrcn.verified.txt | 11 +- .../snap-v4.6.1/0TqwlvOnlT.verified.txt | 11 +- .../snap-v4.6.1/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v4.6.1/13cxXzX7TM.verified.txt | 11 +- .../snap-v4.6.1/1QFtVlpDn8.verified.txt | 11 +- .../snap-v4.6.1/2c0dGifBVP.verified.txt | 11 +- .../snap-v4.6.1/3Giiro8Q8a.verified.txt | 11 +- .../snap-v4.6.1/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v4.6.1/5BpY9bPVhd.verified.txt | 11 +- .../snap-v4.6.1/5oRtW5ow6k.verified.txt | 11 +- .../snap-v4.6.1/682UtC0nRt.verified.txt | 11 +- .../snap-v4.6.1/7VnqvOkqeY.verified.txt | 11 +- .../snap-v4.6.1/7fIqW0n1tE.verified.txt | 11 +- .../snap-v4.6.1/8SEUfvOnjd.verified.txt | 11 +- .../snap-v4.6.1/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v4.6.1/91n32T1eTx.verified.txt | 11 +- .../snap-v4.6.1/ASzheSCTPW.verified.txt | 11 +- .../snap-v4.6.1/CDaLgcRGEb.verified.txt | 11 +- .../snap-v4.6.1/Cxb5K2w4um.verified.txt | 11 +- .../snap-v4.6.1/D143iuJmQ9.verified.txt | 11 +- .../snap-v4.6.1/D5ti90Gtnc.verified.txt | 11 +- .../snap-v4.6.1/DoB0bQElXk.verified.txt | 11 +- .../snap-v4.6.1/EDRYu8H5Of.verified.txt | 11 +- .../snap-v4.6.1/EFai6tQHAL.verified.txt | 11 +- .../snap-v4.6.1/G4kzRbHutt.verified.txt | 11 +- .../snap-v4.6.1/Gf6nI9k93r.verified.txt | 11 +- .../snap-v4.6.1/GuO937nBp2.verified.txt | 11 +- .../snap-v4.6.1/GxLmdQIzuz.verified.txt | 11 +- .../snap-v4.6.1/HpOb1fz8q6.verified.txt | 11 +- .../snap-v4.6.1/IDHFkHqWK3.verified.txt | 11 +- .../snap-v4.6.1/IIUm0SlNvB.verified.txt | 11 +- .../snap-v4.6.1/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v4.6.1/IuELCZKXqm.verified.txt | 11 +- .../snap-v4.6.1/KfG1verOpN.verified.txt | 11 +- .../snap-v4.6.1/Kh16boKdpD.verified.txt | 11 +- .../snap-v4.6.1/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v4.6.1/LJFykMMPMi.verified.txt | 11 +- .../snap-v4.6.1/MZr4q8iotQ.verified.txt | 11 +- .../snap-v4.6.1/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v4.6.1/OYR7FJClTd.verified.txt | 11 +- .../snap-v4.6.1/PRIZHoHaqK.verified.txt | 11 +- .../snap-v4.6.1/PVKCOm5VKp.verified.txt | 11 +- .../snap-v4.6.1/SOyh0mHHcC.verified.txt | 11 +- .../snap-v4.6.1/TxZpwiB5Py.verified.txt | 11 +- .../snap-v4.6.1/UoYkE8YBpS.verified.txt | 11 +- .../snap-v4.6.1/W0HLD96mZV.verified.txt | 11 +- .../snap-v4.6.1/XPRo52TbpR.verified.txt | 11 +- .../snap-v4.6.1/XUcwhxLebL.verified.txt | 11 +- .../snap-v4.6.1/XreN72ITLR.verified.txt | 11 +- .../snap-v4.6.1/YbCUikIKwS.verified.txt | 11 +- .../snap-v4.6.1/azKU9DBVTH.verified.txt | 11 +- .../snap-v4.6.1/bY1HiMJXbA.verified.txt | 11 +- .../snap-v4.6.1/cKervgfNdC.verified.txt | 11 +- .../snap-v4.6.1/cgwp0MF0Co.verified.txt | 11 +- .../snap-v4.6.1/cxzejiZpAp.verified.txt | 11 +- .../snap-v4.6.1/cyUPie9s11.verified.txt | 11 +- .../snap-v4.6.1/dO4Vghni19.verified.txt | 11 +- .../snap-v4.6.1/dT6HjvXbRF.verified.txt | 11 +- .../snap-v4.6.1/dxWQFs9gJB.verified.txt | 11 +- .../snap-v4.6.1/edwx2bhfuH.verified.txt | 11 +- .../snap-v4.6.1/enQTvFpMic.verified.txt | 11 +- .../snap-v4.6.1/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v4.6.1/fHtz3V4XWi.verified.txt | 11 +- .../snap-v4.6.1/fLYsGHdYeN.verified.txt | 11 +- .../snap-v4.6.1/fx58SkLtj3.verified.txt | 11 +- .../snap-v4.6.1/gInCG5Y2j8.verified.txt | 11 +- .../snap-v4.6.1/hgqNJypuYE.verified.txt | 11 +- .../snap-v4.6.1/iy1QcvZOx2.verified.txt | 11 +- .../snap-v4.6.1/jrSWfblfeS.verified.txt | 11 +- .../snap-v4.6.1/k5WWxntUWB.verified.txt | 11 +- .../snap-v4.6.1/m4VqtM7gHq.verified.txt | 11 +- .../snap-v4.6.1/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v4.6.1/mLWPIS3yd2.verified.txt | 11 +- .../snap-v4.6.1/n7sHbRIXCw.verified.txt | 11 +- .../snap-v4.6.1/nF9y283Wqy.verified.txt | 11 +- .../snap-v4.6.1/nPDrj3Ap19.verified.txt | 11 +- .../snap-v4.6.1/oSvyQ6crWd.verified.txt | 11 +- .../snap-v4.6.1/p4S0UBmC7f.verified.txt | 11 +- .../snap-v4.6.1/pwXSeSrgmm.verified.txt | 11 +- .../snap-v4.6.1/tDpDS6XRtP.verified.txt | 11 +- .../snap-v4.6.1/vc8nR4GrUP.verified.txt | 11 +- .../snap-v4.6.1/x2F1RAj3hL.verified.txt | 11 +- .../snap-v4.6.1/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v4.6.1/y5C3WURWjE.verified.txt | 11 +- .../snap-v4.6.1/yFUY8IWQLx.verified.txt | 11 +- .../snap-v4.6.1/yXVwJLsc3o.verified.txt | 11 +- .../snap-v4.6.1/z5S8OyQMtF.verified.txt | 11 +- .../snap-v4.6.1/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v4.6.1/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v4.6.1/zywK4YpKwk.verified.txt | 11 +- .../snap-v4.8/01NnWIXrcn.verified.txt | 11 +- .../snap-v4.8/0TqwlvOnlT.verified.txt | 11 +- .../snap-v4.8/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v4.8/13cxXzX7TM.verified.txt | 11 +- .../snap-v4.8/1QFtVlpDn8.verified.txt | 11 +- .../snap-v4.8/2c0dGifBVP.verified.txt | 11 +- .../snap-v4.8/3Giiro8Q8a.verified.txt | 11 +- .../snap-v4.8/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v4.8/5BpY9bPVhd.verified.txt | 11 +- .../snap-v4.8/5oRtW5ow6k.verified.txt | 11 +- .../snap-v4.8/682UtC0nRt.verified.txt | 11 +- .../snap-v4.8/7VnqvOkqeY.verified.txt | 11 +- .../snap-v4.8/7fIqW0n1tE.verified.txt | 11 +- .../snap-v4.8/8SEUfvOnjd.verified.txt | 11 +- .../snap-v4.8/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v4.8/91n32T1eTx.verified.txt | 11 +- .../snap-v4.8/ASzheSCTPW.verified.txt | 11 +- .../snap-v4.8/CDaLgcRGEb.verified.txt | 11 +- .../snap-v4.8/Cxb5K2w4um.verified.txt | 11 +- .../snap-v4.8/D143iuJmQ9.verified.txt | 11 +- .../snap-v4.8/D5ti90Gtnc.verified.txt | 11 +- .../snap-v4.8/DoB0bQElXk.verified.txt | 11 +- .../snap-v4.8/EDRYu8H5Of.verified.txt | 11 +- .../snap-v4.8/EFai6tQHAL.verified.txt | 11 +- .../snap-v4.8/G4kzRbHutt.verified.txt | 11 +- .../snap-v4.8/Gf6nI9k93r.verified.txt | 11 +- .../snap-v4.8/GuO937nBp2.verified.txt | 11 +- .../snap-v4.8/GxLmdQIzuz.verified.txt | 11 +- .../snap-v4.8/HpOb1fz8q6.verified.txt | 11 +- .../snap-v4.8/IDHFkHqWK3.verified.txt | 11 +- .../snap-v4.8/IIUm0SlNvB.verified.txt | 11 +- .../snap-v4.8/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v4.8/IuELCZKXqm.verified.txt | 11 +- .../snap-v4.8/KfG1verOpN.verified.txt | 11 +- .../snap-v4.8/Kh16boKdpD.verified.txt | 11 +- .../snap-v4.8/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v4.8/LJFykMMPMi.verified.txt | 11 +- .../snap-v4.8/MZr4q8iotQ.verified.txt | 11 +- .../snap-v4.8/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v4.8/OYR7FJClTd.verified.txt | 11 +- .../snap-v4.8/PRIZHoHaqK.verified.txt | 11 +- .../snap-v4.8/PVKCOm5VKp.verified.txt | 11 +- .../snap-v4.8/SOyh0mHHcC.verified.txt | 11 +- .../snap-v4.8/TxZpwiB5Py.verified.txt | 11 +- .../snap-v4.8/UoYkE8YBpS.verified.txt | 11 +- .../snap-v4.8/W0HLD96mZV.verified.txt | 11 +- .../snap-v4.8/XPRo52TbpR.verified.txt | 11 +- .../snap-v4.8/XUcwhxLebL.verified.txt | 11 +- .../snap-v4.8/XreN72ITLR.verified.txt | 11 +- .../snap-v4.8/YbCUikIKwS.verified.txt | 11 +- .../snap-v4.8/azKU9DBVTH.verified.txt | 11 +- .../snap-v4.8/bY1HiMJXbA.verified.txt | 11 +- .../snap-v4.8/cKervgfNdC.verified.txt | 11 +- .../snap-v4.8/cgwp0MF0Co.verified.txt | 11 +- .../snap-v4.8/cxzejiZpAp.verified.txt | 11 +- .../snap-v4.8/cyUPie9s11.verified.txt | 11 +- .../snap-v4.8/dO4Vghni19.verified.txt | 11 +- .../snap-v4.8/dT6HjvXbRF.verified.txt | 11 +- .../snap-v4.8/dxWQFs9gJB.verified.txt | 11 +- .../snap-v4.8/edwx2bhfuH.verified.txt | 11 +- .../snap-v4.8/enQTvFpMic.verified.txt | 11 +- .../snap-v4.8/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v4.8/fHtz3V4XWi.verified.txt | 11 +- .../snap-v4.8/fLYsGHdYeN.verified.txt | 11 +- .../snap-v4.8/fx58SkLtj3.verified.txt | 11 +- .../snap-v4.8/gInCG5Y2j8.verified.txt | 11 +- .../snap-v4.8/hgqNJypuYE.verified.txt | 11 +- .../snap-v4.8/iy1QcvZOx2.verified.txt | 11 +- .../snap-v4.8/jrSWfblfeS.verified.txt | 11 +- .../snap-v4.8/k5WWxntUWB.verified.txt | 11 +- .../snap-v4.8/m4VqtM7gHq.verified.txt | 11 +- .../snap-v4.8/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v4.8/mLWPIS3yd2.verified.txt | 11 +- .../snap-v4.8/n7sHbRIXCw.verified.txt | 11 +- .../snap-v4.8/nF9y283Wqy.verified.txt | 11 +- .../snap-v4.8/nPDrj3Ap19.verified.txt | 11 +- .../snap-v4.8/oSvyQ6crWd.verified.txt | 11 +- .../snap-v4.8/p4S0UBmC7f.verified.txt | 11 +- .../snap-v4.8/pwXSeSrgmm.verified.txt | 11 +- .../snap-v4.8/tDpDS6XRtP.verified.txt | 11 +- .../snap-v4.8/vc8nR4GrUP.verified.txt | 11 +- .../snap-v4.8/x2F1RAj3hL.verified.txt | 11 +- .../snap-v4.8/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v4.8/y5C3WURWjE.verified.txt | 11 +- .../snap-v4.8/yFUY8IWQLx.verified.txt | 11 +- .../snap-v4.8/yXVwJLsc3o.verified.txt | 11 +- .../snap-v4.8/z5S8OyQMtF.verified.txt | 11 +- .../snap-v4.8/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v4.8/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v4.8/zywK4YpKwk.verified.txt | 11 +- .../snap-v5.0/01NnWIXrcn.verified.txt | 11 +- .../snap-v5.0/0TqwlvOnlT.verified.txt | 11 +- .../snap-v5.0/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v5.0/13cxXzX7TM.verified.txt | 11 +- .../snap-v5.0/1QFtVlpDn8.verified.txt | 11 +- .../snap-v5.0/2c0dGifBVP.verified.txt | 11 +- .../snap-v5.0/3Giiro8Q8a.verified.txt | 11 +- .../snap-v5.0/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v5.0/5BpY9bPVhd.verified.txt | 11 +- .../snap-v5.0/5oRtW5ow6k.verified.txt | 11 +- .../snap-v5.0/682UtC0nRt.verified.txt | 11 +- .../snap-v5.0/7VnqvOkqeY.verified.txt | 11 +- .../snap-v5.0/7fIqW0n1tE.verified.txt | 11 +- .../snap-v5.0/8SEUfvOnjd.verified.txt | 11 +- .../snap-v5.0/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v5.0/91n32T1eTx.verified.txt | 11 +- .../snap-v5.0/ASzheSCTPW.verified.txt | 11 +- .../snap-v5.0/CDaLgcRGEb.verified.txt | 11 +- .../snap-v5.0/Cxb5K2w4um.verified.txt | 11 +- .../snap-v5.0/D143iuJmQ9.verified.txt | 11 +- .../snap-v5.0/D5ti90Gtnc.verified.txt | 11 +- .../snap-v5.0/DoB0bQElXk.verified.txt | 11 +- .../snap-v5.0/EDRYu8H5Of.verified.txt | 11 +- .../snap-v5.0/EFai6tQHAL.verified.txt | 11 +- .../snap-v5.0/G4kzRbHutt.verified.txt | 11 +- .../snap-v5.0/Gf6nI9k93r.verified.txt | 11 +- .../snap-v5.0/GuO937nBp2.verified.txt | 11 +- .../snap-v5.0/GxLmdQIzuz.verified.txt | 11 +- .../snap-v5.0/HpOb1fz8q6.verified.txt | 11 +- .../snap-v5.0/IDHFkHqWK3.verified.txt | 11 +- .../snap-v5.0/IIUm0SlNvB.verified.txt | 11 +- .../snap-v5.0/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v5.0/IuELCZKXqm.verified.txt | 11 +- .../snap-v5.0/KfG1verOpN.verified.txt | 11 +- .../snap-v5.0/Kh16boKdpD.verified.txt | 11 +- .../snap-v5.0/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v5.0/LJFykMMPMi.verified.txt | 11 +- .../snap-v5.0/MZr4q8iotQ.verified.txt | 11 +- .../snap-v5.0/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v5.0/OYR7FJClTd.verified.txt | 11 +- .../snap-v5.0/PRIZHoHaqK.verified.txt | 11 +- .../snap-v5.0/PVKCOm5VKp.verified.txt | 11 +- .../snap-v5.0/SOyh0mHHcC.verified.txt | 11 +- .../snap-v5.0/TxZpwiB5Py.verified.txt | 11 +- .../snap-v5.0/UoYkE8YBpS.verified.txt | 11 +- .../snap-v5.0/W0HLD96mZV.verified.txt | 11 +- .../snap-v5.0/XPRo52TbpR.verified.txt | 11 +- .../snap-v5.0/XUcwhxLebL.verified.txt | 11 +- .../snap-v5.0/XreN72ITLR.verified.txt | 11 +- .../snap-v5.0/YbCUikIKwS.verified.txt | 11 +- .../snap-v5.0/azKU9DBVTH.verified.txt | 11 +- .../snap-v5.0/bY1HiMJXbA.verified.txt | 11 +- .../snap-v5.0/cKervgfNdC.verified.txt | 11 +- .../snap-v5.0/cgwp0MF0Co.verified.txt | 11 +- .../snap-v5.0/cxzejiZpAp.verified.txt | 11 +- .../snap-v5.0/cyUPie9s11.verified.txt | 11 +- .../snap-v5.0/dO4Vghni19.verified.txt | 11 +- .../snap-v5.0/dT6HjvXbRF.verified.txt | 11 +- .../snap-v5.0/dxWQFs9gJB.verified.txt | 11 +- .../snap-v5.0/edwx2bhfuH.verified.txt | 11 +- .../snap-v5.0/enQTvFpMic.verified.txt | 11 +- .../snap-v5.0/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v5.0/fHtz3V4XWi.verified.txt | 11 +- .../snap-v5.0/fLYsGHdYeN.verified.txt | 11 +- .../snap-v5.0/fx58SkLtj3.verified.txt | 11 +- .../snap-v5.0/gInCG5Y2j8.verified.txt | 11 +- .../snap-v5.0/hgqNJypuYE.verified.txt | 11 +- .../snap-v5.0/iy1QcvZOx2.verified.txt | 11 +- .../snap-v5.0/jrSWfblfeS.verified.txt | 11 +- .../snap-v5.0/k5WWxntUWB.verified.txt | 11 +- .../snap-v5.0/m4VqtM7gHq.verified.txt | 11 +- .../snap-v5.0/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v5.0/mLWPIS3yd2.verified.txt | 11 +- .../snap-v5.0/n7sHbRIXCw.verified.txt | 11 +- .../snap-v5.0/nF9y283Wqy.verified.txt | 11 +- .../snap-v5.0/nPDrj3Ap19.verified.txt | 11 +- .../snap-v5.0/oSvyQ6crWd.verified.txt | 11 +- .../snap-v5.0/p4S0UBmC7f.verified.txt | 11 +- .../snap-v5.0/pwXSeSrgmm.verified.txt | 11 +- .../snap-v5.0/tDpDS6XRtP.verified.txt | 11 +- .../snap-v5.0/vc8nR4GrUP.verified.txt | 11 +- .../snap-v5.0/x2F1RAj3hL.verified.txt | 11 +- .../snap-v5.0/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v5.0/y5C3WURWjE.verified.txt | 11 +- .../snap-v5.0/yFUY8IWQLx.verified.txt | 11 +- .../snap-v5.0/yXVwJLsc3o.verified.txt | 11 +- .../snap-v5.0/z5S8OyQMtF.verified.txt | 11 +- .../snap-v5.0/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v5.0/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v5.0/zywK4YpKwk.verified.txt | 11 +- .../snap-v6.0/01NnWIXrcn.verified.txt | 11 +- .../snap-v6.0/0TqwlvOnlT.verified.txt | 11 +- .../snap-v6.0/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v6.0/13cxXzX7TM.verified.txt | 11 +- .../snap-v6.0/1QFtVlpDn8.verified.txt | 11 +- .../snap-v6.0/2c0dGifBVP.verified.txt | 11 +- .../snap-v6.0/3Giiro8Q8a.verified.txt | 11 +- .../snap-v6.0/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v6.0/5BpY9bPVhd.verified.txt | 11 +- .../snap-v6.0/5oRtW5ow6k.verified.txt | 11 +- .../snap-v6.0/682UtC0nRt.verified.txt | 11 +- .../snap-v6.0/7VnqvOkqeY.verified.txt | 11 +- .../snap-v6.0/7fIqW0n1tE.verified.txt | 11 +- .../snap-v6.0/8SEUfvOnjd.verified.txt | 11 +- .../snap-v6.0/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v6.0/91n32T1eTx.verified.txt | 11 +- .../snap-v6.0/ASzheSCTPW.verified.txt | 11 +- .../snap-v6.0/CDaLgcRGEb.verified.txt | 11 +- .../snap-v6.0/Cxb5K2w4um.verified.txt | 11 +- .../snap-v6.0/D143iuJmQ9.verified.txt | 11 +- .../snap-v6.0/D5ti90Gtnc.verified.txt | 11 +- .../snap-v6.0/DoB0bQElXk.verified.txt | 11 +- .../snap-v6.0/EDRYu8H5Of.verified.txt | 11 +- .../snap-v6.0/EFai6tQHAL.verified.txt | 11 +- .../snap-v6.0/G4kzRbHutt.verified.txt | 11 +- .../snap-v6.0/Gf6nI9k93r.verified.txt | 11 +- .../snap-v6.0/GuO937nBp2.verified.txt | 11 +- .../snap-v6.0/GxLmdQIzuz.verified.txt | 11 +- .../snap-v6.0/HpOb1fz8q6.verified.txt | 11 +- .../snap-v6.0/IDHFkHqWK3.verified.txt | 11 +- .../snap-v6.0/IIUm0SlNvB.verified.txt | 11 +- .../snap-v6.0/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v6.0/IuELCZKXqm.verified.txt | 11 +- .../snap-v6.0/KfG1verOpN.verified.txt | 11 +- .../snap-v6.0/Kh16boKdpD.verified.txt | 11 +- .../snap-v6.0/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v6.0/LJFykMMPMi.verified.txt | 11 +- .../snap-v6.0/MZr4q8iotQ.verified.txt | 11 +- .../snap-v6.0/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v6.0/OYR7FJClTd.verified.txt | 11 +- .../snap-v6.0/PRIZHoHaqK.verified.txt | 11 +- .../snap-v6.0/PVKCOm5VKp.verified.txt | 11 +- .../snap-v6.0/SOyh0mHHcC.verified.txt | 11 +- .../snap-v6.0/TxZpwiB5Py.verified.txt | 11 +- .../snap-v6.0/UoYkE8YBpS.verified.txt | 11 +- .../snap-v6.0/W0HLD96mZV.verified.txt | 11 +- .../snap-v6.0/XPRo52TbpR.verified.txt | 11 +- .../snap-v6.0/XUcwhxLebL.verified.txt | 11 +- .../snap-v6.0/XreN72ITLR.verified.txt | 11 +- .../snap-v6.0/YbCUikIKwS.verified.txt | 11 +- .../snap-v6.0/azKU9DBVTH.verified.txt | 11 +- .../snap-v6.0/bY1HiMJXbA.verified.txt | 11 +- .../snap-v6.0/cKervgfNdC.verified.txt | 11 +- .../snap-v6.0/cgwp0MF0Co.verified.txt | 11 +- .../snap-v6.0/cxzejiZpAp.verified.txt | 11 +- .../snap-v6.0/cyUPie9s11.verified.txt | 11 +- .../snap-v6.0/dO4Vghni19.verified.txt | 11 +- .../snap-v6.0/dT6HjvXbRF.verified.txt | 11 +- .../snap-v6.0/dxWQFs9gJB.verified.txt | 11 +- .../snap-v6.0/edwx2bhfuH.verified.txt | 11 +- .../snap-v6.0/enQTvFpMic.verified.txt | 11 +- .../snap-v6.0/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v6.0/fHtz3V4XWi.verified.txt | 11 +- .../snap-v6.0/fLYsGHdYeN.verified.txt | 11 +- .../snap-v6.0/fx58SkLtj3.verified.txt | 11 +- .../snap-v6.0/gInCG5Y2j8.verified.txt | 11 +- .../snap-v6.0/hgqNJypuYE.verified.txt | 11 +- .../snap-v6.0/iy1QcvZOx2.verified.txt | 11 +- .../snap-v6.0/jrSWfblfeS.verified.txt | 11 +- .../snap-v6.0/k5WWxntUWB.verified.txt | 11 +- .../snap-v6.0/m4VqtM7gHq.verified.txt | 11 +- .../snap-v6.0/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v6.0/mLWPIS3yd2.verified.txt | 11 +- .../snap-v6.0/n7sHbRIXCw.verified.txt | 11 +- .../snap-v6.0/nF9y283Wqy.verified.txt | 11 +- .../snap-v6.0/nPDrj3Ap19.verified.txt | 11 +- .../snap-v6.0/oSvyQ6crWd.verified.txt | 11 +- .../snap-v6.0/p4S0UBmC7f.verified.txt | 11 +- .../snap-v6.0/pwXSeSrgmm.verified.txt | 11 +- .../snap-v6.0/tDpDS6XRtP.verified.txt | 11 +- .../snap-v6.0/vc8nR4GrUP.verified.txt | 11 +- .../snap-v6.0/x2F1RAj3hL.verified.txt | 11 +- .../snap-v6.0/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v6.0/y5C3WURWjE.verified.txt | 11 +- .../snap-v6.0/yFUY8IWQLx.verified.txt | 11 +- .../snap-v6.0/yXVwJLsc3o.verified.txt | 11 +- .../snap-v6.0/z5S8OyQMtF.verified.txt | 11 +- .../snap-v6.0/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v6.0/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v6.0/zywK4YpKwk.verified.txt | 11 +- .../snap-v7.0/01NnWIXrcn.verified.txt | 11 +- .../snap-v7.0/0TqwlvOnlT.verified.txt | 11 +- .../snap-v7.0/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v7.0/13cxXzX7TM.verified.txt | 11 +- .../snap-v7.0/1QFtVlpDn8.verified.txt | 11 +- .../snap-v7.0/2c0dGifBVP.verified.txt | 11 +- .../snap-v7.0/3Giiro8Q8a.verified.txt | 11 +- .../snap-v7.0/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v7.0/5BpY9bPVhd.verified.txt | 11 +- .../snap-v7.0/5oRtW5ow6k.verified.txt | 11 +- .../snap-v7.0/682UtC0nRt.verified.txt | 11 +- .../snap-v7.0/7VnqvOkqeY.verified.txt | 11 +- .../snap-v7.0/7fIqW0n1tE.verified.txt | 11 +- .../snap-v7.0/8SEUfvOnjd.verified.txt | 11 +- .../snap-v7.0/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v7.0/91n32T1eTx.verified.txt | 11 +- .../snap-v7.0/ASzheSCTPW.verified.txt | 11 +- .../snap-v7.0/CDaLgcRGEb.verified.txt | 11 +- .../snap-v7.0/Cxb5K2w4um.verified.txt | 11 +- .../snap-v7.0/D143iuJmQ9.verified.txt | 11 +- .../snap-v7.0/D5ti90Gtnc.verified.txt | 11 +- .../snap-v7.0/DoB0bQElXk.verified.txt | 11 +- .../snap-v7.0/EDRYu8H5Of.verified.txt | 11 +- .../snap-v7.0/EFai6tQHAL.verified.txt | 11 +- .../snap-v7.0/G4kzRbHutt.verified.txt | 11 +- .../snap-v7.0/Gf6nI9k93r.verified.txt | 11 +- .../snap-v7.0/GuO937nBp2.verified.txt | 11 +- .../snap-v7.0/GxLmdQIzuz.verified.txt | 11 +- .../snap-v7.0/HpOb1fz8q6.verified.txt | 11 +- .../snap-v7.0/IDHFkHqWK3.verified.txt | 11 +- .../snap-v7.0/IIUm0SlNvB.verified.txt | 11 +- .../snap-v7.0/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v7.0/IuELCZKXqm.verified.txt | 11 +- .../snap-v7.0/KfG1verOpN.verified.txt | 11 +- .../snap-v7.0/Kh16boKdpD.verified.txt | 11 +- .../snap-v7.0/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v7.0/LJFykMMPMi.verified.txt | 11 +- .../snap-v7.0/MZr4q8iotQ.verified.txt | 11 +- .../snap-v7.0/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v7.0/OYR7FJClTd.verified.txt | 11 +- .../snap-v7.0/PRIZHoHaqK.verified.txt | 11 +- .../snap-v7.0/PVKCOm5VKp.verified.txt | 11 +- .../snap-v7.0/SOyh0mHHcC.verified.txt | 11 +- .../snap-v7.0/TxZpwiB5Py.verified.txt | 11 +- .../snap-v7.0/UoYkE8YBpS.verified.txt | 11 +- .../snap-v7.0/W0HLD96mZV.verified.txt | 11 +- .../snap-v7.0/XPRo52TbpR.verified.txt | 11 +- .../snap-v7.0/XUcwhxLebL.verified.txt | 11 +- .../snap-v7.0/XreN72ITLR.verified.txt | 11 +- .../snap-v7.0/YbCUikIKwS.verified.txt | 11 +- .../snap-v7.0/azKU9DBVTH.verified.txt | 11 +- .../snap-v7.0/bY1HiMJXbA.verified.txt | 11 +- .../snap-v7.0/cKervgfNdC.verified.txt | 11 +- .../snap-v7.0/cgwp0MF0Co.verified.txt | 11 +- .../snap-v7.0/cxzejiZpAp.verified.txt | 11 +- .../snap-v7.0/cyUPie9s11.verified.txt | 11 +- .../snap-v7.0/dO4Vghni19.verified.txt | 11 +- .../snap-v7.0/dT6HjvXbRF.verified.txt | 11 +- .../snap-v7.0/dxWQFs9gJB.verified.txt | 11 +- .../snap-v7.0/edwx2bhfuH.verified.txt | 11 +- .../snap-v7.0/enQTvFpMic.verified.txt | 11 +- .../snap-v7.0/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v7.0/fHtz3V4XWi.verified.txt | 11 +- .../snap-v7.0/fLYsGHdYeN.verified.txt | 11 +- .../snap-v7.0/fx58SkLtj3.verified.txt | 11 +- .../snap-v7.0/gInCG5Y2j8.verified.txt | 11 +- .../snap-v7.0/hgqNJypuYE.verified.txt | 11 +- .../snap-v7.0/iy1QcvZOx2.verified.txt | 11 +- .../snap-v7.0/jrSWfblfeS.verified.txt | 11 +- .../snap-v7.0/k5WWxntUWB.verified.txt | 11 +- .../snap-v7.0/m4VqtM7gHq.verified.txt | 11 +- .../snap-v7.0/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v7.0/mLWPIS3yd2.verified.txt | 11 +- .../snap-v7.0/n7sHbRIXCw.verified.txt | 11 +- .../snap-v7.0/nF9y283Wqy.verified.txt | 11 +- .../snap-v7.0/nPDrj3Ap19.verified.txt | 11 +- .../snap-v7.0/oSvyQ6crWd.verified.txt | 11 +- .../snap-v7.0/p4S0UBmC7f.verified.txt | 11 +- .../snap-v7.0/pwXSeSrgmm.verified.txt | 11 +- .../snap-v7.0/tDpDS6XRtP.verified.txt | 11 +- .../snap-v7.0/vc8nR4GrUP.verified.txt | 11 +- .../snap-v7.0/x2F1RAj3hL.verified.txt | 11 +- .../snap-v7.0/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v7.0/y5C3WURWjE.verified.txt | 11 +- .../snap-v7.0/yFUY8IWQLx.verified.txt | 11 +- .../snap-v7.0/yXVwJLsc3o.verified.txt | 11 +- .../snap-v7.0/z5S8OyQMtF.verified.txt | 11 +- .../snap-v7.0/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v7.0/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v7.0/zywK4YpKwk.verified.txt | 11 +- .../snap-v8.0/01NnWIXrcn.verified.txt | 11 +- .../snap-v8.0/0TqwlvOnlT.verified.txt | 11 +- .../snap-v8.0/0ZNAfNWlkE.verified.txt | 11 +- .../snap-v8.0/13cxXzX7TM.verified.txt | 11 +- .../snap-v8.0/1QFtVlpDn8.verified.txt | 11 +- .../snap-v8.0/2c0dGifBVP.verified.txt | 11 +- .../snap-v8.0/3Giiro8Q8a.verified.txt | 11 +- .../snap-v8.0/3pXLwxOlTQ.verified.txt | 11 +- .../snap-v8.0/5BpY9bPVhd.verified.txt | 11 +- .../snap-v8.0/5oRtW5ow6k.verified.txt | 11 +- .../snap-v8.0/682UtC0nRt.verified.txt | 11 +- .../snap-v8.0/7VnqvOkqeY.verified.txt | 11 +- .../snap-v8.0/7fIqW0n1tE.verified.txt | 11 +- .../snap-v8.0/8SEUfvOnjd.verified.txt | 11 +- .../snap-v8.0/8TzJ6T6Go9.verified.txt | 11 +- .../snap-v8.0/91n32T1eTx.verified.txt | 11 +- .../snap-v8.0/ASzheSCTPW.verified.txt | 11 +- .../snap-v8.0/CDaLgcRGEb.verified.txt | 11 +- .../snap-v8.0/Cxb5K2w4um.verified.txt | 11 +- .../snap-v8.0/D143iuJmQ9.verified.txt | 11 +- .../snap-v8.0/D5ti90Gtnc.verified.txt | 11 +- .../snap-v8.0/DoB0bQElXk.verified.txt | 11 +- .../snap-v8.0/EDRYu8H5Of.verified.txt | 11 +- .../snap-v8.0/EFai6tQHAL.verified.txt | 11 +- .../snap-v8.0/G4kzRbHutt.verified.txt | 11 +- .../snap-v8.0/Gf6nI9k93r.verified.txt | 11 +- .../snap-v8.0/GuO937nBp2.verified.txt | 11 +- .../snap-v8.0/GxLmdQIzuz.verified.txt | 11 +- .../snap-v8.0/HpOb1fz8q6.verified.txt | 11 +- .../snap-v8.0/IDHFkHqWK3.verified.txt | 11 +- .../snap-v8.0/IIUm0SlNvB.verified.txt | 11 +- .../snap-v8.0/Ia8sjkIOlf.verified.txt | 11 +- .../snap-v8.0/IuELCZKXqm.verified.txt | 11 +- .../snap-v8.0/KfG1verOpN.verified.txt | 11 +- .../snap-v8.0/Kh16boKdpD.verified.txt | 11 +- .../snap-v8.0/LFYfYZrpoJ.verified.txt | 11 +- .../snap-v8.0/LJFykMMPMi.verified.txt | 11 +- .../snap-v8.0/MZr4q8iotQ.verified.txt | 11 +- .../snap-v8.0/O5ZNrTYaVI.verified.txt | 11 +- .../snap-v8.0/OYR7FJClTd.verified.txt | 11 +- .../snap-v8.0/PRIZHoHaqK.verified.txt | 11 +- .../snap-v8.0/PVKCOm5VKp.verified.txt | 11 +- .../snap-v8.0/SOyh0mHHcC.verified.txt | 11 +- .../snap-v8.0/TxZpwiB5Py.verified.txt | 11 +- .../snap-v8.0/UoYkE8YBpS.verified.txt | 11 +- .../snap-v8.0/W0HLD96mZV.verified.txt | 11 +- .../snap-v8.0/XPRo52TbpR.verified.txt | 11 +- .../snap-v8.0/XUcwhxLebL.verified.txt | 11 +- .../snap-v8.0/XreN72ITLR.verified.txt | 11 +- .../snap-v8.0/YbCUikIKwS.verified.txt | 11 +- .../snap-v8.0/azKU9DBVTH.verified.txt | 11 +- .../snap-v8.0/bY1HiMJXbA.verified.txt | 11 +- .../snap-v8.0/cKervgfNdC.verified.txt | 11 +- .../snap-v8.0/cgwp0MF0Co.verified.txt | 11 +- .../snap-v8.0/cxzejiZpAp.verified.txt | 11 +- .../snap-v8.0/cyUPie9s11.verified.txt | 11 +- .../snap-v8.0/dO4Vghni19.verified.txt | 11 +- .../snap-v8.0/dT6HjvXbRF.verified.txt | 11 +- .../snap-v8.0/dxWQFs9gJB.verified.txt | 11 +- .../snap-v8.0/edwx2bhfuH.verified.txt | 11 +- .../snap-v8.0/enQTvFpMic.verified.txt | 11 +- .../snap-v8.0/fDkjh4YHqJ.verified.txt | 11 +- .../snap-v8.0/fHtz3V4XWi.verified.txt | 11 +- .../snap-v8.0/fLYsGHdYeN.verified.txt | 11 +- .../snap-v8.0/fx58SkLtj3.verified.txt | 11 +- .../snap-v8.0/gInCG5Y2j8.verified.txt | 11 +- .../snap-v8.0/hgqNJypuYE.verified.txt | 11 +- .../snap-v8.0/iy1QcvZOx2.verified.txt | 11 +- .../snap-v8.0/jrSWfblfeS.verified.txt | 11 +- .../snap-v8.0/k5WWxntUWB.verified.txt | 11 +- .../snap-v8.0/m4VqtM7gHq.verified.txt | 11 +- .../snap-v8.0/m6vtJ9zTfv.verified.txt | 11 +- .../snap-v8.0/mLWPIS3yd2.verified.txt | 11 +- .../snap-v8.0/n7sHbRIXCw.verified.txt | 11 +- .../snap-v8.0/nF9y283Wqy.verified.txt | 11 +- .../snap-v8.0/nPDrj3Ap19.verified.txt | 11 +- .../snap-v8.0/oSvyQ6crWd.verified.txt | 11 +- .../snap-v8.0/p4S0UBmC7f.verified.txt | 11 +- .../snap-v8.0/pwXSeSrgmm.verified.txt | 11 +- .../snap-v8.0/tDpDS6XRtP.verified.txt | 11 +- .../snap-v8.0/vc8nR4GrUP.verified.txt | 11 +- .../snap-v8.0/x2F1RAj3hL.verified.txt | 11 +- .../snap-v8.0/xwYCR0Gs5t.verified.txt | 11 +- .../snap-v8.0/y5C3WURWjE.verified.txt | 11 +- .../snap-v8.0/yFUY8IWQLx.verified.txt | 11 +- .../snap-v8.0/yXVwJLsc3o.verified.txt | 11 +- .../snap-v8.0/z5S8OyQMtF.verified.txt | 11 +- .../snap-v8.0/zsJ2xp8fo3.verified.txt | 11 +- .../snap-v8.0/zu9CrZv1Ao.verified.txt | 11 +- .../snap-v8.0/zywK4YpKwk.verified.txt | 11 +- .../snap-v3.1/0cYyKKliLi.verified.txt | 11 +- .../snap-v3.1/1Gygdbr2wW.verified.txt | 11 +- .../snap-v3.1/J4tSgchMka.verified.txt | 11 +- .../snap-v3.1/KJPjvG0arG.verified.txt | 11 +- .../snap-v3.1/PjznyCEcyT.verified.txt | 11 +- .../snap-v3.1/T2IPxePmFw.verified.txt | 11 +- .../snap-v3.1/U96pXPofm8.verified.txt | 11 +- .../snap-v3.1/UEfkRp8KdV.verified.txt | 11 +- .../snap-v3.1/auNphZdY5K.verified.txt | 11 +- .../snap-v3.1/pDASd72XIk.verified.txt | 11 +- .../snap-v4.6.1/0cYyKKliLi.verified.txt | 11 +- .../snap-v4.6.1/1Gygdbr2wW.verified.txt | 11 +- .../snap-v4.6.1/J4tSgchMka.verified.txt | 11 +- .../snap-v4.6.1/KJPjvG0arG.verified.txt | 11 +- .../snap-v4.6.1/PjznyCEcyT.verified.txt | 11 +- .../snap-v4.6.1/T2IPxePmFw.verified.txt | 11 +- .../snap-v4.6.1/U96pXPofm8.verified.txt | 11 +- .../snap-v4.6.1/UEfkRp8KdV.verified.txt | 11 +- .../snap-v4.6.1/auNphZdY5K.verified.txt | 11 +- .../snap-v4.6.1/pDASd72XIk.verified.txt | 11 +- .../snap-v4.8/0cYyKKliLi.verified.txt | 11 +- .../snap-v4.8/1Gygdbr2wW.verified.txt | 11 +- .../snap-v4.8/J4tSgchMka.verified.txt | 11 +- .../snap-v4.8/KJPjvG0arG.verified.txt | 11 +- .../snap-v4.8/PjznyCEcyT.verified.txt | 11 +- .../snap-v4.8/T2IPxePmFw.verified.txt | 11 +- .../snap-v4.8/U96pXPofm8.verified.txt | 11 +- .../snap-v4.8/UEfkRp8KdV.verified.txt | 11 +- .../snap-v4.8/auNphZdY5K.verified.txt | 11 +- .../snap-v4.8/pDASd72XIk.verified.txt | 11 +- .../snap-v5.0/0cYyKKliLi.verified.txt | 11 +- .../snap-v5.0/1Gygdbr2wW.verified.txt | 11 +- .../snap-v5.0/J4tSgchMka.verified.txt | 11 +- .../snap-v5.0/KJPjvG0arG.verified.txt | 11 +- .../snap-v5.0/PjznyCEcyT.verified.txt | 11 +- .../snap-v5.0/T2IPxePmFw.verified.txt | 11 +- .../snap-v5.0/U96pXPofm8.verified.txt | 11 +- .../snap-v5.0/UEfkRp8KdV.verified.txt | 11 +- .../snap-v5.0/auNphZdY5K.verified.txt | 11 +- .../snap-v5.0/pDASd72XIk.verified.txt | 11 +- .../snap-v6.0/0cYyKKliLi.verified.txt | 11 +- .../snap-v6.0/1Gygdbr2wW.verified.txt | 11 +- .../snap-v6.0/J4tSgchMka.verified.txt | 11 +- .../snap-v6.0/KJPjvG0arG.verified.txt | 11 +- .../snap-v6.0/PjznyCEcyT.verified.txt | 11 +- .../snap-v6.0/T2IPxePmFw.verified.txt | 11 +- .../snap-v6.0/U96pXPofm8.verified.txt | 11 +- .../snap-v6.0/UEfkRp8KdV.verified.txt | 11 +- .../snap-v6.0/auNphZdY5K.verified.txt | 11 +- .../snap-v6.0/pDASd72XIk.verified.txt | 11 +- .../snap-v7.0/0cYyKKliLi.verified.txt | 11 +- .../snap-v7.0/1Gygdbr2wW.verified.txt | 11 +- .../snap-v7.0/J4tSgchMka.verified.txt | 11 +- .../snap-v7.0/KJPjvG0arG.verified.txt | 11 +- .../snap-v7.0/PjznyCEcyT.verified.txt | 11 +- .../snap-v7.0/T2IPxePmFw.verified.txt | 11 +- .../snap-v7.0/U96pXPofm8.verified.txt | 11 +- .../snap-v7.0/UEfkRp8KdV.verified.txt | 11 +- .../snap-v7.0/auNphZdY5K.verified.txt | 11 +- .../snap-v7.0/pDASd72XIk.verified.txt | 11 +- .../snap-v8.0/0cYyKKliLi.verified.txt | 11 +- .../snap-v8.0/1Gygdbr2wW.verified.txt | 11 +- .../snap-v8.0/J4tSgchMka.verified.txt | 11 +- .../snap-v8.0/KJPjvG0arG.verified.txt | 11 +- .../snap-v8.0/PjznyCEcyT.verified.txt | 11 +- .../snap-v8.0/T2IPxePmFw.verified.txt | 11 +- .../snap-v8.0/U96pXPofm8.verified.txt | 11 +- .../snap-v8.0/UEfkRp8KdV.verified.txt | 11 +- .../snap-v8.0/auNphZdY5K.verified.txt | 11 +- .../snap-v8.0/pDASd72XIk.verified.txt | 11 +- .../snap-v3.1/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v3.1/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v3.1/jXZ79bcjc9.verified.txt | 11 +- .../snap-v3.1/r69L6MTLWN.verified.txt | 11 +- .../snap-v4.6.1/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v4.6.1/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v4.6.1/jXZ79bcjc9.verified.txt | 11 +- .../snap-v4.6.1/r69L6MTLWN.verified.txt | 11 +- .../snap-v4.8/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v4.8/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v4.8/jXZ79bcjc9.verified.txt | 11 +- .../snap-v4.8/r69L6MTLWN.verified.txt | 11 +- .../snap-v5.0/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v5.0/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v5.0/jXZ79bcjc9.verified.txt | 11 +- .../snap-v5.0/r69L6MTLWN.verified.txt | 11 +- .../snap-v6.0/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v6.0/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v6.0/jXZ79bcjc9.verified.txt | 11 +- .../snap-v6.0/r69L6MTLWN.verified.txt | 11 +- .../snap-v7.0/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v7.0/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v7.0/jXZ79bcjc9.verified.txt | 11 +- .../snap-v7.0/r69L6MTLWN.verified.txt | 11 +- .../snap-v8.0/0Rjlo8wVsY.verified.txt | 11 +- .../snap-v8.0/LZDZ0jdOF6.verified.txt | 11 +- .../snap-v8.0/jXZ79bcjc9.verified.txt | 11 +- .../snap-v8.0/r69L6MTLWN.verified.txt | 11 +- .../snap-v3.1-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v3.1-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v3.1-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v3.1-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v3.1-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v3.1-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v3.1-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v3.1-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v3.1-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v3.1-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v3.1-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v3.1-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v3.1-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v3.1-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v3.1-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v3.1-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v3.1-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v3.1-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v3.1-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v3.1-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v3.1-us/18luqBmqNm.verified.txt | 11 +- .../snap-v3.1-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v3.1-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v3.1-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v3.1-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v3.1-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v3.1-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v3.1-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v3.1-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v3.1-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v3.1-us/S6kTKimLen.verified.txt | 11 +- .../snap-v3.1-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v3.1-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v3.1-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v3.1-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v3.1-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v3.1-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v3.1-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v3.1-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v3.1-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v3.1/18luqBmqNm.verified.txt | 11 +- .../snap-v3.1/6w1vPiY8I8.verified.txt | 11 +- .../snap-v3.1/7HwoUhfzjA.verified.txt | 11 +- .../snap-v3.1/FaNpjhWJnp.verified.txt | 11 +- .../snap-v3.1/GFR12F2PgU.verified.txt | 11 +- .../snap-v3.1/GGYsXO7NgY.verified.txt | 11 +- .../snap-v3.1/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v3.1/PvSh3xfKNr.verified.txt | 11 +- .../snap-v3.1/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v3.1/Q8OFEgFlen.verified.txt | 11 +- .../snap-v3.1/S6kTKimLen.verified.txt | 11 +- .../snap-v3.1/Thad6nEDD5.verified.txt | 11 +- .../snap-v3.1/Uhx1npmK9K.verified.txt | 11 +- .../snap-v3.1/WMVLzBfTuM.verified.txt | 11 +- .../snap-v3.1/bkRaWa4KBI.verified.txt | 11 +- .../snap-v3.1/iS1nna8CAC.verified.txt | 11 +- .../snap-v3.1/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v3.1/o2otLTg8Vl.verified.txt | 11 +- .../snap-v3.1/oQTi0amgPS.verified.txt | 11 +- .../snap-v3.1/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v4.6.1-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v4.6.1-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v4.6.1-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v4.6.1-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v4.6.1-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v4.6.1-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v4.6.1-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v4.6.1-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v4.6.1-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v4.6.1-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v4.6.1-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v4.6.1-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v4.6.1-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v4.6.1-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v4.6.1-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v4.6.1-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v4.6.1-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v4.6.1-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v4.6.1-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v4.6.1-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v4.6.1-us/18luqBmqNm.verified.txt | 11 +- .../snap-v4.6.1-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v4.6.1-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v4.6.1-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v4.6.1-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v4.6.1-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v4.6.1-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v4.6.1-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v4.6.1-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v4.6.1-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v4.6.1-us/S6kTKimLen.verified.txt | 11 +- .../snap-v4.6.1-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v4.6.1-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v4.6.1-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v4.6.1-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v4.6.1-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v4.6.1-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v4.6.1-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v4.6.1-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v4.6.1-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v4.6.1/18luqBmqNm.verified.txt | 11 +- .../snap-v4.6.1/6w1vPiY8I8.verified.txt | 11 +- .../snap-v4.6.1/7HwoUhfzjA.verified.txt | 11 +- .../snap-v4.6.1/FaNpjhWJnp.verified.txt | 11 +- .../snap-v4.6.1/GFR12F2PgU.verified.txt | 11 +- .../snap-v4.6.1/GGYsXO7NgY.verified.txt | 11 +- .../snap-v4.6.1/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v4.6.1/PvSh3xfKNr.verified.txt | 11 +- .../snap-v4.6.1/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v4.6.1/Q8OFEgFlen.verified.txt | 11 +- .../snap-v4.6.1/S6kTKimLen.verified.txt | 11 +- .../snap-v4.6.1/Thad6nEDD5.verified.txt | 11 +- .../snap-v4.6.1/Uhx1npmK9K.verified.txt | 11 +- .../snap-v4.6.1/WMVLzBfTuM.verified.txt | 11 +- .../snap-v4.6.1/bkRaWa4KBI.verified.txt | 11 +- .../snap-v4.6.1/iS1nna8CAC.verified.txt | 11 +- .../snap-v4.6.1/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v4.6.1/o2otLTg8Vl.verified.txt | 11 +- .../snap-v4.6.1/oQTi0amgPS.verified.txt | 11 +- .../snap-v4.6.1/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v4.8-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v4.8-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v4.8-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v4.8-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v4.8-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v4.8-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v4.8-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v4.8-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v4.8-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v4.8-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v4.8-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v4.8-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v4.8-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v4.8-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v4.8-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v4.8-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v4.8-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v4.8-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v4.8-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v4.8-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v4.8-us/18luqBmqNm.verified.txt | 11 +- .../snap-v4.8-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v4.8-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v4.8-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v4.8-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v4.8-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v4.8-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v4.8-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v4.8-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v4.8-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v4.8-us/S6kTKimLen.verified.txt | 11 +- .../snap-v4.8-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v4.8-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v4.8-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v4.8-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v4.8-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v4.8-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v4.8-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v4.8-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v4.8-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v4.8/18luqBmqNm.verified.txt | 11 +- .../snap-v4.8/6w1vPiY8I8.verified.txt | 11 +- .../snap-v4.8/7HwoUhfzjA.verified.txt | 11 +- .../snap-v4.8/FaNpjhWJnp.verified.txt | 11 +- .../snap-v4.8/GFR12F2PgU.verified.txt | 11 +- .../snap-v4.8/GGYsXO7NgY.verified.txt | 11 +- .../snap-v4.8/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v4.8/PvSh3xfKNr.verified.txt | 11 +- .../snap-v4.8/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v4.8/Q8OFEgFlen.verified.txt | 11 +- .../snap-v4.8/S6kTKimLen.verified.txt | 11 +- .../snap-v4.8/Thad6nEDD5.verified.txt | 11 +- .../snap-v4.8/Uhx1npmK9K.verified.txt | 11 +- .../snap-v4.8/WMVLzBfTuM.verified.txt | 11 +- .../snap-v4.8/bkRaWa4KBI.verified.txt | 11 +- .../snap-v4.8/iS1nna8CAC.verified.txt | 11 +- .../snap-v4.8/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v4.8/o2otLTg8Vl.verified.txt | 11 +- .../snap-v4.8/oQTi0amgPS.verified.txt | 11 +- .../snap-v4.8/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v5.0-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v5.0-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v5.0-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v5.0-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v5.0-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v5.0-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v5.0-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v5.0-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v5.0-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v5.0-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v5.0-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v5.0-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v5.0-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v5.0-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v5.0-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v5.0-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v5.0-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v5.0-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v5.0-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v5.0-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v5.0-us/18luqBmqNm.verified.txt | 11 +- .../snap-v5.0-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v5.0-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v5.0-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v5.0-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v5.0-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v5.0-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v5.0-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v5.0-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v5.0-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v5.0-us/S6kTKimLen.verified.txt | 11 +- .../snap-v5.0-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v5.0-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v5.0-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v5.0-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v5.0-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v5.0-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v5.0-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v5.0-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v5.0-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v5.0/18luqBmqNm.verified.txt | 11 +- .../snap-v5.0/6w1vPiY8I8.verified.txt | 11 +- .../snap-v5.0/7HwoUhfzjA.verified.txt | 11 +- .../snap-v5.0/FaNpjhWJnp.verified.txt | 11 +- .../snap-v5.0/GFR12F2PgU.verified.txt | 11 +- .../snap-v5.0/GGYsXO7NgY.verified.txt | 11 +- .../snap-v5.0/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v5.0/PvSh3xfKNr.verified.txt | 11 +- .../snap-v5.0/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v5.0/Q8OFEgFlen.verified.txt | 11 +- .../snap-v5.0/S6kTKimLen.verified.txt | 11 +- .../snap-v5.0/Thad6nEDD5.verified.txt | 11 +- .../snap-v5.0/Uhx1npmK9K.verified.txt | 11 +- .../snap-v5.0/WMVLzBfTuM.verified.txt | 11 +- .../snap-v5.0/bkRaWa4KBI.verified.txt | 11 +- .../snap-v5.0/iS1nna8CAC.verified.txt | 11 +- .../snap-v5.0/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v5.0/o2otLTg8Vl.verified.txt | 11 +- .../snap-v5.0/oQTi0amgPS.verified.txt | 11 +- .../snap-v5.0/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v6.0-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v6.0-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v6.0-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v6.0-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v6.0-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v6.0-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v6.0-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v6.0-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v6.0-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v6.0-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v6.0-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v6.0-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v6.0-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v6.0-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v6.0-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v6.0-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v6.0-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v6.0-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v6.0-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v6.0-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v6.0-us/18luqBmqNm.verified.txt | 11 +- .../snap-v6.0-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v6.0-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v6.0-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v6.0-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v6.0-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v6.0-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v6.0-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v6.0-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v6.0-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v6.0-us/S6kTKimLen.verified.txt | 11 +- .../snap-v6.0-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v6.0-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v6.0-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v6.0-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v6.0-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v6.0-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v6.0-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v6.0-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v6.0-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v6.0/18luqBmqNm.verified.txt | 11 +- .../snap-v6.0/6w1vPiY8I8.verified.txt | 11 +- .../snap-v6.0/7HwoUhfzjA.verified.txt | 11 +- .../snap-v6.0/FaNpjhWJnp.verified.txt | 11 +- .../snap-v6.0/GFR12F2PgU.verified.txt | 11 +- .../snap-v6.0/GGYsXO7NgY.verified.txt | 11 +- .../snap-v6.0/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v6.0/PvSh3xfKNr.verified.txt | 11 +- .../snap-v6.0/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v6.0/Q8OFEgFlen.verified.txt | 11 +- .../snap-v6.0/S6kTKimLen.verified.txt | 11 +- .../snap-v6.0/Thad6nEDD5.verified.txt | 11 +- .../snap-v6.0/Uhx1npmK9K.verified.txt | 11 +- .../snap-v6.0/WMVLzBfTuM.verified.txt | 11 +- .../snap-v6.0/bkRaWa4KBI.verified.txt | 11 +- .../snap-v6.0/iS1nna8CAC.verified.txt | 11 +- .../snap-v6.0/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v6.0/o2otLTg8Vl.verified.txt | 11 +- .../snap-v6.0/oQTi0amgPS.verified.txt | 11 +- .../snap-v6.0/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v7.0-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v7.0-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v7.0-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v7.0-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v7.0-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v7.0-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v7.0-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v7.0-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v7.0-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v7.0-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v7.0-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v7.0-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v7.0-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v7.0-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v7.0-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v7.0-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v7.0-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v7.0-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v7.0-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v7.0-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v7.0-us/18luqBmqNm.verified.txt | 11 +- .../snap-v7.0-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v7.0-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v7.0-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v7.0-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v7.0-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v7.0-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v7.0-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v7.0-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v7.0-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v7.0-us/S6kTKimLen.verified.txt | 11 +- .../snap-v7.0-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v7.0-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v7.0-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v7.0-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v7.0-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v7.0-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v7.0-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v7.0-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v7.0-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v7.0/18luqBmqNm.verified.txt | 11 +- .../snap-v7.0/6w1vPiY8I8.verified.txt | 11 +- .../snap-v7.0/7HwoUhfzjA.verified.txt | 11 +- .../snap-v7.0/FaNpjhWJnp.verified.txt | 11 +- .../snap-v7.0/GFR12F2PgU.verified.txt | 11 +- .../snap-v7.0/GGYsXO7NgY.verified.txt | 11 +- .../snap-v7.0/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v7.0/PvSh3xfKNr.verified.txt | 11 +- .../snap-v7.0/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v7.0/Q8OFEgFlen.verified.txt | 11 +- .../snap-v7.0/S6kTKimLen.verified.txt | 11 +- .../snap-v7.0/Thad6nEDD5.verified.txt | 11 +- .../snap-v7.0/Uhx1npmK9K.verified.txt | 11 +- .../snap-v7.0/WMVLzBfTuM.verified.txt | 11 +- .../snap-v7.0/bkRaWa4KBI.verified.txt | 11 +- .../snap-v7.0/iS1nna8CAC.verified.txt | 11 +- .../snap-v7.0/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v7.0/o2otLTg8Vl.verified.txt | 11 +- .../snap-v7.0/oQTi0amgPS.verified.txt | 11 +- .../snap-v7.0/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v8.0-fr/18luqBmqNm.verified.txt | 11 +- .../snap-v8.0-fr/6w1vPiY8I8.verified.txt | 11 +- .../snap-v8.0-fr/7HwoUhfzjA.verified.txt | 11 +- .../snap-v8.0-fr/FaNpjhWJnp.verified.txt | 11 +- .../snap-v8.0-fr/GFR12F2PgU.verified.txt | 11 +- .../snap-v8.0-fr/GGYsXO7NgY.verified.txt | 11 +- .../snap-v8.0-fr/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v8.0-fr/PvSh3xfKNr.verified.txt | 11 +- .../snap-v8.0-fr/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v8.0-fr/Q8OFEgFlen.verified.txt | 11 +- .../snap-v8.0-fr/S6kTKimLen.verified.txt | 11 +- .../snap-v8.0-fr/Thad6nEDD5.verified.txt | 11 +- .../snap-v8.0-fr/Uhx1npmK9K.verified.txt | 11 +- .../snap-v8.0-fr/WMVLzBfTuM.verified.txt | 11 +- .../snap-v8.0-fr/bkRaWa4KBI.verified.txt | 11 +- .../snap-v8.0-fr/iS1nna8CAC.verified.txt | 11 +- .../snap-v8.0-fr/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v8.0-fr/o2otLTg8Vl.verified.txt | 11 +- .../snap-v8.0-fr/oQTi0amgPS.verified.txt | 11 +- .../snap-v8.0-fr/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v8.0-us/18luqBmqNm.verified.txt | 11 +- .../snap-v8.0-us/6w1vPiY8I8.verified.txt | 11 +- .../snap-v8.0-us/7HwoUhfzjA.verified.txt | 11 +- .../snap-v8.0-us/FaNpjhWJnp.verified.txt | 11 +- .../snap-v8.0-us/GFR12F2PgU.verified.txt | 11 +- .../snap-v8.0-us/GGYsXO7NgY.verified.txt | 11 +- .../snap-v8.0-us/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v8.0-us/PvSh3xfKNr.verified.txt | 11 +- .../snap-v8.0-us/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v8.0-us/Q8OFEgFlen.verified.txt | 11 +- .../snap-v8.0-us/S6kTKimLen.verified.txt | 11 +- .../snap-v8.0-us/Thad6nEDD5.verified.txt | 11 +- .../snap-v8.0-us/Uhx1npmK9K.verified.txt | 11 +- .../snap-v8.0-us/WMVLzBfTuM.verified.txt | 11 +- .../snap-v8.0-us/bkRaWa4KBI.verified.txt | 11 +- .../snap-v8.0-us/iS1nna8CAC.verified.txt | 11 +- .../snap-v8.0-us/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v8.0-us/o2otLTg8Vl.verified.txt | 11 +- .../snap-v8.0-us/oQTi0amgPS.verified.txt | 11 +- .../snap-v8.0-us/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v8.0/18luqBmqNm.verified.txt | 11 +- .../snap-v8.0/6w1vPiY8I8.verified.txt | 11 +- .../snap-v8.0/7HwoUhfzjA.verified.txt | 11 +- .../snap-v8.0/FaNpjhWJnp.verified.txt | 11 +- .../snap-v8.0/GFR12F2PgU.verified.txt | 11 +- .../snap-v8.0/GGYsXO7NgY.verified.txt | 11 +- .../snap-v8.0/Gr0OHLjXmU.verified.txt | 11 +- .../snap-v8.0/PvSh3xfKNr.verified.txt | 11 +- .../snap-v8.0/Q0Mq3bhsum.verified.txt | 11 +- .../snap-v8.0/Q8OFEgFlen.verified.txt | 11 +- .../snap-v8.0/S6kTKimLen.verified.txt | 11 +- .../snap-v8.0/Thad6nEDD5.verified.txt | 11 +- .../snap-v8.0/Uhx1npmK9K.verified.txt | 11 +- .../snap-v8.0/WMVLzBfTuM.verified.txt | 11 +- .../snap-v8.0/bkRaWa4KBI.verified.txt | 11 +- .../snap-v8.0/iS1nna8CAC.verified.txt | 11 +- .../snap-v8.0/jLSQYXoUZ7.verified.txt | 11 +- .../snap-v8.0/o2otLTg8Vl.verified.txt | 11 +- .../snap-v8.0/oQTi0amgPS.verified.txt | 11 +- .../snap-v8.0/tiGNpHQWuQ.verified.txt | 11 +- .../snap-v3.1/07PcIVuj3q.verified.txt | 11 +- .../snap-v3.1/0KEv27PfZM.verified.txt | 11 +- .../snap-v3.1/53M01mFed0.verified.txt | 11 +- .../snap-v3.1/5gozITB9Re.verified.txt | 11 +- .../snap-v3.1/7hiNp5tlXd.verified.txt | 11 +- .../snap-v3.1/BQCdbuCyxx.verified.txt | 11 +- .../snap-v3.1/BYxnvHUM5h.verified.txt | 11 +- .../snap-v3.1/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v3.1/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v3.1/Bbqck2QQEe.verified.txt | 11 +- .../snap-v3.1/C3aV5bGuhC.verified.txt | 11 +- .../snap-v3.1/CpMibF5X1W.verified.txt | 11 +- .../snap-v3.1/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v3.1/F0A7L16fq0.verified.txt | 11 +- .../snap-v3.1/G2mouoq1fx.verified.txt | 11 +- .../snap-v3.1/G7fYp2vqR9.verified.txt | 11 +- .../snap-v3.1/GTwMaPNJRP.verified.txt | 11 +- .../snap-v3.1/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v3.1/ITWVYMGhio.verified.txt | 11 +- .../snap-v3.1/J8SezX4ArK.verified.txt | 11 +- .../snap-v3.1/JY3027oK9C.verified.txt | 11 +- .../snap-v3.1/JYus242bhT.verified.txt | 11 +- .../snap-v3.1/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v3.1/PWSj9aUbl7.verified.txt | 11 +- .../snap-v3.1/RdmiRTq0Io.verified.txt | 11 +- .../snap-v3.1/SwRDtR0cOK.verified.txt | 11 +- .../snap-v3.1/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v3.1/ZC2jtVGSox.verified.txt | 11 +- .../snap-v3.1/beUUeB1dtC.verified.txt | 11 +- .../snap-v3.1/fWP2lfWLPk.verified.txt | 11 +- .../snap-v3.1/ij75EzZOvs.verified.txt | 11 +- .../snap-v3.1/l0KgzJEYIx.verified.txt | 11 +- .../snap-v3.1/mFIIJTvHXY.verified.txt | 11 +- .../snap-v3.1/mLHmiGlOxG.verified.txt | 11 +- .../snap-v3.1/o4gwuUPNtq.verified.txt | 11 +- .../snap-v3.1/smZgSpu29K.verified.txt | 11 +- .../snap-v3.1/uE3HXfhovg.verified.txt | 11 +- .../snap-v3.1/uKvBMJhwaD.verified.txt | 11 +- .../snap-v3.1/udEoaZL1DV.verified.txt | 11 +- .../snap-v3.1/w68jlFSN6b.verified.txt | 11 +- .../snap-v4.6.1/07PcIVuj3q.verified.txt | 11 +- .../snap-v4.6.1/0KEv27PfZM.verified.txt | 11 +- .../snap-v4.6.1/53M01mFed0.verified.txt | 11 +- .../snap-v4.6.1/5gozITB9Re.verified.txt | 11 +- .../snap-v4.6.1/7hiNp5tlXd.verified.txt | 11 +- .../snap-v4.6.1/BQCdbuCyxx.verified.txt | 11 +- .../snap-v4.6.1/BYxnvHUM5h.verified.txt | 11 +- .../snap-v4.6.1/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v4.6.1/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v4.6.1/Bbqck2QQEe.verified.txt | 11 +- .../snap-v4.6.1/C3aV5bGuhC.verified.txt | 11 +- .../snap-v4.6.1/CpMibF5X1W.verified.txt | 11 +- .../snap-v4.6.1/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v4.6.1/F0A7L16fq0.verified.txt | 11 +- .../snap-v4.6.1/G2mouoq1fx.verified.txt | 11 +- .../snap-v4.6.1/G7fYp2vqR9.verified.txt | 11 +- .../snap-v4.6.1/GTwMaPNJRP.verified.txt | 11 +- .../snap-v4.6.1/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v4.6.1/ITWVYMGhio.verified.txt | 11 +- .../snap-v4.6.1/J8SezX4ArK.verified.txt | 11 +- .../snap-v4.6.1/JY3027oK9C.verified.txt | 11 +- .../snap-v4.6.1/JYus242bhT.verified.txt | 11 +- .../snap-v4.6.1/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v4.6.1/PWSj9aUbl7.verified.txt | 11 +- .../snap-v4.6.1/RdmiRTq0Io.verified.txt | 11 +- .../snap-v4.6.1/SwRDtR0cOK.verified.txt | 11 +- .../snap-v4.6.1/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v4.6.1/ZC2jtVGSox.verified.txt | 11 +- .../snap-v4.6.1/beUUeB1dtC.verified.txt | 11 +- .../snap-v4.6.1/fWP2lfWLPk.verified.txt | 11 +- .../snap-v4.6.1/ij75EzZOvs.verified.txt | 11 +- .../snap-v4.6.1/l0KgzJEYIx.verified.txt | 11 +- .../snap-v4.6.1/mFIIJTvHXY.verified.txt | 11 +- .../snap-v4.6.1/mLHmiGlOxG.verified.txt | 11 +- .../snap-v4.6.1/o4gwuUPNtq.verified.txt | 11 +- .../snap-v4.6.1/smZgSpu29K.verified.txt | 11 +- .../snap-v4.6.1/uE3HXfhovg.verified.txt | 11 +- .../snap-v4.6.1/uKvBMJhwaD.verified.txt | 11 +- .../snap-v4.6.1/udEoaZL1DV.verified.txt | 11 +- .../snap-v4.6.1/w68jlFSN6b.verified.txt | 11 +- .../snap-v4.8/07PcIVuj3q.verified.txt | 11 +- .../snap-v4.8/0KEv27PfZM.verified.txt | 11 +- .../snap-v4.8/53M01mFed0.verified.txt | 11 +- .../snap-v4.8/5gozITB9Re.verified.txt | 11 +- .../snap-v4.8/7hiNp5tlXd.verified.txt | 11 +- .../snap-v4.8/BQCdbuCyxx.verified.txt | 11 +- .../snap-v4.8/BYxnvHUM5h.verified.txt | 11 +- .../snap-v4.8/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v4.8/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v4.8/Bbqck2QQEe.verified.txt | 11 +- .../snap-v4.8/C3aV5bGuhC.verified.txt | 11 +- .../snap-v4.8/CpMibF5X1W.verified.txt | 11 +- .../snap-v4.8/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v4.8/F0A7L16fq0.verified.txt | 11 +- .../snap-v4.8/G2mouoq1fx.verified.txt | 11 +- .../snap-v4.8/G7fYp2vqR9.verified.txt | 11 +- .../snap-v4.8/GTwMaPNJRP.verified.txt | 11 +- .../snap-v4.8/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v4.8/ITWVYMGhio.verified.txt | 11 +- .../snap-v4.8/J8SezX4ArK.verified.txt | 11 +- .../snap-v4.8/JY3027oK9C.verified.txt | 11 +- .../snap-v4.8/JYus242bhT.verified.txt | 11 +- .../snap-v4.8/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v4.8/PWSj9aUbl7.verified.txt | 11 +- .../snap-v4.8/RdmiRTq0Io.verified.txt | 11 +- .../snap-v4.8/SwRDtR0cOK.verified.txt | 11 +- .../snap-v4.8/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v4.8/ZC2jtVGSox.verified.txt | 11 +- .../snap-v4.8/beUUeB1dtC.verified.txt | 11 +- .../snap-v4.8/fWP2lfWLPk.verified.txt | 11 +- .../snap-v4.8/ij75EzZOvs.verified.txt | 11 +- .../snap-v4.8/l0KgzJEYIx.verified.txt | 11 +- .../snap-v4.8/mFIIJTvHXY.verified.txt | 11 +- .../snap-v4.8/mLHmiGlOxG.verified.txt | 11 +- .../snap-v4.8/o4gwuUPNtq.verified.txt | 11 +- .../snap-v4.8/smZgSpu29K.verified.txt | 11 +- .../snap-v4.8/uE3HXfhovg.verified.txt | 11 +- .../snap-v4.8/uKvBMJhwaD.verified.txt | 11 +- .../snap-v4.8/udEoaZL1DV.verified.txt | 11 +- .../snap-v4.8/w68jlFSN6b.verified.txt | 11 +- .../snap-v5.0/07PcIVuj3q.verified.txt | 11 +- .../snap-v5.0/0KEv27PfZM.verified.txt | 11 +- .../snap-v5.0/53M01mFed0.verified.txt | 11 +- .../snap-v5.0/5gozITB9Re.verified.txt | 11 +- .../snap-v5.0/7hiNp5tlXd.verified.txt | 11 +- .../snap-v5.0/BQCdbuCyxx.verified.txt | 11 +- .../snap-v5.0/BYxnvHUM5h.verified.txt | 11 +- .../snap-v5.0/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v5.0/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v5.0/Bbqck2QQEe.verified.txt | 11 +- .../snap-v5.0/C3aV5bGuhC.verified.txt | 11 +- .../snap-v5.0/CpMibF5X1W.verified.txt | 11 +- .../snap-v5.0/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v5.0/F0A7L16fq0.verified.txt | 11 +- .../snap-v5.0/G2mouoq1fx.verified.txt | 11 +- .../snap-v5.0/G7fYp2vqR9.verified.txt | 11 +- .../snap-v5.0/GTwMaPNJRP.verified.txt | 11 +- .../snap-v5.0/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v5.0/ITWVYMGhio.verified.txt | 11 +- .../snap-v5.0/J8SezX4ArK.verified.txt | 11 +- .../snap-v5.0/JY3027oK9C.verified.txt | 11 +- .../snap-v5.0/JYus242bhT.verified.txt | 11 +- .../snap-v5.0/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v5.0/PWSj9aUbl7.verified.txt | 11 +- .../snap-v5.0/RdmiRTq0Io.verified.txt | 11 +- .../snap-v5.0/SwRDtR0cOK.verified.txt | 11 +- .../snap-v5.0/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v5.0/ZC2jtVGSox.verified.txt | 11 +- .../snap-v5.0/beUUeB1dtC.verified.txt | 11 +- .../snap-v5.0/fWP2lfWLPk.verified.txt | 11 +- .../snap-v5.0/ij75EzZOvs.verified.txt | 11 +- .../snap-v5.0/l0KgzJEYIx.verified.txt | 11 +- .../snap-v5.0/mFIIJTvHXY.verified.txt | 11 +- .../snap-v5.0/mLHmiGlOxG.verified.txt | 11 +- .../snap-v5.0/o4gwuUPNtq.verified.txt | 11 +- .../snap-v5.0/smZgSpu29K.verified.txt | 11 +- .../snap-v5.0/uE3HXfhovg.verified.txt | 11 +- .../snap-v5.0/uKvBMJhwaD.verified.txt | 11 +- .../snap-v5.0/udEoaZL1DV.verified.txt | 11 +- .../snap-v5.0/w68jlFSN6b.verified.txt | 11 +- .../snap-v6.0/07PcIVuj3q.verified.txt | 11 +- .../snap-v6.0/0KEv27PfZM.verified.txt | 11 +- .../snap-v6.0/53M01mFed0.verified.txt | 11 +- .../snap-v6.0/5gozITB9Re.verified.txt | 11 +- .../snap-v6.0/7hiNp5tlXd.verified.txt | 11 +- .../snap-v6.0/BQCdbuCyxx.verified.txt | 11 +- .../snap-v6.0/BYxnvHUM5h.verified.txt | 11 +- .../snap-v6.0/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v6.0/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v6.0/Bbqck2QQEe.verified.txt | 11 +- .../snap-v6.0/C3aV5bGuhC.verified.txt | 11 +- .../snap-v6.0/CpMibF5X1W.verified.txt | 11 +- .../snap-v6.0/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v6.0/F0A7L16fq0.verified.txt | 11 +- .../snap-v6.0/G2mouoq1fx.verified.txt | 11 +- .../snap-v6.0/G7fYp2vqR9.verified.txt | 11 +- .../snap-v6.0/GTwMaPNJRP.verified.txt | 11 +- .../snap-v6.0/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v6.0/ITWVYMGhio.verified.txt | 11 +- .../snap-v6.0/J8SezX4ArK.verified.txt | 11 +- .../snap-v6.0/JY3027oK9C.verified.txt | 11 +- .../snap-v6.0/JYus242bhT.verified.txt | 11 +- .../snap-v6.0/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v6.0/PWSj9aUbl7.verified.txt | 11 +- .../snap-v6.0/RdmiRTq0Io.verified.txt | 11 +- .../snap-v6.0/SwRDtR0cOK.verified.txt | 11 +- .../snap-v6.0/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v6.0/ZC2jtVGSox.verified.txt | 11 +- .../snap-v6.0/beUUeB1dtC.verified.txt | 11 +- .../snap-v6.0/fWP2lfWLPk.verified.txt | 11 +- .../snap-v6.0/ij75EzZOvs.verified.txt | 11 +- .../snap-v6.0/l0KgzJEYIx.verified.txt | 11 +- .../snap-v6.0/mFIIJTvHXY.verified.txt | 11 +- .../snap-v6.0/mLHmiGlOxG.verified.txt | 11 +- .../snap-v6.0/o4gwuUPNtq.verified.txt | 11 +- .../snap-v6.0/smZgSpu29K.verified.txt | 11 +- .../snap-v6.0/uE3HXfhovg.verified.txt | 11 +- .../snap-v6.0/uKvBMJhwaD.verified.txt | 11 +- .../snap-v6.0/udEoaZL1DV.verified.txt | 11 +- .../snap-v6.0/w68jlFSN6b.verified.txt | 11 +- .../snap-v7.0/07PcIVuj3q.verified.txt | 11 +- .../snap-v7.0/0KEv27PfZM.verified.txt | 11 +- .../snap-v7.0/53M01mFed0.verified.txt | 11 +- .../snap-v7.0/5gozITB9Re.verified.txt | 11 +- .../snap-v7.0/7hiNp5tlXd.verified.txt | 11 +- .../snap-v7.0/BQCdbuCyxx.verified.txt | 11 +- .../snap-v7.0/BYxnvHUM5h.verified.txt | 11 +- .../snap-v7.0/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v7.0/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v7.0/Bbqck2QQEe.verified.txt | 11 +- .../snap-v7.0/C3aV5bGuhC.verified.txt | 11 +- .../snap-v7.0/CpMibF5X1W.verified.txt | 11 +- .../snap-v7.0/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v7.0/F0A7L16fq0.verified.txt | 11 +- .../snap-v7.0/G2mouoq1fx.verified.txt | 11 +- .../snap-v7.0/G7fYp2vqR9.verified.txt | 11 +- .../snap-v7.0/GTwMaPNJRP.verified.txt | 11 +- .../snap-v7.0/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v7.0/ITWVYMGhio.verified.txt | 11 +- .../snap-v7.0/J8SezX4ArK.verified.txt | 11 +- .../snap-v7.0/JY3027oK9C.verified.txt | 11 +- .../snap-v7.0/JYus242bhT.verified.txt | 11 +- .../snap-v7.0/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v7.0/PWSj9aUbl7.verified.txt | 11 +- .../snap-v7.0/RdmiRTq0Io.verified.txt | 11 +- .../snap-v7.0/SwRDtR0cOK.verified.txt | 11 +- .../snap-v7.0/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v7.0/ZC2jtVGSox.verified.txt | 11 +- .../snap-v7.0/beUUeB1dtC.verified.txt | 11 +- .../snap-v7.0/fWP2lfWLPk.verified.txt | 11 +- .../snap-v7.0/ij75EzZOvs.verified.txt | 11 +- .../snap-v7.0/l0KgzJEYIx.verified.txt | 11 +- .../snap-v7.0/mFIIJTvHXY.verified.txt | 11 +- .../snap-v7.0/mLHmiGlOxG.verified.txt | 11 +- .../snap-v7.0/o4gwuUPNtq.verified.txt | 11 +- .../snap-v7.0/smZgSpu29K.verified.txt | 11 +- .../snap-v7.0/uE3HXfhovg.verified.txt | 11 +- .../snap-v7.0/uKvBMJhwaD.verified.txt | 11 +- .../snap-v7.0/udEoaZL1DV.verified.txt | 11 +- .../snap-v7.0/w68jlFSN6b.verified.txt | 11 +- .../snap-v8.0/07PcIVuj3q.verified.txt | 11 +- .../snap-v8.0/0KEv27PfZM.verified.txt | 11 +- .../snap-v8.0/53M01mFed0.verified.txt | 11 +- .../snap-v8.0/5gozITB9Re.verified.txt | 11 +- .../snap-v8.0/7hiNp5tlXd.verified.txt | 11 +- .../snap-v8.0/BQCdbuCyxx.verified.txt | 11 +- .../snap-v8.0/BYxnvHUM5h.verified.txt | 11 +- .../snap-v8.0/Ba6Ah7G9BT.verified.txt | 11 +- .../snap-v8.0/BbUYWGSZ7t.verified.txt | 11 +- .../snap-v8.0/Bbqck2QQEe.verified.txt | 11 +- .../snap-v8.0/C3aV5bGuhC.verified.txt | 11 +- .../snap-v8.0/CpMibF5X1W.verified.txt | 11 +- .../snap-v8.0/ETkaLLh9Fh.verified.txt | 11 +- .../snap-v8.0/F0A7L16fq0.verified.txt | 11 +- .../snap-v8.0/G2mouoq1fx.verified.txt | 11 +- .../snap-v8.0/G7fYp2vqR9.verified.txt | 11 +- .../snap-v8.0/GTwMaPNJRP.verified.txt | 11 +- .../snap-v8.0/Hhh5fuVEaa.verified.txt | 11 +- .../snap-v8.0/ITWVYMGhio.verified.txt | 11 +- .../snap-v8.0/J8SezX4ArK.verified.txt | 11 +- .../snap-v8.0/JY3027oK9C.verified.txt | 11 +- .../snap-v8.0/JYus242bhT.verified.txt | 11 +- .../snap-v8.0/O3fNbJ8VN2.verified.txt | 11 +- .../snap-v8.0/PWSj9aUbl7.verified.txt | 11 +- .../snap-v8.0/RdmiRTq0Io.verified.txt | 11 +- .../snap-v8.0/SwRDtR0cOK.verified.txt | 11 +- .../snap-v8.0/Wm4zfAVYP7.verified.txt | 11 +- .../snap-v8.0/ZC2jtVGSox.verified.txt | 11 +- .../snap-v8.0/beUUeB1dtC.verified.txt | 11 +- .../snap-v8.0/fWP2lfWLPk.verified.txt | 11 +- .../snap-v8.0/ij75EzZOvs.verified.txt | 11 +- .../snap-v8.0/l0KgzJEYIx.verified.txt | 11 +- .../snap-v8.0/mFIIJTvHXY.verified.txt | 11 +- .../snap-v8.0/mLHmiGlOxG.verified.txt | 11 +- .../snap-v8.0/o4gwuUPNtq.verified.txt | 11 +- .../snap-v8.0/smZgSpu29K.verified.txt | 11 +- .../snap-v8.0/uE3HXfhovg.verified.txt | 11 +- .../snap-v8.0/uKvBMJhwaD.verified.txt | 11 +- .../snap-v8.0/udEoaZL1DV.verified.txt | 11 +- .../snap-v8.0/w68jlFSN6b.verified.txt | 11 +- 1435 files changed, 13900 insertions(+), 4284 deletions(-) create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v3.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v4.6.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v4.8/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v5.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v6.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v7.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt create mode 100644 tests/SnapshotTests/BugFixes/snapshots/snap-v8.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v3.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v3.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..47cb4e2c85 --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v3.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,344 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v4.6.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v4.6.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..898d990134 --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v4.6.1/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,310 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v4.8/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v4.8/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..898d990134 --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v4.8/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,310 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v5.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v5.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..47cb4e2c85 --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v5.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,344 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v6.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v6.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..47cb4e2c85 --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v6.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,344 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v7.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v7.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..6142d9a5ba --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v7.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,412 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable, global::System.IParsable, global::System.ISpanParsable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan s, global::System.IFormatProvider provider, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(s, provider, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string s, global::System.IFormatProvider provider, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(s, provider, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan s, global::System.IFormatProvider provider) { + var r = System.Guid.Parse(s, provider); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string s, global::System.IFormatProvider provider) { + var r = System.Guid.Parse(s, provider); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/BugFixes/snapshots/snap-v8.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt b/tests/SnapshotTests/BugFixes/snapshots/snap-v8.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt new file mode 100644 index 0000000000..6142d9a5ba --- /dev/null +++ b/tests/SnapshotTests/BugFixes/snapshots/snap-v8.0/Bug581_StjDeserializer_throws_correct_exception.Test.verified.txt @@ -0,0 +1,412 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618 + +// Suppress warnings for 'Override methods on comparable types'. +#pragma warning disable CA1036 + +// Suppress Error MA0097 : A class that implements IComparable or IComparable should override comparison operators +#pragma warning disable MA0097 + +// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' +// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. +#pragma warning disable CS8669 + +// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' +#pragma warning disable CS1591 + +using Vogen; + + + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(VoSystemTextJsonConverter))] +[global::System.ComponentModel.TypeConverter(typeof(VoTypeConverter))] + + [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(VoDebugView))] + [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Guid, Value = { _value }")] + public partial struct Vo : global::System.IEquatable, global::System.IEquatable, global::System.IComparable, global::System.IComparable, global::System.IParsable, global::System.ISpanParsable + { +#if DEBUG + private readonly global::System.Diagnostics.StackTrace _stackTrace = null; +#endif + + private readonly global::System.Boolean _isInitialized; + + private readonly System.Guid _value; + + /// + /// Gets the underlying value if set, otherwise a is thrown. + /// + public readonly System.Guid Value + { + [global::System.Diagnostics.DebuggerStepThroughAttribute] + get + { + EnsureInitialized(); + return _value; + } + } + + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Vo() + { +#if DEBUG + _stackTrace = new global::System.Diagnostics.StackTrace(); +#endif + + _isInitialized = false; + _value = default; + } + + [global::System.Diagnostics.DebuggerStepThroughAttribute] + private Vo(System.Guid value) + { + _value = value; + _isInitialized = true; + } + + /// + /// Builds an instance from the provided underlying type. + /// + /// The underlying type. + /// An instance of this type. + public static Vo From(System.Guid value) + { + + + + + Vo instance = new Vo(value); + + return instance; + } + + + public static explicit operator Vo(System.Guid value) => From(value); + public static explicit operator System.Guid(Vo value) => value.Value; + + // only called internally when something has been deserialized into + // its primitive type. + private static Vo Deserialize(System.Guid value) + { + + + + + return new Vo(value); + } + public readonly global::System.Boolean Equals(Vo other) + { + // It's possible to create uninitialized instances via converters such as EfCore (HasDefaultValue), which call Equals. + // We treat anything uninitialized as not equal to anything, even other uninitialized instances of this type. + if(!_isInitialized || !other._isInitialized) return false; + + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + public global::System.Boolean Equals(Vo other, global::System.Collections.Generic.IEqualityComparer comparer) + { + return comparer.Equals(this, other); + } + + + public readonly global::System.Boolean Equals(System.Guid primitive) + { + return Value.Equals(primitive); + } + + public readonly override global::System.Boolean Equals(global::System.Object obj) + { + return obj is Vo && Equals((Vo) obj); + } + + public static global::System.Boolean operator ==(Vo left, Vo right) => Equals(left, right); + public static global::System.Boolean operator !=(Vo left, Vo right) => !(left == right); + + public static global::System.Boolean operator ==(Vo left, System.Guid right) => Equals(left.Value, right); + public static global::System.Boolean operator !=(Vo left, System.Guid right) => !Equals(left.Value, right); + + public static global::System.Boolean operator ==(System.Guid left, Vo right) => Equals(left, right.Value); + public static global::System.Boolean operator !=(System.Guid left, Vo right) => !Equals(left, right.Value); + + public int CompareTo(Vo other) => Value.CompareTo(other.Value); + public int CompareTo(object other) { + if(other is null) return 1; + if(other is Vo x) return CompareTo(x); + throw new global::System.ArgumentException("Cannot compare to object as it is not of type Vo", nameof(other)); + } + + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(global::System.ReadOnlySpan s, global::System.IFormatProvider provider, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(s, provider, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string input, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(input, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization). + /// + public static global::System.Boolean TryParse(string s, global::System.IFormatProvider provider, +#if NETCOREAPP3_0_OR_GREATER +[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out Vo result) { + if(System.Guid.TryParse(s, provider, out var __v)) { + + + result = new Vo(__v); + return true; + } + + result = default; + return false; + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(global::System.ReadOnlySpan s, global::System.IFormatProvider provider) { + var r = System.Guid.Parse(s, provider); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string input) { + var r = System.Guid.Parse(input); + return From(r); + } + + /// + /// + /// + /// + /// The value created via the method. + /// + /// Thrown when the value can be parsed, but is not valid. + public static Vo Parse(string s, global::System.IFormatProvider provider) { + var r = System.Guid.Parse(s, provider); + return From(r); + } + + + + public readonly override global::System.Int32 GetHashCode() + { + return global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + } + + /// Returns the string representation of the underlying type + /// + public readonly override global::System.String ToString() =>_isInitialized ? Value.ToString() : "[UNINITIALIZED]"; + + private readonly void EnsureInitialized() + { + if (!_isInitialized) + { +#if DEBUG + global::System.String message = "Use of uninitialized Value Object at: " + _stackTrace ?? ""; +#else + global::System.String message = "Use of uninitialized Value Object."; +#endif + + throw new global::Vogen.ValueObjectValidationException(message); + } + } + + + + + class VoSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + public override Vo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + return Vo.Deserialize(reader.GetGuid()); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStringValue(value.Value); + } + +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. + public override Vo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) + { + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return Vo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of Vo"); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Vo value, global::System.Text.Json.JsonSerializerOptions options) + { + writer.WritePropertyName(value.Value.ToString()); + } +#endif + } + + + class VoTypeConverter : global::System.ComponentModel.TypeConverter + { + public override global::System.Boolean CanConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertFrom(context, sourceType); + } + + public override global::System.Object ConvertFrom(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value) + { + return value switch + { + global::System.Guid guidValue => Vo.Deserialize(guidValue), + global::System.String stringValue when !global::System.String.IsNullOrEmpty(stringValue) && global::System.Guid.TryParse(stringValue, out var result) => Vo.Deserialize(result), + _ => base.ConvertFrom(context, culture, value), + }; + } + + public override bool CanConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Type sourceType) + { + return sourceType == typeof(global::System.Guid) || sourceType == typeof(global::System.String) || base.CanConvertTo(context, sourceType); + } + + public override object ConvertTo(global::System.ComponentModel.ITypeDescriptorContext context, global::System.Globalization.CultureInfo culture, global::System.Object value, global::System.Type destinationType) + { + if (value is Vo idValue) + { + if (destinationType == typeof(global::System.Guid)) + { + return idValue.Value; + } + + if (destinationType == typeof(global::System.String)) + { + return idValue.Value.ToString(); + } + } + + return base.ConvertTo(context, culture, value, destinationType); + } + } + + + + + + + internal sealed class VoDebugView + { + private readonly Vo _t; + + VoDebugView(Vo t) + { + _t = t; + } + + public global::System.Boolean IsInitialized => _t._isInitialized; + public global::System.String UnderlyingType => "System.Guid"; + public global::System.String Value => _t._isInitialized ? _t._value.ToString() : "[not initialized]" ; + + #if DEBUG + public global::System.String CreatedWith => _t._stackTrace?.ToString() ?? "the From method"; + #endif + + public global::System.String Conversions => @"Default"; + } + +} + diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/01NnWIXrcn.verified.txt index fe3860b6ca..7cc98155b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/01NnWIXrcn.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0TqwlvOnlT.verified.txt index c60ca66696..a1fdfd98c3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0TqwlvOnlT.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0ZNAfNWlkE.verified.txt index 89bcd22489..13ea92c231 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/0ZNAfNWlkE.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/13cxXzX7TM.verified.txt index dbe6e19e27..4db92ecff8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/13cxXzX7TM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/1QFtVlpDn8.verified.txt index 2c07284813..d08a802256 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/1QFtVlpDn8.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/2c0dGifBVP.verified.txt index fd7171286b..0185769003 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/2c0dGifBVP.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3Giiro8Q8a.verified.txt index 1dcf188df1..fcc2f67a56 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3Giiro8Q8a.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3pXLwxOlTQ.verified.txt index a128a3fcb2..75bfa04707 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/3pXLwxOlTQ.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5BpY9bPVhd.verified.txt index f4a86cceef..1807130c5b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5BpY9bPVhd.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5oRtW5ow6k.verified.txt index 004bbe72e6..abc9ddb8d0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/5oRtW5ow6k.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/682UtC0nRt.verified.txt index 6aeb6836bb..0ded43c196 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/682UtC0nRt.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7VnqvOkqeY.verified.txt index acc38bcde8..6043e7d999 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7VnqvOkqeY.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7fIqW0n1tE.verified.txt index 818fae97a0..84a9fc2dd6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/7fIqW0n1tE.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8SEUfvOnjd.verified.txt index 73b85a8a8e..9b204ead74 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8SEUfvOnjd.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8TzJ6T6Go9.verified.txt index b0ff0953e5..3517396a25 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/8TzJ6T6Go9.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/91n32T1eTx.verified.txt index 268dc9f906..dfd8b9454c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/91n32T1eTx.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/ASzheSCTPW.verified.txt index e7339e471b..bf10f32e42 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/ASzheSCTPW.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/CDaLgcRGEb.verified.txt index bc8dc0e2ec..167fc25b5d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/CDaLgcRGEb.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Cxb5K2w4um.verified.txt index 7579218f9a..b94f17de69 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Cxb5K2w4um.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D143iuJmQ9.verified.txt index d52ca31aae..09d652e174 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D143iuJmQ9.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D5ti90Gtnc.verified.txt index 5016c4e5bd..a16984cb42 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/D5ti90Gtnc.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/DoB0bQElXk.verified.txt index 86c8f8062d..8c965441b7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/DoB0bQElXk.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EDRYu8H5Of.verified.txt index a02e108675..25bd7571d7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EDRYu8H5Of.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EFai6tQHAL.verified.txt index b37247cb8d..67615254a9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/EFai6tQHAL.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/G4kzRbHutt.verified.txt index f9904365e0..ba56aa4361 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/G4kzRbHutt.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Gf6nI9k93r.verified.txt index 0b08f94fec..2d955055b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Gf6nI9k93r.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GuO937nBp2.verified.txt index e9bb072cd9..370d9f10de 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GuO937nBp2.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GxLmdQIzuz.verified.txt index 5e3c91aae0..6285697ee9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/GxLmdQIzuz.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/HpOb1fz8q6.verified.txt index a3255208f7..476f4f567d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/HpOb1fz8q6.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IDHFkHqWK3.verified.txt index 0df7d1a66f..e88d3faad7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IDHFkHqWK3.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IIUm0SlNvB.verified.txt index c4cc1c8f91..0e5d95f689 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IIUm0SlNvB.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Ia8sjkIOlf.verified.txt index c614521a24..35fa3b1e4d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Ia8sjkIOlf.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IuELCZKXqm.verified.txt index fcff48a844..b7bb3f08df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/IuELCZKXqm.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/KfG1verOpN.verified.txt index 0170e11541..5e3c47b156 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/KfG1verOpN.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Kh16boKdpD.verified.txt index aeadf20b3e..6450b433ae 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/Kh16boKdpD.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LFYfYZrpoJ.verified.txt index e9d63f3f74..c799004ceb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LFYfYZrpoJ.verified.txt @@ -254,7 +254,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -262,10 +262,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LJFykMMPMi.verified.txt index 5153dc6cc7..970e70ef82 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/LJFykMMPMi.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/MZr4q8iotQ.verified.txt index 1550c8bcd7..dd91c9bbff 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/MZr4q8iotQ.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/O5ZNrTYaVI.verified.txt index f97115306e..2ede8051f4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/O5ZNrTYaVI.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/OYR7FJClTd.verified.txt index 75419127a7..a9814aff26 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/OYR7FJClTd.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PRIZHoHaqK.verified.txt index 3a7445aa7b..ba1e65a7b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PRIZHoHaqK.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PVKCOm5VKp.verified.txt index 1e6d5045e4..2d7703e110 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/PVKCOm5VKp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/SOyh0mHHcC.verified.txt index 7ff0068194..eee4e108c6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/SOyh0mHHcC.verified.txt @@ -254,7 +254,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -262,10 +262,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/TxZpwiB5Py.verified.txt index 6f21ee059e..ff82524ff0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/TxZpwiB5Py.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/UoYkE8YBpS.verified.txt index befad86cdd..2c24dfff43 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/UoYkE8YBpS.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/W0HLD96mZV.verified.txt index 4197591284..006de852ee 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/W0HLD96mZV.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XPRo52TbpR.verified.txt index 180cfe7538..1493a7dab7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XPRo52TbpR.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XUcwhxLebL.verified.txt index a81aac5828..b11e228022 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XUcwhxLebL.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XreN72ITLR.verified.txt index 1571c5fb15..330ad1b24f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/XreN72ITLR.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/YbCUikIKwS.verified.txt index c778126838..0100752faf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/YbCUikIKwS.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/azKU9DBVTH.verified.txt index 9179ee6038..f1e895f496 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/azKU9DBVTH.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/bY1HiMJXbA.verified.txt index 912ffb0d9d..fd69e32283 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/bY1HiMJXbA.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cKervgfNdC.verified.txt index d1eeb7c7a3..76597fa16a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cKervgfNdC.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cgwp0MF0Co.verified.txt index a40d3e968f..aa24f4059f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cgwp0MF0Co.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cxzejiZpAp.verified.txt index 540464b7aa..2848ea0728 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cxzejiZpAp.verified.txt @@ -250,7 +250,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -258,10 +258,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cyUPie9s11.verified.txt index cf1bfb75ee..b1dac9a639 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/cyUPie9s11.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dO4Vghni19.verified.txt index 64bba1ab6f..244485d55d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dO4Vghni19.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dT6HjvXbRF.verified.txt index 7d8b9322b3..a5a6fbee74 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dT6HjvXbRF.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dxWQFs9gJB.verified.txt index b9fbe5b8b6..1b7cdd7cf3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/dxWQFs9gJB.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/edwx2bhfuH.verified.txt index 6df1d4b92f..fb12a75688 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/edwx2bhfuH.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/enQTvFpMic.verified.txt index 9e978bafea..dbebebe73e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/enQTvFpMic.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fDkjh4YHqJ.verified.txt index 17b7b6029b..ce9e1f93a3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fDkjh4YHqJ.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fHtz3V4XWi.verified.txt index 2773040a58..c21d37f2e3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fHtz3V4XWi.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fLYsGHdYeN.verified.txt index 7a1822fd00..29f62975ad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fLYsGHdYeN.verified.txt @@ -269,7 +269,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -277,10 +277,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fx58SkLtj3.verified.txt index c0c03686a8..123daf06ff 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/fx58SkLtj3.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/gInCG5Y2j8.verified.txt index 4dbb2e0fe1..2970eca94f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/gInCG5Y2j8.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/hgqNJypuYE.verified.txt index 208e9b8717..59f10806a1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/hgqNJypuYE.verified.txt @@ -269,7 +269,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -277,10 +277,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/iy1QcvZOx2.verified.txt index 88b759357a..408c37f886 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/iy1QcvZOx2.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/jrSWfblfeS.verified.txt index a5289d894e..b2633581a4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/jrSWfblfeS.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/k5WWxntUWB.verified.txt index 4bae8efcfa..c489421f3b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/k5WWxntUWB.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m4VqtM7gHq.verified.txt index dbc8849521..245340e81e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m4VqtM7gHq.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m6vtJ9zTfv.verified.txt index 67ad830c4e..3b75887d60 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/m6vtJ9zTfv.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/mLWPIS3yd2.verified.txt index 21bba69772..338b5c9103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/mLWPIS3yd2.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/n7sHbRIXCw.verified.txt index d6143025c7..16ab7995d4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/n7sHbRIXCw.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nF9y283Wqy.verified.txt index 745ad08e02..7fb0b3dbef 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nF9y283Wqy.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nPDrj3Ap19.verified.txt index 0a4531ef80..ecd76fa4e5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/nPDrj3Ap19.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/oSvyQ6crWd.verified.txt index 40212d859a..c7afbcd06a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/oSvyQ6crWd.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/p4S0UBmC7f.verified.txt index e8b954a99c..82aa97977f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/p4S0UBmC7f.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/pwXSeSrgmm.verified.txt index ce90366c78..fc8c82a4cd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/pwXSeSrgmm.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/tDpDS6XRtP.verified.txt index e0e6c219a6..24a19c1a6b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/tDpDS6XRtP.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/vc8nR4GrUP.verified.txt index 648cd56162..19e6c8c708 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/vc8nR4GrUP.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/x2F1RAj3hL.verified.txt index fd4137d0a7..b1abe72f78 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/x2F1RAj3hL.verified.txt @@ -250,7 +250,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -258,10 +258,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/xwYCR0Gs5t.verified.txt index 09d28a7807..a4896871df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/xwYCR0Gs5t.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/y5C3WURWjE.verified.txt index c363f88ceb..62973930aa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/y5C3WURWjE.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yFUY8IWQLx.verified.txt index 2882886398..c1b2e50b0f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yFUY8IWQLx.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yXVwJLsc3o.verified.txt index 753705a9ab..c8d346580d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/yXVwJLsc3o.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/z5S8OyQMtF.verified.txt index cb41a413c0..9c7c02327a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/z5S8OyQMtF.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zsJ2xp8fo3.verified.txt index ada2146b0a..e36b16bc86 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zsJ2xp8fo3.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zu9CrZv1Ao.verified.txt index e50176c935..9a521f2bb9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zu9CrZv1Ao.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zywK4YpKwk.verified.txt index f2705a98d4..506ea66ea2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v3.1/zywK4YpKwk.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/01NnWIXrcn.verified.txt index f829c464b3..109acd56da 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/01NnWIXrcn.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0TqwlvOnlT.verified.txt index 092dfb3005..12851ec1df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0TqwlvOnlT.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0ZNAfNWlkE.verified.txt index 32d6270625..4e7074a6b0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/0ZNAfNWlkE.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/13cxXzX7TM.verified.txt index 0c5d674925..342f0f3448 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/13cxXzX7TM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/1QFtVlpDn8.verified.txt index 4004d7484b..2abe7570b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/1QFtVlpDn8.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/2c0dGifBVP.verified.txt index e99c5159e9..ce826b2f35 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/2c0dGifBVP.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3Giiro8Q8a.verified.txt index d99779137f..77f0069660 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3Giiro8Q8a.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3pXLwxOlTQ.verified.txt index 3b13ea24dc..58e1fd756e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/3pXLwxOlTQ.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5BpY9bPVhd.verified.txt index 6001c83b1e..8fdb291200 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5BpY9bPVhd.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5oRtW5ow6k.verified.txt index d157c62a31..37905765c1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/5oRtW5ow6k.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/682UtC0nRt.verified.txt index 8f78ba15a3..b1ec5b055d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/682UtC0nRt.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7VnqvOkqeY.verified.txt index feb0912696..6d3a5aaadd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7VnqvOkqeY.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7fIqW0n1tE.verified.txt index 23cc448c5d..a92b473827 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/7fIqW0n1tE.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8SEUfvOnjd.verified.txt index 63f677dee4..f4458abe72 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8SEUfvOnjd.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8TzJ6T6Go9.verified.txt index 6e3fe9ae12..ab44f732c7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/8TzJ6T6Go9.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/91n32T1eTx.verified.txt index ae8f8037ce..330ac62184 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/91n32T1eTx.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/ASzheSCTPW.verified.txt index 6ad59e22cb..4f4ec22780 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/ASzheSCTPW.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/CDaLgcRGEb.verified.txt index 448d6ffb04..5ede786f4e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/CDaLgcRGEb.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Cxb5K2w4um.verified.txt index 8df8dea635..c0e65f0755 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Cxb5K2w4um.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D143iuJmQ9.verified.txt index 754f4af622..49ee494d64 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D143iuJmQ9.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D5ti90Gtnc.verified.txt index 6cd62a585f..e095395d4b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/D5ti90Gtnc.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/DoB0bQElXk.verified.txt index 910ad3be70..17f0a03feb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/DoB0bQElXk.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EDRYu8H5Of.verified.txt index 1c4df6c182..7566571d03 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EDRYu8H5Of.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EFai6tQHAL.verified.txt index 8ecd96b1e1..bf83613d4d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/EFai6tQHAL.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/G4kzRbHutt.verified.txt index 81e4369487..c2e01506d3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/G4kzRbHutt.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Gf6nI9k93r.verified.txt index fce068e0b5..5aaaa1163f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Gf6nI9k93r.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GuO937nBp2.verified.txt index 8458f3862e..cfe55afc43 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GuO937nBp2.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GxLmdQIzuz.verified.txt index 088f91d0de..50095b5c5b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/GxLmdQIzuz.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/HpOb1fz8q6.verified.txt index d9165d87f1..e102f9e68e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/HpOb1fz8q6.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IDHFkHqWK3.verified.txt index 0e09cf3545..93c9309615 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IDHFkHqWK3.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IIUm0SlNvB.verified.txt index 70dfc08558..a1eaec8148 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IIUm0SlNvB.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Ia8sjkIOlf.verified.txt index 19a64140b2..115a7a780b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Ia8sjkIOlf.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IuELCZKXqm.verified.txt index 3b10848402..813c09f6fb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/IuELCZKXqm.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/KfG1verOpN.verified.txt index 5427986fda..d5bea6e25b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/KfG1verOpN.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Kh16boKdpD.verified.txt index 6105586e6f..9973dfa4aa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/Kh16boKdpD.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LFYfYZrpoJ.verified.txt index 6cd92814cc..2b1c070783 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LFYfYZrpoJ.verified.txt @@ -220,7 +220,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -228,10 +228,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LJFykMMPMi.verified.txt index db71d0d986..3a163442b3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/LJFykMMPMi.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/MZr4q8iotQ.verified.txt index 98241177c9..0e880612b6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/MZr4q8iotQ.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/O5ZNrTYaVI.verified.txt index 9907a9213c..8782335e8f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/O5ZNrTYaVI.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/OYR7FJClTd.verified.txt index 834c1c82b7..78e73a098c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/OYR7FJClTd.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PRIZHoHaqK.verified.txt index b6aa8f5d05..8c38315f9a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PRIZHoHaqK.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PVKCOm5VKp.verified.txt index 4df70341de..443c4172cb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/PVKCOm5VKp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/SOyh0mHHcC.verified.txt index 021f7c4fce..4bd3740472 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/SOyh0mHHcC.verified.txt @@ -220,7 +220,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -228,10 +228,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/TxZpwiB5Py.verified.txt index de389d0c42..988b1e7e2b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/TxZpwiB5Py.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/UoYkE8YBpS.verified.txt index 575457bdeb..f05ebcc321 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/UoYkE8YBpS.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/W0HLD96mZV.verified.txt index f686e4256e..c4d7ac17b3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/W0HLD96mZV.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XPRo52TbpR.verified.txt index 3469b4b6dc..71d5f82183 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XPRo52TbpR.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XUcwhxLebL.verified.txt index c5d59345f1..c4f78ef4b6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XUcwhxLebL.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XreN72ITLR.verified.txt index 881f984bbd..2057a03eaa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/XreN72ITLR.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/YbCUikIKwS.verified.txt index 77599c0952..ab084f68ad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/YbCUikIKwS.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/azKU9DBVTH.verified.txt index d09f2b39f9..cd60a7422d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/azKU9DBVTH.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/bY1HiMJXbA.verified.txt index deaf081fe6..5ee8cf366b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/bY1HiMJXbA.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cKervgfNdC.verified.txt index bd3cbf015f..e2a8dae296 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cKervgfNdC.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cgwp0MF0Co.verified.txt index 56b87c5c28..d7749bda75 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cgwp0MF0Co.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cxzejiZpAp.verified.txt index 4088b29855..d956429691 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cxzejiZpAp.verified.txt @@ -216,7 +216,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -224,10 +224,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cyUPie9s11.verified.txt index 0e46294c78..c72efa1349 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/cyUPie9s11.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dO4Vghni19.verified.txt index 3a6718f251..85e0870103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dO4Vghni19.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dT6HjvXbRF.verified.txt index 5357d150aa..6ef3943f03 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dT6HjvXbRF.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dxWQFs9gJB.verified.txt index f21af6767d..5b684ee2d1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/dxWQFs9gJB.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/edwx2bhfuH.verified.txt index feb010d0f7..8b0441b26e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/edwx2bhfuH.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/enQTvFpMic.verified.txt index 79a15512b2..28110f240d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/enQTvFpMic.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fDkjh4YHqJ.verified.txt index 3803d2d2ac..674ce7763c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fDkjh4YHqJ.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fHtz3V4XWi.verified.txt index e5b4573e76..ee3a9ef865 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fHtz3V4XWi.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fLYsGHdYeN.verified.txt index 7e18fa270f..91c3741bc7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fLYsGHdYeN.verified.txt @@ -235,7 +235,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -243,10 +243,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fx58SkLtj3.verified.txt index 2462df3eaa..49be1866b5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/fx58SkLtj3.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/gInCG5Y2j8.verified.txt index 7950ee81c1..00aca27810 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/gInCG5Y2j8.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/hgqNJypuYE.verified.txt index d4887e27c2..d4c48378d7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/hgqNJypuYE.verified.txt @@ -235,7 +235,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -243,10 +243,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/iy1QcvZOx2.verified.txt index 2fc9bcaefe..99c769c278 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/iy1QcvZOx2.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/jrSWfblfeS.verified.txt index fefb0171a3..425c584c2e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/jrSWfblfeS.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/k5WWxntUWB.verified.txt index 542889d7d8..7742f849e1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/k5WWxntUWB.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m4VqtM7gHq.verified.txt index 684fa9def1..995770cfe0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m4VqtM7gHq.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m6vtJ9zTfv.verified.txt index a7bae87612..2b4973c462 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/m6vtJ9zTfv.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/mLWPIS3yd2.verified.txt index b835083297..80c5f09804 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/mLWPIS3yd2.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/n7sHbRIXCw.verified.txt index 6547b90292..f0f5ca9ea2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/n7sHbRIXCw.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nF9y283Wqy.verified.txt index 698865c4e3..49c6b6a828 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nF9y283Wqy.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nPDrj3Ap19.verified.txt index 977cc70939..f70a10fc52 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/nPDrj3Ap19.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/oSvyQ6crWd.verified.txt index a993419bd0..60738accac 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/oSvyQ6crWd.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/p4S0UBmC7f.verified.txt index 6ef4f472c8..917a15546f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/p4S0UBmC7f.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/pwXSeSrgmm.verified.txt index 36537cebe5..2a3dcadd94 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/pwXSeSrgmm.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/tDpDS6XRtP.verified.txt index 23695debad..fa1300269a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/tDpDS6XRtP.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/vc8nR4GrUP.verified.txt index 5552234468..de4f5b3f92 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/vc8nR4GrUP.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/x2F1RAj3hL.verified.txt index fae75fcc3d..93de8ca055 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/x2F1RAj3hL.verified.txt @@ -216,7 +216,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -224,10 +224,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/xwYCR0Gs5t.verified.txt index 330f0a1cc1..3be01c7792 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/xwYCR0Gs5t.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/y5C3WURWjE.verified.txt index e103c67670..157a759775 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/y5C3WURWjE.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yFUY8IWQLx.verified.txt index 7049a5800b..2d29257bcd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yFUY8IWQLx.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yXVwJLsc3o.verified.txt index 14d490d7d5..8dacbc58bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/yXVwJLsc3o.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/z5S8OyQMtF.verified.txt index 55ec263ba4..96f49d9423 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/z5S8OyQMtF.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zsJ2xp8fo3.verified.txt index 5bdc22288d..7c08ce3f5e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zsJ2xp8fo3.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zu9CrZv1Ao.verified.txt index 8397278a2b..43237908e2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zu9CrZv1Ao.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zywK4YpKwk.verified.txt index a286902074..12e84d6ff9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.6.1/zywK4YpKwk.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/01NnWIXrcn.verified.txt index f829c464b3..109acd56da 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/01NnWIXrcn.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0TqwlvOnlT.verified.txt index 092dfb3005..12851ec1df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0TqwlvOnlT.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0ZNAfNWlkE.verified.txt index 32d6270625..4e7074a6b0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/0ZNAfNWlkE.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/13cxXzX7TM.verified.txt index 0c5d674925..342f0f3448 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/13cxXzX7TM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/1QFtVlpDn8.verified.txt index 4004d7484b..2abe7570b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/1QFtVlpDn8.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/2c0dGifBVP.verified.txt index e99c5159e9..ce826b2f35 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/2c0dGifBVP.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3Giiro8Q8a.verified.txt index d99779137f..77f0069660 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3Giiro8Q8a.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3pXLwxOlTQ.verified.txt index 3b13ea24dc..58e1fd756e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/3pXLwxOlTQ.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5BpY9bPVhd.verified.txt index 6001c83b1e..8fdb291200 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5BpY9bPVhd.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5oRtW5ow6k.verified.txt index d157c62a31..37905765c1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/5oRtW5ow6k.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/682UtC0nRt.verified.txt index 8f78ba15a3..b1ec5b055d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/682UtC0nRt.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7VnqvOkqeY.verified.txt index feb0912696..6d3a5aaadd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7VnqvOkqeY.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7fIqW0n1tE.verified.txt index 23cc448c5d..a92b473827 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/7fIqW0n1tE.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8SEUfvOnjd.verified.txt index 63f677dee4..f4458abe72 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8SEUfvOnjd.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8TzJ6T6Go9.verified.txt index 6e3fe9ae12..ab44f732c7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/8TzJ6T6Go9.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/91n32T1eTx.verified.txt index ae8f8037ce..330ac62184 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/91n32T1eTx.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/ASzheSCTPW.verified.txt index 6ad59e22cb..4f4ec22780 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/ASzheSCTPW.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/CDaLgcRGEb.verified.txt index 448d6ffb04..5ede786f4e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/CDaLgcRGEb.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Cxb5K2w4um.verified.txt index 8df8dea635..c0e65f0755 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Cxb5K2w4um.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D143iuJmQ9.verified.txt index 754f4af622..49ee494d64 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D143iuJmQ9.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D5ti90Gtnc.verified.txt index 6cd62a585f..e095395d4b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/D5ti90Gtnc.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/DoB0bQElXk.verified.txt index 910ad3be70..17f0a03feb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/DoB0bQElXk.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EDRYu8H5Of.verified.txt index 1c4df6c182..7566571d03 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EDRYu8H5Of.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EFai6tQHAL.verified.txt index 8ecd96b1e1..bf83613d4d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/EFai6tQHAL.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/G4kzRbHutt.verified.txt index 81e4369487..c2e01506d3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/G4kzRbHutt.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Gf6nI9k93r.verified.txt index fce068e0b5..5aaaa1163f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Gf6nI9k93r.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GuO937nBp2.verified.txt index 8458f3862e..cfe55afc43 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GuO937nBp2.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GxLmdQIzuz.verified.txt index 088f91d0de..50095b5c5b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/GxLmdQIzuz.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/HpOb1fz8q6.verified.txt index d9165d87f1..e102f9e68e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/HpOb1fz8q6.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IDHFkHqWK3.verified.txt index 0e09cf3545..93c9309615 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IDHFkHqWK3.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IIUm0SlNvB.verified.txt index 70dfc08558..a1eaec8148 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IIUm0SlNvB.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Ia8sjkIOlf.verified.txt index 19a64140b2..115a7a780b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Ia8sjkIOlf.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IuELCZKXqm.verified.txt index 3b10848402..813c09f6fb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/IuELCZKXqm.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/KfG1verOpN.verified.txt index 5427986fda..d5bea6e25b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/KfG1verOpN.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Kh16boKdpD.verified.txt index 6105586e6f..9973dfa4aa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/Kh16boKdpD.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LFYfYZrpoJ.verified.txt index 6cd92814cc..2b1c070783 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LFYfYZrpoJ.verified.txt @@ -220,7 +220,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -228,10 +228,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LJFykMMPMi.verified.txt index db71d0d986..3a163442b3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/LJFykMMPMi.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/MZr4q8iotQ.verified.txt index 98241177c9..0e880612b6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/MZr4q8iotQ.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/O5ZNrTYaVI.verified.txt index 9907a9213c..8782335e8f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/O5ZNrTYaVI.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/OYR7FJClTd.verified.txt index 834c1c82b7..78e73a098c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/OYR7FJClTd.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PRIZHoHaqK.verified.txt index b6aa8f5d05..8c38315f9a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PRIZHoHaqK.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PVKCOm5VKp.verified.txt index 4df70341de..443c4172cb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/PVKCOm5VKp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/SOyh0mHHcC.verified.txt index 021f7c4fce..4bd3740472 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/SOyh0mHHcC.verified.txt @@ -220,7 +220,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -228,10 +228,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/TxZpwiB5Py.verified.txt index de389d0c42..988b1e7e2b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/TxZpwiB5Py.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/UoYkE8YBpS.verified.txt index 575457bdeb..f05ebcc321 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/UoYkE8YBpS.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/W0HLD96mZV.verified.txt index f686e4256e..c4d7ac17b3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/W0HLD96mZV.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XPRo52TbpR.verified.txt index 3469b4b6dc..71d5f82183 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XPRo52TbpR.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XUcwhxLebL.verified.txt index c5d59345f1..c4f78ef4b6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XUcwhxLebL.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XreN72ITLR.verified.txt index 881f984bbd..2057a03eaa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/XreN72ITLR.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/YbCUikIKwS.verified.txt index 77599c0952..ab084f68ad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/YbCUikIKwS.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/azKU9DBVTH.verified.txt index d09f2b39f9..cd60a7422d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/azKU9DBVTH.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/bY1HiMJXbA.verified.txt index deaf081fe6..5ee8cf366b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/bY1HiMJXbA.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cKervgfNdC.verified.txt index bd3cbf015f..e2a8dae296 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cKervgfNdC.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cgwp0MF0Co.verified.txt index 56b87c5c28..d7749bda75 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cgwp0MF0Co.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cxzejiZpAp.verified.txt index 4088b29855..d956429691 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cxzejiZpAp.verified.txt @@ -216,7 +216,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -224,10 +224,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cyUPie9s11.verified.txt index 0e46294c78..c72efa1349 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/cyUPie9s11.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dO4Vghni19.verified.txt index 3a6718f251..85e0870103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dO4Vghni19.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dT6HjvXbRF.verified.txt index 5357d150aa..6ef3943f03 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dT6HjvXbRF.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dxWQFs9gJB.verified.txt index f21af6767d..5b684ee2d1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/dxWQFs9gJB.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/edwx2bhfuH.verified.txt index feb010d0f7..8b0441b26e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/edwx2bhfuH.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/enQTvFpMic.verified.txt index 79a15512b2..28110f240d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/enQTvFpMic.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fDkjh4YHqJ.verified.txt index 3803d2d2ac..674ce7763c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fDkjh4YHqJ.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fHtz3V4XWi.verified.txt index e5b4573e76..ee3a9ef865 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fHtz3V4XWi.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fLYsGHdYeN.verified.txt index 7e18fa270f..91c3741bc7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fLYsGHdYeN.verified.txt @@ -235,7 +235,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -243,10 +243,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fx58SkLtj3.verified.txt index 2462df3eaa..49be1866b5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/fx58SkLtj3.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/gInCG5Y2j8.verified.txt index 7950ee81c1..00aca27810 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/gInCG5Y2j8.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/hgqNJypuYE.verified.txt index d4887e27c2..d4c48378d7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/hgqNJypuYE.verified.txt @@ -235,7 +235,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -243,10 +243,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/iy1QcvZOx2.verified.txt index 2fc9bcaefe..99c769c278 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/iy1QcvZOx2.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/jrSWfblfeS.verified.txt index fefb0171a3..425c584c2e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/jrSWfblfeS.verified.txt @@ -239,7 +239,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -247,10 +247,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/k5WWxntUWB.verified.txt index 542889d7d8..7742f849e1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/k5WWxntUWB.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m4VqtM7gHq.verified.txt index 684fa9def1..995770cfe0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m4VqtM7gHq.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m6vtJ9zTfv.verified.txt index a7bae87612..2b4973c462 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/m6vtJ9zTfv.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/mLWPIS3yd2.verified.txt index b835083297..80c5f09804 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/mLWPIS3yd2.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/n7sHbRIXCw.verified.txt index 6547b90292..f0f5ca9ea2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/n7sHbRIXCw.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nF9y283Wqy.verified.txt index 698865c4e3..49c6b6a828 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nF9y283Wqy.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nPDrj3Ap19.verified.txt index 977cc70939..f70a10fc52 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/nPDrj3Ap19.verified.txt @@ -217,7 +217,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/oSvyQ6crWd.verified.txt index a993419bd0..60738accac 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/oSvyQ6crWd.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/p4S0UBmC7f.verified.txt index 6ef4f472c8..917a15546f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/p4S0UBmC7f.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/pwXSeSrgmm.verified.txt index 36537cebe5..2a3dcadd94 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/pwXSeSrgmm.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/tDpDS6XRtP.verified.txt index 23695debad..fa1300269a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/tDpDS6XRtP.verified.txt @@ -236,7 +236,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/vc8nR4GrUP.verified.txt index 5552234468..de4f5b3f92 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/vc8nR4GrUP.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/x2F1RAj3hL.verified.txt index fae75fcc3d..93de8ca055 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/x2F1RAj3hL.verified.txt @@ -216,7 +216,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -224,10 +224,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/xwYCR0Gs5t.verified.txt index 330f0a1cc1..3be01c7792 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/xwYCR0Gs5t.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/y5C3WURWjE.verified.txt index e103c67670..157a759775 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/y5C3WURWjE.verified.txt @@ -240,7 +240,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -248,10 +248,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yFUY8IWQLx.verified.txt index 7049a5800b..2d29257bcd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yFUY8IWQLx.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yXVwJLsc3o.verified.txt index 14d490d7d5..8dacbc58bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/yXVwJLsc3o.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/z5S8OyQMtF.verified.txt index 55ec263ba4..96f49d9423 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/z5S8OyQMtF.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zsJ2xp8fo3.verified.txt index 5bdc22288d..7c08ce3f5e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zsJ2xp8fo3.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zu9CrZv1Ao.verified.txt index 8397278a2b..43237908e2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zu9CrZv1Ao.verified.txt @@ -221,7 +221,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -229,10 +229,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zywK4YpKwk.verified.txt index a286902074..12e84d6ff9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v4.8/zywK4YpKwk.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/01NnWIXrcn.verified.txt index fe3860b6ca..7cc98155b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/01NnWIXrcn.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0TqwlvOnlT.verified.txt index c60ca66696..a1fdfd98c3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0TqwlvOnlT.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0ZNAfNWlkE.verified.txt index 89bcd22489..13ea92c231 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/0ZNAfNWlkE.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/13cxXzX7TM.verified.txt index dbe6e19e27..4db92ecff8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/13cxXzX7TM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/1QFtVlpDn8.verified.txt index 2c07284813..d08a802256 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/1QFtVlpDn8.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/2c0dGifBVP.verified.txt index fd7171286b..0185769003 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/2c0dGifBVP.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3Giiro8Q8a.verified.txt index 1dcf188df1..fcc2f67a56 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3Giiro8Q8a.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3pXLwxOlTQ.verified.txt index a128a3fcb2..75bfa04707 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/3pXLwxOlTQ.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5BpY9bPVhd.verified.txt index f4a86cceef..1807130c5b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5BpY9bPVhd.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5oRtW5ow6k.verified.txt index 004bbe72e6..abc9ddb8d0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/5oRtW5ow6k.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/682UtC0nRt.verified.txt index 6aeb6836bb..0ded43c196 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/682UtC0nRt.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7VnqvOkqeY.verified.txt index acc38bcde8..6043e7d999 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7VnqvOkqeY.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7fIqW0n1tE.verified.txt index 818fae97a0..84a9fc2dd6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/7fIqW0n1tE.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8SEUfvOnjd.verified.txt index 73b85a8a8e..9b204ead74 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8SEUfvOnjd.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8TzJ6T6Go9.verified.txt index b0ff0953e5..3517396a25 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/8TzJ6T6Go9.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/91n32T1eTx.verified.txt index 268dc9f906..dfd8b9454c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/91n32T1eTx.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/ASzheSCTPW.verified.txt index e7339e471b..bf10f32e42 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/ASzheSCTPW.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/CDaLgcRGEb.verified.txt index bc8dc0e2ec..167fc25b5d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/CDaLgcRGEb.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Cxb5K2w4um.verified.txt index 7579218f9a..b94f17de69 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Cxb5K2w4um.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D143iuJmQ9.verified.txt index d52ca31aae..09d652e174 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D143iuJmQ9.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D5ti90Gtnc.verified.txt index 5016c4e5bd..a16984cb42 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/D5ti90Gtnc.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/DoB0bQElXk.verified.txt index 86c8f8062d..8c965441b7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/DoB0bQElXk.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EDRYu8H5Of.verified.txt index a02e108675..25bd7571d7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EDRYu8H5Of.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EFai6tQHAL.verified.txt index b37247cb8d..67615254a9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/EFai6tQHAL.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/G4kzRbHutt.verified.txt index f9904365e0..ba56aa4361 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/G4kzRbHutt.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Gf6nI9k93r.verified.txt index 0b08f94fec..2d955055b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Gf6nI9k93r.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GuO937nBp2.verified.txt index e9bb072cd9..370d9f10de 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GuO937nBp2.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GxLmdQIzuz.verified.txt index 5e3c91aae0..6285697ee9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/GxLmdQIzuz.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/HpOb1fz8q6.verified.txt index a3255208f7..476f4f567d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/HpOb1fz8q6.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IDHFkHqWK3.verified.txt index 0df7d1a66f..e88d3faad7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IDHFkHqWK3.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IIUm0SlNvB.verified.txt index c4cc1c8f91..0e5d95f689 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IIUm0SlNvB.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Ia8sjkIOlf.verified.txt index c614521a24..35fa3b1e4d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Ia8sjkIOlf.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IuELCZKXqm.verified.txt index fcff48a844..b7bb3f08df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/IuELCZKXqm.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/KfG1verOpN.verified.txt index 0170e11541..5e3c47b156 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/KfG1verOpN.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Kh16boKdpD.verified.txt index aeadf20b3e..6450b433ae 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/Kh16boKdpD.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LFYfYZrpoJ.verified.txt index e9d63f3f74..c799004ceb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LFYfYZrpoJ.verified.txt @@ -254,7 +254,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -262,10 +262,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LJFykMMPMi.verified.txt index 5153dc6cc7..970e70ef82 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/LJFykMMPMi.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/MZr4q8iotQ.verified.txt index 1550c8bcd7..dd91c9bbff 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/MZr4q8iotQ.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/O5ZNrTYaVI.verified.txt index f97115306e..2ede8051f4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/O5ZNrTYaVI.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/OYR7FJClTd.verified.txt index 75419127a7..a9814aff26 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/OYR7FJClTd.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PRIZHoHaqK.verified.txt index 3a7445aa7b..ba1e65a7b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PRIZHoHaqK.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PVKCOm5VKp.verified.txt index 1e6d5045e4..2d7703e110 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/PVKCOm5VKp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/SOyh0mHHcC.verified.txt index 7ff0068194..eee4e108c6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/SOyh0mHHcC.verified.txt @@ -254,7 +254,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -262,10 +262,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/TxZpwiB5Py.verified.txt index 6f21ee059e..ff82524ff0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/TxZpwiB5Py.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/UoYkE8YBpS.verified.txt index befad86cdd..2c24dfff43 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/UoYkE8YBpS.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/W0HLD96mZV.verified.txt index 4197591284..006de852ee 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/W0HLD96mZV.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XPRo52TbpR.verified.txt index 180cfe7538..1493a7dab7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XPRo52TbpR.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XUcwhxLebL.verified.txt index a81aac5828..b11e228022 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XUcwhxLebL.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XreN72ITLR.verified.txt index 1571c5fb15..330ad1b24f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/XreN72ITLR.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/YbCUikIKwS.verified.txt index c778126838..0100752faf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/YbCUikIKwS.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/azKU9DBVTH.verified.txt index 9179ee6038..f1e895f496 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/azKU9DBVTH.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/bY1HiMJXbA.verified.txt index 912ffb0d9d..fd69e32283 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/bY1HiMJXbA.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cKervgfNdC.verified.txt index d1eeb7c7a3..76597fa16a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cKervgfNdC.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cgwp0MF0Co.verified.txt index a40d3e968f..aa24f4059f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cgwp0MF0Co.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cxzejiZpAp.verified.txt index 540464b7aa..2848ea0728 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cxzejiZpAp.verified.txt @@ -250,7 +250,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -258,10 +258,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cyUPie9s11.verified.txt index cf1bfb75ee..b1dac9a639 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/cyUPie9s11.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dO4Vghni19.verified.txt index 64bba1ab6f..244485d55d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dO4Vghni19.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dT6HjvXbRF.verified.txt index 7d8b9322b3..a5a6fbee74 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dT6HjvXbRF.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dxWQFs9gJB.verified.txt index b9fbe5b8b6..1b7cdd7cf3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/dxWQFs9gJB.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/edwx2bhfuH.verified.txt index 6df1d4b92f..fb12a75688 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/edwx2bhfuH.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/enQTvFpMic.verified.txt index 9e978bafea..dbebebe73e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/enQTvFpMic.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fDkjh4YHqJ.verified.txt index 17b7b6029b..ce9e1f93a3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fDkjh4YHqJ.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fHtz3V4XWi.verified.txt index 2773040a58..c21d37f2e3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fHtz3V4XWi.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fLYsGHdYeN.verified.txt index 7a1822fd00..29f62975ad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fLYsGHdYeN.verified.txt @@ -269,7 +269,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -277,10 +277,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fx58SkLtj3.verified.txt index c0c03686a8..123daf06ff 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/fx58SkLtj3.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/gInCG5Y2j8.verified.txt index 4dbb2e0fe1..2970eca94f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/gInCG5Y2j8.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/hgqNJypuYE.verified.txt index 208e9b8717..59f10806a1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/hgqNJypuYE.verified.txt @@ -269,7 +269,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -277,10 +277,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/iy1QcvZOx2.verified.txt index 88b759357a..408c37f886 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/iy1QcvZOx2.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/jrSWfblfeS.verified.txt index a5289d894e..b2633581a4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/jrSWfblfeS.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/k5WWxntUWB.verified.txt index 4bae8efcfa..c489421f3b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/k5WWxntUWB.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m4VqtM7gHq.verified.txt index dbc8849521..245340e81e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m4VqtM7gHq.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m6vtJ9zTfv.verified.txt index 67ad830c4e..3b75887d60 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/m6vtJ9zTfv.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/mLWPIS3yd2.verified.txt index 21bba69772..338b5c9103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/mLWPIS3yd2.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/n7sHbRIXCw.verified.txt index d6143025c7..16ab7995d4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/n7sHbRIXCw.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nF9y283Wqy.verified.txt index 745ad08e02..7fb0b3dbef 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nF9y283Wqy.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nPDrj3Ap19.verified.txt index 0a4531ef80..ecd76fa4e5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/nPDrj3Ap19.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/oSvyQ6crWd.verified.txt index 40212d859a..c7afbcd06a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/oSvyQ6crWd.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/p4S0UBmC7f.verified.txt index e8b954a99c..82aa97977f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/p4S0UBmC7f.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/pwXSeSrgmm.verified.txt index ce90366c78..fc8c82a4cd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/pwXSeSrgmm.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/tDpDS6XRtP.verified.txt index e0e6c219a6..24a19c1a6b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/tDpDS6XRtP.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/vc8nR4GrUP.verified.txt index 648cd56162..19e6c8c708 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/vc8nR4GrUP.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/x2F1RAj3hL.verified.txt index fd4137d0a7..b1abe72f78 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/x2F1RAj3hL.verified.txt @@ -250,7 +250,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -258,10 +258,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/xwYCR0Gs5t.verified.txt index 09d28a7807..a4896871df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/xwYCR0Gs5t.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/y5C3WURWjE.verified.txt index c363f88ceb..62973930aa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/y5C3WURWjE.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yFUY8IWQLx.verified.txt index 2882886398..c1b2e50b0f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yFUY8IWQLx.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yXVwJLsc3o.verified.txt index 753705a9ab..c8d346580d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/yXVwJLsc3o.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/z5S8OyQMtF.verified.txt index cb41a413c0..9c7c02327a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/z5S8OyQMtF.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zsJ2xp8fo3.verified.txt index ada2146b0a..e36b16bc86 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zsJ2xp8fo3.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zu9CrZv1Ao.verified.txt index e50176c935..9a521f2bb9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zu9CrZv1Ao.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zywK4YpKwk.verified.txt index f2705a98d4..506ea66ea2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v5.0/zywK4YpKwk.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/01NnWIXrcn.verified.txt index fe3860b6ca..7cc98155b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/01NnWIXrcn.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0TqwlvOnlT.verified.txt index c60ca66696..a1fdfd98c3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0TqwlvOnlT.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0ZNAfNWlkE.verified.txt index 89bcd22489..13ea92c231 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/0ZNAfNWlkE.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/13cxXzX7TM.verified.txt index dbe6e19e27..4db92ecff8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/13cxXzX7TM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/1QFtVlpDn8.verified.txt index 2c07284813..d08a802256 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/1QFtVlpDn8.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/2c0dGifBVP.verified.txt index fd7171286b..0185769003 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/2c0dGifBVP.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3Giiro8Q8a.verified.txt index 1dcf188df1..fcc2f67a56 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3Giiro8Q8a.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3pXLwxOlTQ.verified.txt index a128a3fcb2..75bfa04707 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/3pXLwxOlTQ.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5BpY9bPVhd.verified.txt index f4a86cceef..1807130c5b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5BpY9bPVhd.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5oRtW5ow6k.verified.txt index 004bbe72e6..abc9ddb8d0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/5oRtW5ow6k.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/682UtC0nRt.verified.txt index 6aeb6836bb..0ded43c196 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/682UtC0nRt.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7VnqvOkqeY.verified.txt index acc38bcde8..6043e7d999 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7VnqvOkqeY.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7fIqW0n1tE.verified.txt index 818fae97a0..84a9fc2dd6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/7fIqW0n1tE.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8SEUfvOnjd.verified.txt index 73b85a8a8e..9b204ead74 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8SEUfvOnjd.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8TzJ6T6Go9.verified.txt index b0ff0953e5..3517396a25 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/8TzJ6T6Go9.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/91n32T1eTx.verified.txt index 268dc9f906..dfd8b9454c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/91n32T1eTx.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/ASzheSCTPW.verified.txt index e7339e471b..bf10f32e42 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/ASzheSCTPW.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/CDaLgcRGEb.verified.txt index bc8dc0e2ec..167fc25b5d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/CDaLgcRGEb.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Cxb5K2w4um.verified.txt index 7579218f9a..b94f17de69 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Cxb5K2w4um.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D143iuJmQ9.verified.txt index d52ca31aae..09d652e174 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D143iuJmQ9.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D5ti90Gtnc.verified.txt index 5016c4e5bd..a16984cb42 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/D5ti90Gtnc.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/DoB0bQElXk.verified.txt index 86c8f8062d..8c965441b7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/DoB0bQElXk.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EDRYu8H5Of.verified.txt index a02e108675..25bd7571d7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EDRYu8H5Of.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EFai6tQHAL.verified.txt index b37247cb8d..67615254a9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/EFai6tQHAL.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/G4kzRbHutt.verified.txt index f9904365e0..ba56aa4361 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/G4kzRbHutt.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Gf6nI9k93r.verified.txt index 0b08f94fec..2d955055b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Gf6nI9k93r.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GuO937nBp2.verified.txt index e9bb072cd9..370d9f10de 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GuO937nBp2.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GxLmdQIzuz.verified.txt index 5e3c91aae0..6285697ee9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/GxLmdQIzuz.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/HpOb1fz8q6.verified.txt index a3255208f7..476f4f567d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/HpOb1fz8q6.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IDHFkHqWK3.verified.txt index 0df7d1a66f..e88d3faad7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IDHFkHqWK3.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IIUm0SlNvB.verified.txt index c4cc1c8f91..0e5d95f689 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IIUm0SlNvB.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Ia8sjkIOlf.verified.txt index c614521a24..35fa3b1e4d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Ia8sjkIOlf.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IuELCZKXqm.verified.txt index fcff48a844..b7bb3f08df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/IuELCZKXqm.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/KfG1verOpN.verified.txt index 0170e11541..5e3c47b156 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/KfG1verOpN.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Kh16boKdpD.verified.txt index aeadf20b3e..6450b433ae 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/Kh16boKdpD.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LFYfYZrpoJ.verified.txt index e9d63f3f74..c799004ceb 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LFYfYZrpoJ.verified.txt @@ -254,7 +254,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -262,10 +262,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LJFykMMPMi.verified.txt index 5153dc6cc7..970e70ef82 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/LJFykMMPMi.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/MZr4q8iotQ.verified.txt index 1550c8bcd7..dd91c9bbff 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/MZr4q8iotQ.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/O5ZNrTYaVI.verified.txt index f97115306e..2ede8051f4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/O5ZNrTYaVI.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/OYR7FJClTd.verified.txt index 75419127a7..a9814aff26 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/OYR7FJClTd.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PRIZHoHaqK.verified.txt index 3a7445aa7b..ba1e65a7b8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PRIZHoHaqK.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PVKCOm5VKp.verified.txt index 1e6d5045e4..2d7703e110 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/PVKCOm5VKp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/SOyh0mHHcC.verified.txt index 7ff0068194..eee4e108c6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/SOyh0mHHcC.verified.txt @@ -254,7 +254,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -262,10 +262,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/TxZpwiB5Py.verified.txt index 6f21ee059e..ff82524ff0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/TxZpwiB5Py.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/UoYkE8YBpS.verified.txt index befad86cdd..2c24dfff43 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/UoYkE8YBpS.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/W0HLD96mZV.verified.txt index 4197591284..006de852ee 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/W0HLD96mZV.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XPRo52TbpR.verified.txt index 180cfe7538..1493a7dab7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XPRo52TbpR.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XUcwhxLebL.verified.txt index a81aac5828..b11e228022 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XUcwhxLebL.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XreN72ITLR.verified.txt index 1571c5fb15..330ad1b24f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/XreN72ITLR.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/YbCUikIKwS.verified.txt index c778126838..0100752faf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/YbCUikIKwS.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/azKU9DBVTH.verified.txt index 9179ee6038..f1e895f496 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/azKU9DBVTH.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/bY1HiMJXbA.verified.txt index 912ffb0d9d..fd69e32283 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/bY1HiMJXbA.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cKervgfNdC.verified.txt index d1eeb7c7a3..76597fa16a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cKervgfNdC.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cgwp0MF0Co.verified.txt index a40d3e968f..aa24f4059f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cgwp0MF0Co.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cxzejiZpAp.verified.txt index 540464b7aa..2848ea0728 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cxzejiZpAp.verified.txt @@ -250,7 +250,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -258,10 +258,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cyUPie9s11.verified.txt index cf1bfb75ee..b1dac9a639 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/cyUPie9s11.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dO4Vghni19.verified.txt index 64bba1ab6f..244485d55d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dO4Vghni19.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dT6HjvXbRF.verified.txt index 7d8b9322b3..a5a6fbee74 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dT6HjvXbRF.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dxWQFs9gJB.verified.txt index b9fbe5b8b6..1b7cdd7cf3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/dxWQFs9gJB.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/edwx2bhfuH.verified.txt index 6df1d4b92f..fb12a75688 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/edwx2bhfuH.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/enQTvFpMic.verified.txt index 9e978bafea..dbebebe73e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/enQTvFpMic.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fDkjh4YHqJ.verified.txt index 17b7b6029b..ce9e1f93a3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fDkjh4YHqJ.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fHtz3V4XWi.verified.txt index 2773040a58..c21d37f2e3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fHtz3V4XWi.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fLYsGHdYeN.verified.txt index 7a1822fd00..29f62975ad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fLYsGHdYeN.verified.txt @@ -269,7 +269,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -277,10 +277,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fx58SkLtj3.verified.txt index c0c03686a8..123daf06ff 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/fx58SkLtj3.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/gInCG5Y2j8.verified.txt index 4dbb2e0fe1..2970eca94f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/gInCG5Y2j8.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/hgqNJypuYE.verified.txt index 208e9b8717..59f10806a1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/hgqNJypuYE.verified.txt @@ -269,7 +269,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -277,10 +277,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/iy1QcvZOx2.verified.txt index 88b759357a..408c37f886 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/iy1QcvZOx2.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/jrSWfblfeS.verified.txt index a5289d894e..b2633581a4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/jrSWfblfeS.verified.txt @@ -273,7 +273,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -281,10 +281,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/k5WWxntUWB.verified.txt index 4bae8efcfa..c489421f3b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/k5WWxntUWB.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m4VqtM7gHq.verified.txt index dbc8849521..245340e81e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m4VqtM7gHq.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m6vtJ9zTfv.verified.txt index 67ad830c4e..3b75887d60 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/m6vtJ9zTfv.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/mLWPIS3yd2.verified.txt index 21bba69772..338b5c9103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/mLWPIS3yd2.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/n7sHbRIXCw.verified.txt index d6143025c7..16ab7995d4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/n7sHbRIXCw.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nF9y283Wqy.verified.txt index 745ad08e02..7fb0b3dbef 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nF9y283Wqy.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nPDrj3Ap19.verified.txt index 0a4531ef80..ecd76fa4e5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/nPDrj3Ap19.verified.txt @@ -251,7 +251,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/oSvyQ6crWd.verified.txt index 40212d859a..c7afbcd06a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/oSvyQ6crWd.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/p4S0UBmC7f.verified.txt index e8b954a99c..82aa97977f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/p4S0UBmC7f.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/pwXSeSrgmm.verified.txt index ce90366c78..fc8c82a4cd 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/pwXSeSrgmm.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/tDpDS6XRtP.verified.txt index e0e6c219a6..24a19c1a6b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/tDpDS6XRtP.verified.txt @@ -270,7 +270,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/vc8nR4GrUP.verified.txt index 648cd56162..19e6c8c708 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/vc8nR4GrUP.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/x2F1RAj3hL.verified.txt index fd4137d0a7..b1abe72f78 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/x2F1RAj3hL.verified.txt @@ -250,7 +250,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -258,10 +258,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/xwYCR0Gs5t.verified.txt index 09d28a7807..a4896871df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/xwYCR0Gs5t.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/y5C3WURWjE.verified.txt index c363f88ceb..62973930aa 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/y5C3WURWjE.verified.txt @@ -274,7 +274,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -282,10 +282,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yFUY8IWQLx.verified.txt index 2882886398..c1b2e50b0f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yFUY8IWQLx.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yXVwJLsc3o.verified.txt index 753705a9ab..c8d346580d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/yXVwJLsc3o.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/z5S8OyQMtF.verified.txt index cb41a413c0..9c7c02327a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/z5S8OyQMtF.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zsJ2xp8fo3.verified.txt index ada2146b0a..e36b16bc86 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zsJ2xp8fo3.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zu9CrZv1Ao.verified.txt index e50176c935..9a521f2bb9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zu9CrZv1Ao.verified.txt @@ -255,7 +255,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -263,10 +263,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zywK4YpKwk.verified.txt index f2705a98d4..506ea66ea2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v6.0/zywK4YpKwk.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/01NnWIXrcn.verified.txt index 7f8bc83dcd..97a3048a18 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/01NnWIXrcn.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0TqwlvOnlT.verified.txt index 5e238d9730..abfd035d0e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0TqwlvOnlT.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0ZNAfNWlkE.verified.txt index cc6b36fb29..524c5d15d8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/0ZNAfNWlkE.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/13cxXzX7TM.verified.txt index c167e8e589..9fb814a0b3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/13cxXzX7TM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/1QFtVlpDn8.verified.txt index 5b488eeeaa..5ac80bd951 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/1QFtVlpDn8.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/2c0dGifBVP.verified.txt index 31061fb513..98ef89f3d5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/2c0dGifBVP.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3Giiro8Q8a.verified.txt index 18fe5c0eb3..9c890abe0a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3Giiro8Q8a.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3pXLwxOlTQ.verified.txt index d4ee4dadbb..dedae1a0a3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/3pXLwxOlTQ.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5BpY9bPVhd.verified.txt index 4a50001491..68c5bfef93 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5BpY9bPVhd.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5oRtW5ow6k.verified.txt index 6dcbbb303e..4aaf0436d2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/5oRtW5ow6k.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/682UtC0nRt.verified.txt index d032f9c832..d64c431404 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/682UtC0nRt.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7VnqvOkqeY.verified.txt index f6877ff4f6..2f87258546 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7VnqvOkqeY.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7fIqW0n1tE.verified.txt index 30d2a17b70..eb5013817f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/7fIqW0n1tE.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8SEUfvOnjd.verified.txt index 7475c81427..2f6f56544a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8SEUfvOnjd.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8TzJ6T6Go9.verified.txt index d650402a95..c6e294efe3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/8TzJ6T6Go9.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/91n32T1eTx.verified.txt index 67cc9b5083..c02a970aa9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/91n32T1eTx.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/ASzheSCTPW.verified.txt index 2f13f7341b..a311dd9b69 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/ASzheSCTPW.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/CDaLgcRGEb.verified.txt index d304aa50f0..d8804dc4a0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/CDaLgcRGEb.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Cxb5K2w4um.verified.txt index a82aa72a19..9c50c213d4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Cxb5K2w4um.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D143iuJmQ9.verified.txt index 87a16a54b7..f7bf70cd75 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D143iuJmQ9.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D5ti90Gtnc.verified.txt index 4ee0a9ed62..d7ba57026e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/D5ti90Gtnc.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/DoB0bQElXk.verified.txt index 41eb98f1df..7662991284 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/DoB0bQElXk.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EDRYu8H5Of.verified.txt index 12e3f23edf..ccb0141d60 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EDRYu8H5Of.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EFai6tQHAL.verified.txt index 57606e92b5..411e354b04 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/EFai6tQHAL.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/G4kzRbHutt.verified.txt index 2605db86b3..fdae22646e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/G4kzRbHutt.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Gf6nI9k93r.verified.txt index 8356280f84..866ba329f9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Gf6nI9k93r.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GuO937nBp2.verified.txt index 4ac60dd626..27d131844b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GuO937nBp2.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GxLmdQIzuz.verified.txt index aa3e6146a4..a49a87cd2f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/GxLmdQIzuz.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/HpOb1fz8q6.verified.txt index 23c7542d87..876876d790 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/HpOb1fz8q6.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IDHFkHqWK3.verified.txt index 4e04b67ee9..0c6ef9c81f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IDHFkHqWK3.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IIUm0SlNvB.verified.txt index 659fc5f10e..4e75ee341b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IIUm0SlNvB.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Ia8sjkIOlf.verified.txt index 7cabf32316..9041fdc24b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Ia8sjkIOlf.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IuELCZKXqm.verified.txt index 83b06d0d0f..d88a96258b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/IuELCZKXqm.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/KfG1verOpN.verified.txt index 9d7bb210a9..0515b028df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/KfG1verOpN.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Kh16boKdpD.verified.txt index 03111148af..b4f4f2b2c5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/Kh16boKdpD.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LFYfYZrpoJ.verified.txt index f338462e55..19a157e73c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LFYfYZrpoJ.verified.txt @@ -322,7 +322,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -330,10 +330,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LJFykMMPMi.verified.txt index e421012e59..ade0d7478c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/LJFykMMPMi.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/MZr4q8iotQ.verified.txt index b5a577f8ee..9c8a1bd40d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/MZr4q8iotQ.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/O5ZNrTYaVI.verified.txt index ba0c04a0db..1d93705fad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/O5ZNrTYaVI.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/OYR7FJClTd.verified.txt index 011947643b..ebbbf32700 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/OYR7FJClTd.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PRIZHoHaqK.verified.txt index 370c82ed76..8b2d3e5dcf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PRIZHoHaqK.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PVKCOm5VKp.verified.txt index 3c9ea5d9e0..4f79ec4564 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/PVKCOm5VKp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/SOyh0mHHcC.verified.txt index 3793e4823f..577a7bd0d6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/SOyh0mHHcC.verified.txt @@ -322,7 +322,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -330,10 +330,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/TxZpwiB5Py.verified.txt index 8ab70ca99b..ad5c20ea24 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/TxZpwiB5Py.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/UoYkE8YBpS.verified.txt index 67723ab745..af987bc09f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/UoYkE8YBpS.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/W0HLD96mZV.verified.txt index ccb2996f15..a17434c0bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/W0HLD96mZV.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XPRo52TbpR.verified.txt index e211124f7b..a12d00a1bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XPRo52TbpR.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XUcwhxLebL.verified.txt index f1ec62e7c1..584335781a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XUcwhxLebL.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XreN72ITLR.verified.txt index d053e7397d..55089a984f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/XreN72ITLR.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/YbCUikIKwS.verified.txt index 2cb9dc6626..545ef6ad3c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/YbCUikIKwS.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/azKU9DBVTH.verified.txt index ce8239eb60..f67b6dde1c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/azKU9DBVTH.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/bY1HiMJXbA.verified.txt index 9049fc64f7..67ab8e9726 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/bY1HiMJXbA.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cKervgfNdC.verified.txt index 35b45a7af4..ef0cabaaa7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cKervgfNdC.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cgwp0MF0Co.verified.txt index 98add83af2..e6d850a6bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cgwp0MF0Co.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cxzejiZpAp.verified.txt index fdae7e50c6..80b91852ac 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cxzejiZpAp.verified.txt @@ -318,7 +318,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -326,10 +326,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cyUPie9s11.verified.txt index 2e0dd80fcc..e101eb40b7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/cyUPie9s11.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dO4Vghni19.verified.txt index 44fff7f9b4..f8d62c2a87 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dO4Vghni19.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dT6HjvXbRF.verified.txt index 20b16849f8..188632e847 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dT6HjvXbRF.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dxWQFs9gJB.verified.txt index b98c5835d6..9fe3c75c30 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/dxWQFs9gJB.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/edwx2bhfuH.verified.txt index fdd42de4c0..16a18c118a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/edwx2bhfuH.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/enQTvFpMic.verified.txt index 08e1e8254a..7d0f7863e5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/enQTvFpMic.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fDkjh4YHqJ.verified.txt index 5a2731025d..59c78a8103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fDkjh4YHqJ.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fHtz3V4XWi.verified.txt index a6592d7e30..9d1e50c0a5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fHtz3V4XWi.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fLYsGHdYeN.verified.txt index a346797cbe..4dfe43379b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fLYsGHdYeN.verified.txt @@ -337,7 +337,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -345,10 +345,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fx58SkLtj3.verified.txt index 13cc5f0865..a2857b8948 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/fx58SkLtj3.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/gInCG5Y2j8.verified.txt index 2ba53ff379..7274cace89 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/gInCG5Y2j8.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/hgqNJypuYE.verified.txt index 26e6435d87..cb1d3c659f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/hgqNJypuYE.verified.txt @@ -337,7 +337,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -345,10 +345,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/iy1QcvZOx2.verified.txt index 07b7f9fe60..02521c2d68 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/iy1QcvZOx2.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/jrSWfblfeS.verified.txt index 896afb83e7..9b4ef0d660 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/jrSWfblfeS.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/k5WWxntUWB.verified.txt index 033b56cff8..4946239274 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/k5WWxntUWB.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m4VqtM7gHq.verified.txt index d000c575ba..cb8c43d555 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m4VqtM7gHq.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m6vtJ9zTfv.verified.txt index 01b2d4add3..f96a70afb9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/m6vtJ9zTfv.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/mLWPIS3yd2.verified.txt index f051f2206b..b81787db23 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/mLWPIS3yd2.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/n7sHbRIXCw.verified.txt index f95e79e679..68e9532e76 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/n7sHbRIXCw.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nF9y283Wqy.verified.txt index 63e85cb19a..51f431147c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nF9y283Wqy.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nPDrj3Ap19.verified.txt index 9667d834e7..f93e93a048 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/nPDrj3Ap19.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/oSvyQ6crWd.verified.txt index 17faf6bca8..b5fcf5a23f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/oSvyQ6crWd.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/p4S0UBmC7f.verified.txt index 77b1d481ca..9039b879e3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/p4S0UBmC7f.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/pwXSeSrgmm.verified.txt index 38928cecf4..e623eca678 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/pwXSeSrgmm.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/tDpDS6XRtP.verified.txt index 3b7d1e774d..efb8afe14d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/tDpDS6XRtP.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/vc8nR4GrUP.verified.txt index 03b3a2ed44..86c066f31f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/vc8nR4GrUP.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/x2F1RAj3hL.verified.txt index fdf1491536..7cd5c1a3e7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/x2F1RAj3hL.verified.txt @@ -318,7 +318,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -326,10 +326,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/xwYCR0Gs5t.verified.txt index febaae581d..ed946d3298 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/xwYCR0Gs5t.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/y5C3WURWjE.verified.txt index 110da1939d..9139069a9d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/y5C3WURWjE.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yFUY8IWQLx.verified.txt index 691a1fbeec..bad24f1a59 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yFUY8IWQLx.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yXVwJLsc3o.verified.txt index f2c1310598..664d8cea91 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/yXVwJLsc3o.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/z5S8OyQMtF.verified.txt index 5242259c84..1e2121fa83 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/z5S8OyQMtF.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zsJ2xp8fo3.verified.txt index 4ebdf6b32c..aee3b90ef1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zsJ2xp8fo3.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zu9CrZv1Ao.verified.txt index ac8069b953..ecd7a83783 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zu9CrZv1Ao.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zywK4YpKwk.verified.txt index 04c2d24d34..61a43ef1cf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v7.0/zywK4YpKwk.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/01NnWIXrcn.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/01NnWIXrcn.verified.txt index 7f8bc83dcd..97a3048a18 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/01NnWIXrcn.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/01NnWIXrcn.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0TqwlvOnlT.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0TqwlvOnlT.verified.txt index 5e238d9730..abfd035d0e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0TqwlvOnlT.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0TqwlvOnlT.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0ZNAfNWlkE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0ZNAfNWlkE.verified.txt index cc6b36fb29..524c5d15d8 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0ZNAfNWlkE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/0ZNAfNWlkE.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/13cxXzX7TM.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/13cxXzX7TM.verified.txt index c167e8e589..9fb814a0b3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/13cxXzX7TM.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/13cxXzX7TM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/1QFtVlpDn8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/1QFtVlpDn8.verified.txt index 5b488eeeaa..5ac80bd951 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/1QFtVlpDn8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/1QFtVlpDn8.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/2c0dGifBVP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/2c0dGifBVP.verified.txt index 31061fb513..98ef89f3d5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/2c0dGifBVP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/2c0dGifBVP.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3Giiro8Q8a.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3Giiro8Q8a.verified.txt index 18fe5c0eb3..9c890abe0a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3Giiro8Q8a.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3Giiro8Q8a.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3pXLwxOlTQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3pXLwxOlTQ.verified.txt index d4ee4dadbb..dedae1a0a3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3pXLwxOlTQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/3pXLwxOlTQ.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5BpY9bPVhd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5BpY9bPVhd.verified.txt index 4a50001491..68c5bfef93 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5BpY9bPVhd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5BpY9bPVhd.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5oRtW5ow6k.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5oRtW5ow6k.verified.txt index 6dcbbb303e..4aaf0436d2 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5oRtW5ow6k.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/5oRtW5ow6k.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/682UtC0nRt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/682UtC0nRt.verified.txt index d032f9c832..d64c431404 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/682UtC0nRt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/682UtC0nRt.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7VnqvOkqeY.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7VnqvOkqeY.verified.txt index f6877ff4f6..2f87258546 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7VnqvOkqeY.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7VnqvOkqeY.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7fIqW0n1tE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7fIqW0n1tE.verified.txt index 30d2a17b70..eb5013817f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7fIqW0n1tE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/7fIqW0n1tE.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8SEUfvOnjd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8SEUfvOnjd.verified.txt index 7475c81427..2f6f56544a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8SEUfvOnjd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8SEUfvOnjd.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8TzJ6T6Go9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8TzJ6T6Go9.verified.txt index d650402a95..c6e294efe3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8TzJ6T6Go9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/8TzJ6T6Go9.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/91n32T1eTx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/91n32T1eTx.verified.txt index 67cc9b5083..c02a970aa9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/91n32T1eTx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/91n32T1eTx.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/ASzheSCTPW.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/ASzheSCTPW.verified.txt index 2f13f7341b..a311dd9b69 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/ASzheSCTPW.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/ASzheSCTPW.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/CDaLgcRGEb.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/CDaLgcRGEb.verified.txt index d304aa50f0..d8804dc4a0 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/CDaLgcRGEb.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/CDaLgcRGEb.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Cxb5K2w4um.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Cxb5K2w4um.verified.txt index a82aa72a19..9c50c213d4 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Cxb5K2w4um.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Cxb5K2w4um.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D143iuJmQ9.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D143iuJmQ9.verified.txt index 87a16a54b7..f7bf70cd75 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D143iuJmQ9.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D143iuJmQ9.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D5ti90Gtnc.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D5ti90Gtnc.verified.txt index 4ee0a9ed62..d7ba57026e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D5ti90Gtnc.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/D5ti90Gtnc.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/DoB0bQElXk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/DoB0bQElXk.verified.txt index 41eb98f1df..7662991284 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/DoB0bQElXk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/DoB0bQElXk.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EDRYu8H5Of.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EDRYu8H5Of.verified.txt index 12e3f23edf..ccb0141d60 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EDRYu8H5Of.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EDRYu8H5Of.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EFai6tQHAL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EFai6tQHAL.verified.txt index 57606e92b5..411e354b04 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EFai6tQHAL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/EFai6tQHAL.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/G4kzRbHutt.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/G4kzRbHutt.verified.txt index 2605db86b3..fdae22646e 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/G4kzRbHutt.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/G4kzRbHutt.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Gf6nI9k93r.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Gf6nI9k93r.verified.txt index 8356280f84..866ba329f9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Gf6nI9k93r.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Gf6nI9k93r.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GuO937nBp2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GuO937nBp2.verified.txt index 4ac60dd626..27d131844b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GuO937nBp2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GuO937nBp2.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GxLmdQIzuz.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GxLmdQIzuz.verified.txt index aa3e6146a4..a49a87cd2f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GxLmdQIzuz.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/GxLmdQIzuz.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/HpOb1fz8q6.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/HpOb1fz8q6.verified.txt index 23c7542d87..876876d790 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/HpOb1fz8q6.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/HpOb1fz8q6.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IDHFkHqWK3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IDHFkHqWK3.verified.txt index 4e04b67ee9..0c6ef9c81f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IDHFkHqWK3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IDHFkHqWK3.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IIUm0SlNvB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IIUm0SlNvB.verified.txt index 659fc5f10e..4e75ee341b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IIUm0SlNvB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IIUm0SlNvB.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Ia8sjkIOlf.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Ia8sjkIOlf.verified.txt index 7cabf32316..9041fdc24b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Ia8sjkIOlf.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Ia8sjkIOlf.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IuELCZKXqm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IuELCZKXqm.verified.txt index 83b06d0d0f..d88a96258b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IuELCZKXqm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/IuELCZKXqm.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/KfG1verOpN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/KfG1verOpN.verified.txt index 9d7bb210a9..0515b028df 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/KfG1verOpN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/KfG1verOpN.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Kh16boKdpD.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Kh16boKdpD.verified.txt index 03111148af..b4f4f2b2c5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Kh16boKdpD.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/Kh16boKdpD.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LFYfYZrpoJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LFYfYZrpoJ.verified.txt index f338462e55..19a157e73c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LFYfYZrpoJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LFYfYZrpoJ.verified.txt @@ -322,7 +322,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -330,10 +330,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LJFykMMPMi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LJFykMMPMi.verified.txt index e421012e59..ade0d7478c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LJFykMMPMi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/LJFykMMPMi.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/MZr4q8iotQ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/MZr4q8iotQ.verified.txt index b5a577f8ee..9c8a1bd40d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/MZr4q8iotQ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/MZr4q8iotQ.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/O5ZNrTYaVI.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/O5ZNrTYaVI.verified.txt index ba0c04a0db..1d93705fad 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/O5ZNrTYaVI.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/O5ZNrTYaVI.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/OYR7FJClTd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/OYR7FJClTd.verified.txt index 011947643b..ebbbf32700 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/OYR7FJClTd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/OYR7FJClTd.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PRIZHoHaqK.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PRIZHoHaqK.verified.txt index 370c82ed76..8b2d3e5dcf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PRIZHoHaqK.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PRIZHoHaqK.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PVKCOm5VKp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PVKCOm5VKp.verified.txt index 3c9ea5d9e0..4f79ec4564 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PVKCOm5VKp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/PVKCOm5VKp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/SOyh0mHHcC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/SOyh0mHHcC.verified.txt index 3793e4823f..577a7bd0d6 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/SOyh0mHHcC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/SOyh0mHHcC.verified.txt @@ -322,7 +322,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -330,10 +330,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/TxZpwiB5Py.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/TxZpwiB5Py.verified.txt index 8ab70ca99b..ad5c20ea24 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/TxZpwiB5Py.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/TxZpwiB5Py.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/UoYkE8YBpS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/UoYkE8YBpS.verified.txt index 67723ab745..af987bc09f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/UoYkE8YBpS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/UoYkE8YBpS.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/W0HLD96mZV.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/W0HLD96mZV.verified.txt index ccb2996f15..a17434c0bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/W0HLD96mZV.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/W0HLD96mZV.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XPRo52TbpR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XPRo52TbpR.verified.txt index e211124f7b..a12d00a1bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XPRo52TbpR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XPRo52TbpR.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XUcwhxLebL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XUcwhxLebL.verified.txt index f1ec62e7c1..584335781a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XUcwhxLebL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XUcwhxLebL.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XreN72ITLR.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XreN72ITLR.verified.txt index d053e7397d..55089a984f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XreN72ITLR.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/XreN72ITLR.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/YbCUikIKwS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/YbCUikIKwS.verified.txt index 2cb9dc6626..545ef6ad3c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/YbCUikIKwS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/YbCUikIKwS.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/azKU9DBVTH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/azKU9DBVTH.verified.txt index ce8239eb60..f67b6dde1c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/azKU9DBVTH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/azKU9DBVTH.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/bY1HiMJXbA.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/bY1HiMJXbA.verified.txt index 9049fc64f7..67ab8e9726 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/bY1HiMJXbA.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/bY1HiMJXbA.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cKervgfNdC.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cKervgfNdC.verified.txt index 35b45a7af4..ef0cabaaa7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cKervgfNdC.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cKervgfNdC.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cgwp0MF0Co.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cgwp0MF0Co.verified.txt index 98add83af2..e6d850a6bf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cgwp0MF0Co.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cgwp0MF0Co.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cxzejiZpAp.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cxzejiZpAp.verified.txt index fdae7e50c6..80b91852ac 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cxzejiZpAp.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cxzejiZpAp.verified.txt @@ -318,7 +318,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -326,10 +326,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cyUPie9s11.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cyUPie9s11.verified.txt index 2e0dd80fcc..e101eb40b7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cyUPie9s11.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/cyUPie9s11.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dO4Vghni19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dO4Vghni19.verified.txt index 44fff7f9b4..f8d62c2a87 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dO4Vghni19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dO4Vghni19.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dT6HjvXbRF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dT6HjvXbRF.verified.txt index 20b16849f8..188632e847 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dT6HjvXbRF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dT6HjvXbRF.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dxWQFs9gJB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dxWQFs9gJB.verified.txt index b98c5835d6..9fe3c75c30 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dxWQFs9gJB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/dxWQFs9gJB.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/edwx2bhfuH.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/edwx2bhfuH.verified.txt index fdd42de4c0..16a18c118a 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/edwx2bhfuH.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/edwx2bhfuH.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/enQTvFpMic.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/enQTvFpMic.verified.txt index 08e1e8254a..7d0f7863e5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/enQTvFpMic.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/enQTvFpMic.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fDkjh4YHqJ.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fDkjh4YHqJ.verified.txt index 5a2731025d..59c78a8103 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fDkjh4YHqJ.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fDkjh4YHqJ.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fHtz3V4XWi.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fHtz3V4XWi.verified.txt index a6592d7e30..9d1e50c0a5 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fHtz3V4XWi.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fHtz3V4XWi.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fLYsGHdYeN.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fLYsGHdYeN.verified.txt index a346797cbe..4dfe43379b 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fLYsGHdYeN.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fLYsGHdYeN.verified.txt @@ -337,7 +337,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -345,10 +345,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fx58SkLtj3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fx58SkLtj3.verified.txt index 13cc5f0865..a2857b8948 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fx58SkLtj3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/fx58SkLtj3.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/gInCG5Y2j8.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/gInCG5Y2j8.verified.txt index 2ba53ff379..7274cace89 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/gInCG5Y2j8.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/gInCG5Y2j8.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/hgqNJypuYE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/hgqNJypuYE.verified.txt index 26e6435d87..cb1d3c659f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/hgqNJypuYE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/hgqNJypuYE.verified.txt @@ -337,7 +337,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -345,10 +345,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/iy1QcvZOx2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/iy1QcvZOx2.verified.txt index 07b7f9fe60..02521c2d68 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/iy1QcvZOx2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/iy1QcvZOx2.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/jrSWfblfeS.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/jrSWfblfeS.verified.txt index 896afb83e7..9b4ef0d660 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/jrSWfblfeS.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/jrSWfblfeS.verified.txt @@ -341,7 +341,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -349,10 +349,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/k5WWxntUWB.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/k5WWxntUWB.verified.txt index 033b56cff8..4946239274 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/k5WWxntUWB.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/k5WWxntUWB.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m4VqtM7gHq.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m4VqtM7gHq.verified.txt index d000c575ba..cb8c43d555 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m4VqtM7gHq.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m4VqtM7gHq.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m6vtJ9zTfv.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m6vtJ9zTfv.verified.txt index 01b2d4add3..f96a70afb9 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m6vtJ9zTfv.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/m6vtJ9zTfv.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/mLWPIS3yd2.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/mLWPIS3yd2.verified.txt index f051f2206b..b81787db23 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/mLWPIS3yd2.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/mLWPIS3yd2.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/n7sHbRIXCw.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/n7sHbRIXCw.verified.txt index f95e79e679..68e9532e76 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/n7sHbRIXCw.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/n7sHbRIXCw.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nF9y283Wqy.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nF9y283Wqy.verified.txt index 63e85cb19a..51f431147c 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nF9y283Wqy.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nF9y283Wqy.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nPDrj3Ap19.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nPDrj3Ap19.verified.txt index 9667d834e7..f93e93a048 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nPDrj3Ap19.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/nPDrj3Ap19.verified.txt @@ -319,7 +319,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/oSvyQ6crWd.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/oSvyQ6crWd.verified.txt index 17faf6bca8..b5fcf5a23f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/oSvyQ6crWd.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/oSvyQ6crWd.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_structCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/p4S0UBmC7f.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/p4S0UBmC7f.verified.txt index 77b1d481ca..9039b879e3 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/p4S0UBmC7f.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/p4S0UBmC7f.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/pwXSeSrgmm.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/pwXSeSrgmm.verified.txt index 38928cecf4..e623eca678 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/pwXSeSrgmm.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/pwXSeSrgmm.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/tDpDS6XRtP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/tDpDS6XRtP.verified.txt index 3b7d1e774d..efb8afe14d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/tDpDS6XRtP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/tDpDS6XRtP.verified.txt @@ -338,7 +338,7 @@ public System.Guid Value { public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/vc8nR4GrUP.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/vc8nR4GrUP.verified.txt index 03b3a2ed44..86c066f31f 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/vc8nR4GrUP.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/vc8nR4GrUP.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_recordCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/x2F1RAj3hL.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/x2F1RAj3hL.verified.txt index fdf1491536..7cd5c1a3e7 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/x2F1RAj3hL.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/x2F1RAj3hL.verified.txt @@ -318,7 +318,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -326,10 +326,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_ImplicitCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/xwYCR0Gs5t.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/xwYCR0Gs5t.verified.txt index febaae581d..ed946d3298 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/xwYCR0Gs5t.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/xwYCR0Gs5t.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ImplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/y5C3WURWjE.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/y5C3WURWjE.verified.txt index 110da1939d..9139069a9d 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/y5C3WURWjE.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/y5C3WURWjE.verified.txt @@ -342,7 +342,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -350,10 +350,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yFUY8IWQLx.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yFUY8IWQLx.verified.txt index 691a1fbeec..bad24f1a59 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yFUY8IWQLx.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yFUY8IWQLx.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_structCastOperator_NoneCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yXVwJLsc3o.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yXVwJLsc3o.verified.txt index f2c1310598..664d8cea91 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yXVwJLsc3o.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/yXVwJLsc3o.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_readonly_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/z5S8OyQMtF.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/z5S8OyQMtF.verified.txt index 5242259c84..1e2121fa83 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/z5S8OyQMtF.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/z5S8OyQMtF.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_recordCastOperator_ExplicitCastOperator_ExplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zsJ2xp8fo3.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zsJ2xp8fo3.verified.txt index 4ebdf6b32c..aee3b90ef1 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zsJ2xp8fo3.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zsJ2xp8fo3.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_record_classCastOperator_ExplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zu9CrZv1Ao.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zu9CrZv1Ao.verified.txt index ac8069b953..ecd7a83783 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zu9CrZv1Ao.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zu9CrZv1Ao.verified.txt @@ -323,7 +323,7 @@ namespace Whatever { public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -331,10 +331,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_partial_record_structCastOperator_ImplicitCastOperator_ImplicitSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zywK4YpKwk.verified.txt b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zywK4YpKwk.verified.txt index 04c2d24d34..61a43ef1cf 100644 --- a/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zywK4YpKwk.verified.txt +++ b/tests/SnapshotTests/Casting/snapshots/snap-v8.0/zywK4YpKwk.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, _casting_public_sealed_partial_classCastOperator_NoneCastOperator_NoneSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/0cYyKKliLi.verified.txt index bfe3405472..6a6e9fd187 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/0cYyKKliLi.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/1Gygdbr2wW.verified.txt index 544eb039e3..ac58c74a53 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/1Gygdbr2wW.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/J4tSgchMka.verified.txt index 9e359e9b1b..cd5bd42117 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/J4tSgchMka.verified.txt @@ -253,7 +253,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/KJPjvG0arG.verified.txt index c75bd57862..dbbe903f05 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/KJPjvG0arG.verified.txt @@ -253,7 +253,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/PjznyCEcyT.verified.txt index f8f309da37..1f700fe7b0 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/PjznyCEcyT.verified.txt @@ -249,7 +249,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/T2IPxePmFw.verified.txt index 49c0e16bed..cc29982fa9 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/T2IPxePmFw.verified.txt @@ -249,7 +249,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/U96pXPofm8.verified.txt index ee926f3c51..94f2597302 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/U96pXPofm8.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/UEfkRp8KdV.verified.txt index b76ab104d6..1b184e786f 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/UEfkRp8KdV.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/auNphZdY5K.verified.txt index 750c4639df..33d364183c 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/auNphZdY5K.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/pDASd72XIk.verified.txt index 896e3676bb..bc298c1d98 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v3.1/pDASd72XIk.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/0cYyKKliLi.verified.txt index 9aed4c3bc6..f4ce4c1a98 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/0cYyKKliLi.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/1Gygdbr2wW.verified.txt index 54a445c215..88f30e7b11 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/1Gygdbr2wW.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/J4tSgchMka.verified.txt index 87dde05c5b..0a5cf99c6f 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/J4tSgchMka.verified.txt @@ -219,7 +219,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/KJPjvG0arG.verified.txt index 9c78a18ff0..d24e765c28 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/KJPjvG0arG.verified.txt @@ -219,7 +219,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/PjznyCEcyT.verified.txt index 75dffbede0..6272b5fbff 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/PjznyCEcyT.verified.txt @@ -215,7 +215,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/T2IPxePmFw.verified.txt index bcb2cd23dd..46ab34159a 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/T2IPxePmFw.verified.txt @@ -215,7 +215,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/U96pXPofm8.verified.txt index 78f5a468d0..b73862df58 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/U96pXPofm8.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/UEfkRp8KdV.verified.txt index fd8a6ecd17..10fec05c99 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/UEfkRp8KdV.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/auNphZdY5K.verified.txt index 3524d05676..9c12b93346 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/auNphZdY5K.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/pDASd72XIk.verified.txt index ba7c1fda32..a9a21e4fef 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.6.1/pDASd72XIk.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/0cYyKKliLi.verified.txt index 9aed4c3bc6..f4ce4c1a98 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/0cYyKKliLi.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/1Gygdbr2wW.verified.txt index 54a445c215..88f30e7b11 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/1Gygdbr2wW.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/J4tSgchMka.verified.txt index 87dde05c5b..0a5cf99c6f 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/J4tSgchMka.verified.txt @@ -219,7 +219,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/KJPjvG0arG.verified.txt index 9c78a18ff0..d24e765c28 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/KJPjvG0arG.verified.txt @@ -219,7 +219,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/PjznyCEcyT.verified.txt index 75dffbede0..6272b5fbff 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/PjznyCEcyT.verified.txt @@ -215,7 +215,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/T2IPxePmFw.verified.txt index bcb2cd23dd..46ab34159a 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/T2IPxePmFw.verified.txt @@ -215,7 +215,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/U96pXPofm8.verified.txt index 78f5a468d0..b73862df58 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/U96pXPofm8.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/UEfkRp8KdV.verified.txt index fd8a6ecd17..10fec05c99 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/UEfkRp8KdV.verified.txt @@ -238,7 +238,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/auNphZdY5K.verified.txt index 3524d05676..9c12b93346 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/auNphZdY5K.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/pDASd72XIk.verified.txt index ba7c1fda32..a9a21e4fef 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v4.8/pDASd72XIk.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/0cYyKKliLi.verified.txt index bfe3405472..6a6e9fd187 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/0cYyKKliLi.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/1Gygdbr2wW.verified.txt index 544eb039e3..ac58c74a53 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/1Gygdbr2wW.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/J4tSgchMka.verified.txt index 9e359e9b1b..cd5bd42117 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/J4tSgchMka.verified.txt @@ -253,7 +253,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/KJPjvG0arG.verified.txt index c75bd57862..dbbe903f05 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/KJPjvG0arG.verified.txt @@ -253,7 +253,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/PjznyCEcyT.verified.txt index f8f309da37..1f700fe7b0 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/PjznyCEcyT.verified.txt @@ -249,7 +249,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/T2IPxePmFw.verified.txt index 49c0e16bed..cc29982fa9 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/T2IPxePmFw.verified.txt @@ -249,7 +249,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/U96pXPofm8.verified.txt index ee926f3c51..94f2597302 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/U96pXPofm8.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/UEfkRp8KdV.verified.txt index b76ab104d6..1b184e786f 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/UEfkRp8KdV.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/auNphZdY5K.verified.txt index 750c4639df..33d364183c 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/auNphZdY5K.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/pDASd72XIk.verified.txt index 896e3676bb..bc298c1d98 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v5.0/pDASd72XIk.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/0cYyKKliLi.verified.txt index bfe3405472..6a6e9fd187 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/0cYyKKliLi.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/1Gygdbr2wW.verified.txt index 544eb039e3..ac58c74a53 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/1Gygdbr2wW.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/J4tSgchMka.verified.txt index 9e359e9b1b..cd5bd42117 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/J4tSgchMka.verified.txt @@ -253,7 +253,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/KJPjvG0arG.verified.txt index c75bd57862..dbbe903f05 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/KJPjvG0arG.verified.txt @@ -253,7 +253,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/PjznyCEcyT.verified.txt index f8f309da37..1f700fe7b0 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/PjznyCEcyT.verified.txt @@ -249,7 +249,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/T2IPxePmFw.verified.txt index 49c0e16bed..cc29982fa9 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/T2IPxePmFw.verified.txt @@ -249,7 +249,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/U96pXPofm8.verified.txt index ee926f3c51..94f2597302 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/U96pXPofm8.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/UEfkRp8KdV.verified.txt index b76ab104d6..1b184e786f 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/UEfkRp8KdV.verified.txt @@ -272,7 +272,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/auNphZdY5K.verified.txt index 750c4639df..33d364183c 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/auNphZdY5K.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/pDASd72XIk.verified.txt index 896e3676bb..bc298c1d98 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v6.0/pDASd72XIk.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/0cYyKKliLi.verified.txt index 65c82ec08d..1a2eef1d50 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/0cYyKKliLi.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/1Gygdbr2wW.verified.txt index 400c307353..bcd61c555a 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/1Gygdbr2wW.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/J4tSgchMka.verified.txt index 83adccb7ff..1802f10a4c 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/J4tSgchMka.verified.txt @@ -321,7 +321,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/KJPjvG0arG.verified.txt index 9eade8450b..ff1eb087f7 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/KJPjvG0arG.verified.txt @@ -321,7 +321,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/PjznyCEcyT.verified.txt index 4ee69953a7..89e5e744ab 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/PjznyCEcyT.verified.txt @@ -317,7 +317,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/T2IPxePmFw.verified.txt index 53ee847756..36bbbd5f37 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/T2IPxePmFw.verified.txt @@ -317,7 +317,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/U96pXPofm8.verified.txt index eeb0d2a9fa..17057ba98b 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/U96pXPofm8.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/UEfkRp8KdV.verified.txt index 15ab260993..7d828c6581 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/UEfkRp8KdV.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/auNphZdY5K.verified.txt index 8387bd2e41..0bbc753265 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/auNphZdY5K.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/pDASd72XIk.verified.txt index 978168c24a..8dd2884c86 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v7.0/pDASd72XIk.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/0cYyKKliLi.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/0cYyKKliLi.verified.txt index 65c82ec08d..1a2eef1d50 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/0cYyKKliLi.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/0cYyKKliLi.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/1Gygdbr2wW.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/1Gygdbr2wW.verified.txt index 400c307353..bcd61c555a 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/1Gygdbr2wW.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/1Gygdbr2wW.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/J4tSgchMka.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/J4tSgchMka.verified.txt index 83adccb7ff..1802f10a4c 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/J4tSgchMka.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/J4tSgchMka.verified.txt @@ -321,7 +321,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/KJPjvG0arG.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/KJPjvG0arG.verified.txt index 9eade8450b..ff1eb087f7 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/KJPjvG0arG.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/KJPjvG0arG.verified.txt @@ -321,7 +321,7 @@ namespace @class { public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/PjznyCEcyT.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/PjznyCEcyT.verified.txt index 4ee69953a7..89e5e744ab 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/PjznyCEcyT.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/PjznyCEcyT.verified.txt @@ -317,7 +317,7 @@ namespace @class { public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/T2IPxePmFw.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/T2IPxePmFw.verified.txt index 53ee847756..36bbbd5f37 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/T2IPxePmFw.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/T2IPxePmFw.verified.txt @@ -317,7 +317,7 @@ namespace @class { public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/U96pXPofm8.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/U96pXPofm8.verified.txt index eeb0d2a9fa..17057ba98b 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/U96pXPofm8.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/U96pXPofm8.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/UEfkRp8KdV.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/UEfkRp8KdV.verified.txt index 15ab260993..7d828c6581 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/UEfkRp8KdV.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/UEfkRp8KdV.verified.txt @@ -340,7 +340,7 @@ namespace @class { public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace @class writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/auNphZdY5K.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/auNphZdY5K.verified.txt index 8387bd2e41..0bbc753265 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/auNphZdY5K.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/auNphZdY5K.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/pDASd72XIk.verified.txt b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/pDASd72XIk.verified.txt index 978168c24a..8dd2884c86 100644 --- a/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/pDASd72XIk.verified.txt +++ b/tests/SnapshotTests/Escaping/snapshots/snap-v8.0/pDASd72XIk.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, escapedTestspublic_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/0Rjlo8wVsY.verified.txt index d2e659dabf..16da97da68 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/0Rjlo8wVsY.verified.txt @@ -247,7 +247,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -255,10 +255,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/LZDZ0jdOF6.verified.txt index 5ab1267139..a9553d90cb 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/LZDZ0jdOF6.verified.txt @@ -270,7 +270,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/jXZ79bcjc9.verified.txt index 869a4cd4d8..884c6fd96b 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/jXZ79bcjc9.verified.txt @@ -266,7 +266,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -274,10 +274,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/r69L6MTLWN.verified.txt index db6904fee5..588b10542f 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v3.1/r69L6MTLWN.verified.txt @@ -251,7 +251,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/0Rjlo8wVsY.verified.txt index e210e577fa..17ccb686ea 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/0Rjlo8wVsY.verified.txt @@ -213,7 +213,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -221,10 +221,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/LZDZ0jdOF6.verified.txt index 08aef78063..609eeb104f 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/LZDZ0jdOF6.verified.txt @@ -236,7 +236,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/jXZ79bcjc9.verified.txt index 64b9e60d1b..7d6ef30a01 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/jXZ79bcjc9.verified.txt @@ -232,7 +232,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -240,10 +240,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/r69L6MTLWN.verified.txt index d603b70834..e2d16e184c 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.6.1/r69L6MTLWN.verified.txt @@ -217,7 +217,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/0Rjlo8wVsY.verified.txt index e210e577fa..17ccb686ea 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/0Rjlo8wVsY.verified.txt @@ -213,7 +213,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -221,10 +221,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/LZDZ0jdOF6.verified.txt index 08aef78063..609eeb104f 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/LZDZ0jdOF6.verified.txt @@ -236,7 +236,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -244,10 +244,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/jXZ79bcjc9.verified.txt index 64b9e60d1b..7d6ef30a01 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/jXZ79bcjc9.verified.txt @@ -232,7 +232,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -240,10 +240,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/r69L6MTLWN.verified.txt index d603b70834..e2d16e184c 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v4.8/r69L6MTLWN.verified.txt @@ -217,7 +217,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -225,10 +225,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/0Rjlo8wVsY.verified.txt index d2e659dabf..16da97da68 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/0Rjlo8wVsY.verified.txt @@ -247,7 +247,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -255,10 +255,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/LZDZ0jdOF6.verified.txt index 5ab1267139..a9553d90cb 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/LZDZ0jdOF6.verified.txt @@ -270,7 +270,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/jXZ79bcjc9.verified.txt index 869a4cd4d8..884c6fd96b 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/jXZ79bcjc9.verified.txt @@ -266,7 +266,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -274,10 +274,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/r69L6MTLWN.verified.txt index db6904fee5..588b10542f 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v5.0/r69L6MTLWN.verified.txt @@ -251,7 +251,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/0Rjlo8wVsY.verified.txt index d2e659dabf..16da97da68 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/0Rjlo8wVsY.verified.txt @@ -247,7 +247,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -255,10 +255,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/LZDZ0jdOF6.verified.txt index 5ab1267139..a9553d90cb 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/LZDZ0jdOF6.verified.txt @@ -270,7 +270,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -278,10 +278,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/jXZ79bcjc9.verified.txt index 869a4cd4d8..884c6fd96b 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/jXZ79bcjc9.verified.txt @@ -266,7 +266,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -274,10 +274,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/r69L6MTLWN.verified.txt index db6904fee5..588b10542f 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v6.0/r69L6MTLWN.verified.txt @@ -251,7 +251,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -259,10 +259,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/0Rjlo8wVsY.verified.txt index 3d13be3142..052711e8f1 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/0Rjlo8wVsY.verified.txt @@ -315,7 +315,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -323,10 +323,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/LZDZ0jdOF6.verified.txt index 342884785e..3872b5cf8c 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/LZDZ0jdOF6.verified.txt @@ -338,7 +338,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/jXZ79bcjc9.verified.txt index 9b2d7e37c4..fb820fab01 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/jXZ79bcjc9.verified.txt @@ -334,7 +334,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -342,10 +342,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/r69L6MTLWN.verified.txt index 0348649304..961dfdb4e8 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v7.0/r69L6MTLWN.verified.txt @@ -319,7 +319,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/0Rjlo8wVsY.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/0Rjlo8wVsY.verified.txt index 3d13be3142..052711e8f1 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/0Rjlo8wVsY.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/0Rjlo8wVsY.verified.txt @@ -315,7 +315,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -323,10 +323,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/LZDZ0jdOF6.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/LZDZ0jdOF6.verified.txt index 342884785e..3872b5cf8c 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/LZDZ0jdOF6.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/LZDZ0jdOF6.verified.txt @@ -338,7 +338,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -346,10 +346,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/jXZ79bcjc9.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/jXZ79bcjc9.verified.txt index 9b2d7e37c4..fb820fab01 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/jXZ79bcjc9.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/jXZ79bcjc9.verified.txt @@ -334,7 +334,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -342,10 +342,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/r69L6MTLWN.verified.txt b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/r69L6MTLWN.verified.txt index 0348649304..961dfdb4e8 100644 --- a/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/r69L6MTLWN.verified.txt +++ b/tests/SnapshotTests/GeneralStuff/snapshots/snap-v8.0/r69L6MTLWN.verified.txt @@ -319,7 +319,7 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } { public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + return MyVo.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) @@ -327,10 +327,15 @@ public static MyVo FromNewGuid() { return From(global::System.Guid.NewGuid()); } writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override MyVo ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return MyVo.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return MyVo.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of MyVo"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-fr/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1-us/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v3.1/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/18luqBmqNm.verified.txt index da725b608b..8b7b143d0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/18luqBmqNm.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/6w1vPiY8I8.verified.txt index 86e50a145f..4d8defc290 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/6w1vPiY8I8.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/7HwoUhfzjA.verified.txt index f7ecc1fa99..6696fa9c3d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/7HwoUhfzjA.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/FaNpjhWJnp.verified.txt index e43b7238bc..f7e6b39b10 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/FaNpjhWJnp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GFR12F2PgU.verified.txt index 5dde9ba10b..f99c60cc68 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GFR12F2PgU.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GGYsXO7NgY.verified.txt index b77c3326d2..08fa13469c 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/GGYsXO7NgY.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Gr0OHLjXmU.verified.txt index 6181590bc8..485bfc98ae 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Gr0OHLjXmU.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/PvSh3xfKNr.verified.txt index dddffbb26f..993d2a2117 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/PvSh3xfKNr.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q0Mq3bhsum.verified.txt index 2fba145692..4de6646098 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q0Mq3bhsum.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q8OFEgFlen.verified.txt index 269e2eaf3a..297ffe6c61 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Q8OFEgFlen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/S6kTKimLen.verified.txt index 272a683570..d748e3cb42 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/S6kTKimLen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Thad6nEDD5.verified.txt index a7e4d32e94..1a565c21fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Thad6nEDD5.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Uhx1npmK9K.verified.txt index efd0c0f908..f852181207 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/Uhx1npmK9K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/WMVLzBfTuM.verified.txt index 8b3da9c16c..dbbdc425f5 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/WMVLzBfTuM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/bkRaWa4KBI.verified.txt index 31acebc617..c5fe93bdc4 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/bkRaWa4KBI.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/iS1nna8CAC.verified.txt index 81102d4361..29c2afc1ec 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/iS1nna8CAC.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/jLSQYXoUZ7.verified.txt index 3865052aef..be8bd20617 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/jLSQYXoUZ7.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/o2otLTg8Vl.verified.txt index e4f6a82cc2..802eeae147 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/o2otLTg8Vl.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/oQTi0amgPS.verified.txt index 9d5cda52b4..68b29a31ff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/oQTi0amgPS.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/tiGNpHQWuQ.verified.txt index 1afc6bb1ac..0240b30514 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-fr/tiGNpHQWuQ.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/18luqBmqNm.verified.txt index da725b608b..8b7b143d0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/18luqBmqNm.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/6w1vPiY8I8.verified.txt index 86e50a145f..4d8defc290 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/6w1vPiY8I8.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/7HwoUhfzjA.verified.txt index f7ecc1fa99..6696fa9c3d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/7HwoUhfzjA.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/FaNpjhWJnp.verified.txt index e43b7238bc..f7e6b39b10 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/FaNpjhWJnp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GFR12F2PgU.verified.txt index 5dde9ba10b..f99c60cc68 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GFR12F2PgU.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GGYsXO7NgY.verified.txt index b77c3326d2..08fa13469c 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/GGYsXO7NgY.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Gr0OHLjXmU.verified.txt index 6181590bc8..485bfc98ae 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Gr0OHLjXmU.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/PvSh3xfKNr.verified.txt index dddffbb26f..993d2a2117 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/PvSh3xfKNr.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q0Mq3bhsum.verified.txt index 2fba145692..4de6646098 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q0Mq3bhsum.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q8OFEgFlen.verified.txt index 269e2eaf3a..297ffe6c61 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Q8OFEgFlen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/S6kTKimLen.verified.txt index 272a683570..d748e3cb42 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/S6kTKimLen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Thad6nEDD5.verified.txt index a7e4d32e94..1a565c21fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Thad6nEDD5.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Uhx1npmK9K.verified.txt index efd0c0f908..f852181207 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/Uhx1npmK9K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/WMVLzBfTuM.verified.txt index 8b3da9c16c..dbbdc425f5 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/WMVLzBfTuM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/bkRaWa4KBI.verified.txt index 31acebc617..c5fe93bdc4 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/bkRaWa4KBI.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/iS1nna8CAC.verified.txt index 81102d4361..29c2afc1ec 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/iS1nna8CAC.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/jLSQYXoUZ7.verified.txt index 3865052aef..be8bd20617 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/jLSQYXoUZ7.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/o2otLTg8Vl.verified.txt index e4f6a82cc2..802eeae147 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/o2otLTg8Vl.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/oQTi0amgPS.verified.txt index 9d5cda52b4..68b29a31ff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/oQTi0amgPS.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/tiGNpHQWuQ.verified.txt index 1afc6bb1ac..0240b30514 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1-us/tiGNpHQWuQ.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/18luqBmqNm.verified.txt index da725b608b..8b7b143d0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/18luqBmqNm.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/6w1vPiY8I8.verified.txt index 86e50a145f..4d8defc290 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/6w1vPiY8I8.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/7HwoUhfzjA.verified.txt index f7ecc1fa99..6696fa9c3d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/7HwoUhfzjA.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/FaNpjhWJnp.verified.txt index e43b7238bc..f7e6b39b10 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/FaNpjhWJnp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GFR12F2PgU.verified.txt index 5dde9ba10b..f99c60cc68 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GFR12F2PgU.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GGYsXO7NgY.verified.txt index b77c3326d2..08fa13469c 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/GGYsXO7NgY.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Gr0OHLjXmU.verified.txt index 6181590bc8..485bfc98ae 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Gr0OHLjXmU.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/PvSh3xfKNr.verified.txt index dddffbb26f..993d2a2117 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/PvSh3xfKNr.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q0Mq3bhsum.verified.txt index 2fba145692..4de6646098 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q0Mq3bhsum.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q8OFEgFlen.verified.txt index 269e2eaf3a..297ffe6c61 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Q8OFEgFlen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/S6kTKimLen.verified.txt index 272a683570..d748e3cb42 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/S6kTKimLen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Thad6nEDD5.verified.txt index a7e4d32e94..1a565c21fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Thad6nEDD5.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Uhx1npmK9K.verified.txt index efd0c0f908..f852181207 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/Uhx1npmK9K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/WMVLzBfTuM.verified.txt index 8b3da9c16c..dbbdc425f5 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/WMVLzBfTuM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/bkRaWa4KBI.verified.txt index 31acebc617..c5fe93bdc4 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/bkRaWa4KBI.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/iS1nna8CAC.verified.txt index 81102d4361..29c2afc1ec 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/iS1nna8CAC.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/jLSQYXoUZ7.verified.txt index 3865052aef..be8bd20617 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/jLSQYXoUZ7.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/o2otLTg8Vl.verified.txt index e4f6a82cc2..802eeae147 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/o2otLTg8Vl.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/oQTi0amgPS.verified.txt index 9d5cda52b4..68b29a31ff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/oQTi0amgPS.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/tiGNpHQWuQ.verified.txt index 1afc6bb1ac..0240b30514 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.6.1/tiGNpHQWuQ.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/18luqBmqNm.verified.txt index da725b608b..8b7b143d0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/18luqBmqNm.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/6w1vPiY8I8.verified.txt index 86e50a145f..4d8defc290 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/6w1vPiY8I8.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/7HwoUhfzjA.verified.txt index f7ecc1fa99..6696fa9c3d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/7HwoUhfzjA.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/FaNpjhWJnp.verified.txt index e43b7238bc..f7e6b39b10 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/FaNpjhWJnp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GFR12F2PgU.verified.txt index 5dde9ba10b..f99c60cc68 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GFR12F2PgU.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GGYsXO7NgY.verified.txt index b77c3326d2..08fa13469c 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/GGYsXO7NgY.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Gr0OHLjXmU.verified.txt index 6181590bc8..485bfc98ae 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Gr0OHLjXmU.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/PvSh3xfKNr.verified.txt index dddffbb26f..993d2a2117 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/PvSh3xfKNr.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q0Mq3bhsum.verified.txt index 2fba145692..4de6646098 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q0Mq3bhsum.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q8OFEgFlen.verified.txt index 269e2eaf3a..297ffe6c61 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Q8OFEgFlen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/S6kTKimLen.verified.txt index 272a683570..d748e3cb42 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/S6kTKimLen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Thad6nEDD5.verified.txt index a7e4d32e94..1a565c21fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Thad6nEDD5.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Uhx1npmK9K.verified.txt index efd0c0f908..f852181207 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/Uhx1npmK9K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/WMVLzBfTuM.verified.txt index 8b3da9c16c..dbbdc425f5 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/WMVLzBfTuM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/bkRaWa4KBI.verified.txt index 31acebc617..c5fe93bdc4 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/bkRaWa4KBI.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/iS1nna8CAC.verified.txt index 81102d4361..29c2afc1ec 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/iS1nna8CAC.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/jLSQYXoUZ7.verified.txt index 3865052aef..be8bd20617 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/jLSQYXoUZ7.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/o2otLTg8Vl.verified.txt index e4f6a82cc2..802eeae147 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/o2otLTg8Vl.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/oQTi0amgPS.verified.txt index 9d5cda52b4..68b29a31ff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/oQTi0amgPS.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/tiGNpHQWuQ.verified.txt index 1afc6bb1ac..0240b30514 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-fr/tiGNpHQWuQ.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/18luqBmqNm.verified.txt index da725b608b..8b7b143d0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/18luqBmqNm.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/6w1vPiY8I8.verified.txt index 86e50a145f..4d8defc290 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/6w1vPiY8I8.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/7HwoUhfzjA.verified.txt index f7ecc1fa99..6696fa9c3d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/7HwoUhfzjA.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/FaNpjhWJnp.verified.txt index e43b7238bc..f7e6b39b10 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/FaNpjhWJnp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GFR12F2PgU.verified.txt index 5dde9ba10b..f99c60cc68 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GFR12F2PgU.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GGYsXO7NgY.verified.txt index b77c3326d2..08fa13469c 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/GGYsXO7NgY.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Gr0OHLjXmU.verified.txt index 6181590bc8..485bfc98ae 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Gr0OHLjXmU.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/PvSh3xfKNr.verified.txt index dddffbb26f..993d2a2117 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/PvSh3xfKNr.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q0Mq3bhsum.verified.txt index 2fba145692..4de6646098 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q0Mq3bhsum.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q8OFEgFlen.verified.txt index 269e2eaf3a..297ffe6c61 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Q8OFEgFlen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/S6kTKimLen.verified.txt index 272a683570..d748e3cb42 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/S6kTKimLen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Thad6nEDD5.verified.txt index a7e4d32e94..1a565c21fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Thad6nEDD5.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Uhx1npmK9K.verified.txt index efd0c0f908..f852181207 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/Uhx1npmK9K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/WMVLzBfTuM.verified.txt index 8b3da9c16c..dbbdc425f5 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/WMVLzBfTuM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/bkRaWa4KBI.verified.txt index 31acebc617..c5fe93bdc4 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/bkRaWa4KBI.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/iS1nna8CAC.verified.txt index 81102d4361..29c2afc1ec 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/iS1nna8CAC.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/jLSQYXoUZ7.verified.txt index 3865052aef..be8bd20617 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/jLSQYXoUZ7.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/o2otLTg8Vl.verified.txt index e4f6a82cc2..802eeae147 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/o2otLTg8Vl.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/oQTi0amgPS.verified.txt index 9d5cda52b4..68b29a31ff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/oQTi0amgPS.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/tiGNpHQWuQ.verified.txt index 1afc6bb1ac..0240b30514 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8-us/tiGNpHQWuQ.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/18luqBmqNm.verified.txt index da725b608b..8b7b143d0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/18luqBmqNm.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/6w1vPiY8I8.verified.txt index 86e50a145f..4d8defc290 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/6w1vPiY8I8.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/7HwoUhfzjA.verified.txt index f7ecc1fa99..6696fa9c3d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/7HwoUhfzjA.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/FaNpjhWJnp.verified.txt index e43b7238bc..f7e6b39b10 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/FaNpjhWJnp.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GFR12F2PgU.verified.txt index 5dde9ba10b..f99c60cc68 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GFR12F2PgU.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GGYsXO7NgY.verified.txt index b77c3326d2..08fa13469c 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/GGYsXO7NgY.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Gr0OHLjXmU.verified.txt index 6181590bc8..485bfc98ae 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Gr0OHLjXmU.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/PvSh3xfKNr.verified.txt index dddffbb26f..993d2a2117 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/PvSh3xfKNr.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q0Mq3bhsum.verified.txt index 2fba145692..4de6646098 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q0Mq3bhsum.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q8OFEgFlen.verified.txt index 269e2eaf3a..297ffe6c61 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Q8OFEgFlen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/S6kTKimLen.verified.txt index 272a683570..d748e3cb42 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/S6kTKimLen.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Thad6nEDD5.verified.txt index a7e4d32e94..1a565c21fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Thad6nEDD5.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Uhx1npmK9K.verified.txt index efd0c0f908..f852181207 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/Uhx1npmK9K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/WMVLzBfTuM.verified.txt index 8b3da9c16c..dbbdc425f5 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/WMVLzBfTuM.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/bkRaWa4KBI.verified.txt index 31acebc617..c5fe93bdc4 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/bkRaWa4KBI.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/iS1nna8CAC.verified.txt index 81102d4361..29c2afc1ec 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/iS1nna8CAC.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/jLSQYXoUZ7.verified.txt index 3865052aef..be8bd20617 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/jLSQYXoUZ7.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/o2otLTg8Vl.verified.txt index e4f6a82cc2..802eeae147 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/o2otLTg8Vl.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/oQTi0amgPS.verified.txt index 9d5cda52b4..68b29a31ff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/oQTi0amgPS.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/tiGNpHQWuQ.verified.txt index 1afc6bb1ac..0240b30514 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v4.8/tiGNpHQWuQ.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-fr/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0-us/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v5.0/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-fr/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0-us/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/18luqBmqNm.verified.txt index 07878c68e2..14289305fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/18luqBmqNm.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/6w1vPiY8I8.verified.txt index 9824bd58e6..7e3dc77e74 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/6w1vPiY8I8.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/7HwoUhfzjA.verified.txt index 41e3136974..204551413b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/7HwoUhfzjA.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/FaNpjhWJnp.verified.txt index 9182844b18..b5d78a0e95 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/FaNpjhWJnp.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GFR12F2PgU.verified.txt index 6e43196919..63f3806646 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GFR12F2PgU.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GGYsXO7NgY.verified.txt index b5ac0b480e..3a676129e2 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/GGYsXO7NgY.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Gr0OHLjXmU.verified.txt index e771cf4ffd..5bb36865f9 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Gr0OHLjXmU.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/PvSh3xfKNr.verified.txt index 5389aec73d..57ebe98642 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/PvSh3xfKNr.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q0Mq3bhsum.verified.txt index 3feff6228e..3e5fdd6eff 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q0Mq3bhsum.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q8OFEgFlen.verified.txt index 4c957fef7f..7c64c2bbc8 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Q8OFEgFlen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/S6kTKimLen.verified.txt index 0e78bef951..3ab3d8929b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/S6kTKimLen.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Thad6nEDD5.verified.txt index 37aede15b1..d03a4f3a0e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Thad6nEDD5.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Uhx1npmK9K.verified.txt index a80bb5497c..6d4b4f701b 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/Uhx1npmK9K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/WMVLzBfTuM.verified.txt index f6218f1ea2..c88a657088 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/WMVLzBfTuM.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/bkRaWa4KBI.verified.txt index 6f93ea8bba..a6fa7a6fdd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/bkRaWa4KBI.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/iS1nna8CAC.verified.txt index 742076fa73..b4428c5584 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/iS1nna8CAC.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/jLSQYXoUZ7.verified.txt index 3fa72d82fc..3c0505734e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/jLSQYXoUZ7.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/o2otLTg8Vl.verified.txt index 04c1e4c925..e479f1732e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/o2otLTg8Vl.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/oQTi0amgPS.verified.txt index ebe6d30ffa..9e778b038f 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/oQTi0amgPS.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/tiGNpHQWuQ.verified.txt index 063577d629..6c9a1294fc 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v6.0/tiGNpHQWuQ.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/18luqBmqNm.verified.txt index dba357f11e..ef96d38564 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/18luqBmqNm.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/6w1vPiY8I8.verified.txt index 64c575dd8b..5d7b7a2ed6 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/6w1vPiY8I8.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/7HwoUhfzjA.verified.txt index 59c2228e00..027be8e438 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/7HwoUhfzjA.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/FaNpjhWJnp.verified.txt index 6bb49658e3..1d51fc24e0 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/FaNpjhWJnp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GFR12F2PgU.verified.txt index f9aa47e1b9..a53344c996 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GFR12F2PgU.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GGYsXO7NgY.verified.txt index 791cd40830..49f2686415 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/GGYsXO7NgY.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Gr0OHLjXmU.verified.txt index faeea47dcb..6f9eb86e1d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Gr0OHLjXmU.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/PvSh3xfKNr.verified.txt index 7209cbf8be..25063dcc31 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/PvSh3xfKNr.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q0Mq3bhsum.verified.txt index 40fad5b344..016170f5a1 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q0Mq3bhsum.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q8OFEgFlen.verified.txt index 42c6ed2f7d..03a305a463 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Q8OFEgFlen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/S6kTKimLen.verified.txt index 6aaa48d007..d5d8491c96 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/S6kTKimLen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Thad6nEDD5.verified.txt index c59d74c923..dcc42298fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Thad6nEDD5.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Uhx1npmK9K.verified.txt index a0ab25f9d7..8c987d3a94 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/Uhx1npmK9K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/WMVLzBfTuM.verified.txt index e17bbaee29..b27cc88351 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/WMVLzBfTuM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/bkRaWa4KBI.verified.txt index 412427f631..457c7873f7 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/bkRaWa4KBI.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/iS1nna8CAC.verified.txt index 5aed693a08..805710be04 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/iS1nna8CAC.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/jLSQYXoUZ7.verified.txt index 24c6958811..53eaa7f21e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/jLSQYXoUZ7.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/o2otLTg8Vl.verified.txt index b30e17de26..3cf9da4391 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/o2otLTg8Vl.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/oQTi0amgPS.verified.txt index a4bbe25001..d26096f432 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/oQTi0amgPS.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/tiGNpHQWuQ.verified.txt index ea9545ca3e..f19aca4227 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-fr/tiGNpHQWuQ.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/18luqBmqNm.verified.txt index dba357f11e..ef96d38564 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/18luqBmqNm.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/6w1vPiY8I8.verified.txt index 64c575dd8b..5d7b7a2ed6 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/6w1vPiY8I8.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/7HwoUhfzjA.verified.txt index 59c2228e00..027be8e438 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/7HwoUhfzjA.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/FaNpjhWJnp.verified.txt index 6bb49658e3..1d51fc24e0 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/FaNpjhWJnp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GFR12F2PgU.verified.txt index f9aa47e1b9..a53344c996 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GFR12F2PgU.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GGYsXO7NgY.verified.txt index 791cd40830..49f2686415 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/GGYsXO7NgY.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Gr0OHLjXmU.verified.txt index faeea47dcb..6f9eb86e1d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Gr0OHLjXmU.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/PvSh3xfKNr.verified.txt index 7209cbf8be..25063dcc31 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/PvSh3xfKNr.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q0Mq3bhsum.verified.txt index 40fad5b344..016170f5a1 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q0Mq3bhsum.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q8OFEgFlen.verified.txt index 42c6ed2f7d..03a305a463 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Q8OFEgFlen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/S6kTKimLen.verified.txt index 6aaa48d007..d5d8491c96 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/S6kTKimLen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Thad6nEDD5.verified.txt index c59d74c923..dcc42298fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Thad6nEDD5.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Uhx1npmK9K.verified.txt index a0ab25f9d7..8c987d3a94 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/Uhx1npmK9K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/WMVLzBfTuM.verified.txt index e17bbaee29..b27cc88351 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/WMVLzBfTuM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/bkRaWa4KBI.verified.txt index 412427f631..457c7873f7 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/bkRaWa4KBI.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/iS1nna8CAC.verified.txt index 5aed693a08..805710be04 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/iS1nna8CAC.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/jLSQYXoUZ7.verified.txt index 24c6958811..53eaa7f21e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/jLSQYXoUZ7.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/o2otLTg8Vl.verified.txt index b30e17de26..3cf9da4391 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/o2otLTg8Vl.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/oQTi0amgPS.verified.txt index a4bbe25001..d26096f432 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/oQTi0amgPS.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/tiGNpHQWuQ.verified.txt index ea9545ca3e..f19aca4227 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0-us/tiGNpHQWuQ.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/18luqBmqNm.verified.txt index dba357f11e..ef96d38564 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/18luqBmqNm.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/6w1vPiY8I8.verified.txt index 64c575dd8b..5d7b7a2ed6 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/6w1vPiY8I8.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/7HwoUhfzjA.verified.txt index 59c2228e00..027be8e438 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/7HwoUhfzjA.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/FaNpjhWJnp.verified.txt index 6bb49658e3..1d51fc24e0 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/FaNpjhWJnp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GFR12F2PgU.verified.txt index f9aa47e1b9..a53344c996 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GFR12F2PgU.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GGYsXO7NgY.verified.txt index 791cd40830..49f2686415 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/GGYsXO7NgY.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Gr0OHLjXmU.verified.txt index faeea47dcb..6f9eb86e1d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Gr0OHLjXmU.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/PvSh3xfKNr.verified.txt index 7209cbf8be..25063dcc31 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/PvSh3xfKNr.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q0Mq3bhsum.verified.txt index 40fad5b344..016170f5a1 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q0Mq3bhsum.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q8OFEgFlen.verified.txt index 42c6ed2f7d..03a305a463 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Q8OFEgFlen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/S6kTKimLen.verified.txt index 6aaa48d007..d5d8491c96 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/S6kTKimLen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Thad6nEDD5.verified.txt index c59d74c923..dcc42298fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Thad6nEDD5.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Uhx1npmK9K.verified.txt index a0ab25f9d7..8c987d3a94 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/Uhx1npmK9K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/WMVLzBfTuM.verified.txt index e17bbaee29..b27cc88351 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/WMVLzBfTuM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/bkRaWa4KBI.verified.txt index 412427f631..457c7873f7 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/bkRaWa4KBI.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/iS1nna8CAC.verified.txt index 5aed693a08..805710be04 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/iS1nna8CAC.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/jLSQYXoUZ7.verified.txt index 24c6958811..53eaa7f21e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/jLSQYXoUZ7.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/o2otLTg8Vl.verified.txt index b30e17de26..3cf9da4391 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/o2otLTg8Vl.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/oQTi0amgPS.verified.txt index a4bbe25001..d26096f432 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/oQTi0amgPS.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/tiGNpHQWuQ.verified.txt index ea9545ca3e..f19aca4227 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v7.0/tiGNpHQWuQ.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/18luqBmqNm.verified.txt index dba357f11e..ef96d38564 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/18luqBmqNm.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/6w1vPiY8I8.verified.txt index 64c575dd8b..5d7b7a2ed6 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/6w1vPiY8I8.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/7HwoUhfzjA.verified.txt index 59c2228e00..027be8e438 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/7HwoUhfzjA.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/FaNpjhWJnp.verified.txt index 6bb49658e3..1d51fc24e0 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/FaNpjhWJnp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GFR12F2PgU.verified.txt index f9aa47e1b9..a53344c996 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GFR12F2PgU.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GGYsXO7NgY.verified.txt index 791cd40830..49f2686415 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/GGYsXO7NgY.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Gr0OHLjXmU.verified.txt index faeea47dcb..6f9eb86e1d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Gr0OHLjXmU.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/PvSh3xfKNr.verified.txt index 7209cbf8be..25063dcc31 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/PvSh3xfKNr.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q0Mq3bhsum.verified.txt index 40fad5b344..016170f5a1 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q0Mq3bhsum.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q8OFEgFlen.verified.txt index 42c6ed2f7d..03a305a463 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Q8OFEgFlen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/S6kTKimLen.verified.txt index 6aaa48d007..d5d8491c96 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/S6kTKimLen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Thad6nEDD5.verified.txt index c59d74c923..dcc42298fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Thad6nEDD5.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Uhx1npmK9K.verified.txt index a0ab25f9d7..8c987d3a94 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/Uhx1npmK9K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/WMVLzBfTuM.verified.txt index e17bbaee29..b27cc88351 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/WMVLzBfTuM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/bkRaWa4KBI.verified.txt index 412427f631..457c7873f7 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/bkRaWa4KBI.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/iS1nna8CAC.verified.txt index 5aed693a08..805710be04 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/iS1nna8CAC.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/jLSQYXoUZ7.verified.txt index 24c6958811..53eaa7f21e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/jLSQYXoUZ7.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/o2otLTg8Vl.verified.txt index b30e17de26..3cf9da4391 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/o2otLTg8Vl.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/oQTi0amgPS.verified.txt index a4bbe25001..d26096f432 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/oQTi0amgPS.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/tiGNpHQWuQ.verified.txt index ea9545ca3e..f19aca4227 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-fr/tiGNpHQWuQ.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/18luqBmqNm.verified.txt index dba357f11e..ef96d38564 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/18luqBmqNm.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/6w1vPiY8I8.verified.txt index 64c575dd8b..5d7b7a2ed6 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/6w1vPiY8I8.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/7HwoUhfzjA.verified.txt index 59c2228e00..027be8e438 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/7HwoUhfzjA.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/FaNpjhWJnp.verified.txt index 6bb49658e3..1d51fc24e0 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/FaNpjhWJnp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GFR12F2PgU.verified.txt index f9aa47e1b9..a53344c996 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GFR12F2PgU.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GGYsXO7NgY.verified.txt index 791cd40830..49f2686415 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/GGYsXO7NgY.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Gr0OHLjXmU.verified.txt index faeea47dcb..6f9eb86e1d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Gr0OHLjXmU.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/PvSh3xfKNr.verified.txt index 7209cbf8be..25063dcc31 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/PvSh3xfKNr.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q0Mq3bhsum.verified.txt index 40fad5b344..016170f5a1 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q0Mq3bhsum.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q8OFEgFlen.verified.txt index 42c6ed2f7d..03a305a463 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Q8OFEgFlen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/S6kTKimLen.verified.txt index 6aaa48d007..d5d8491c96 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/S6kTKimLen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Thad6nEDD5.verified.txt index c59d74c923..dcc42298fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Thad6nEDD5.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Uhx1npmK9K.verified.txt index a0ab25f9d7..8c987d3a94 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/Uhx1npmK9K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/WMVLzBfTuM.verified.txt index e17bbaee29..b27cc88351 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/WMVLzBfTuM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/bkRaWa4KBI.verified.txt index 412427f631..457c7873f7 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/bkRaWa4KBI.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/iS1nna8CAC.verified.txt index 5aed693a08..805710be04 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/iS1nna8CAC.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/jLSQYXoUZ7.verified.txt index 24c6958811..53eaa7f21e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/jLSQYXoUZ7.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/o2otLTg8Vl.verified.txt index b30e17de26..3cf9da4391 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/o2otLTg8Vl.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/oQTi0amgPS.verified.txt index a4bbe25001..d26096f432 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/oQTi0amgPS.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/tiGNpHQWuQ.verified.txt index ea9545ca3e..f19aca4227 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0-us/tiGNpHQWuQ.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/18luqBmqNm.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/18luqBmqNm.verified.txt index dba357f11e..ef96d38564 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/18luqBmqNm.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/18luqBmqNm.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/6w1vPiY8I8.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/6w1vPiY8I8.verified.txt index 64c575dd8b..5d7b7a2ed6 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/6w1vPiY8I8.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/6w1vPiY8I8.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/7HwoUhfzjA.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/7HwoUhfzjA.verified.txt index 59c2228e00..027be8e438 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/7HwoUhfzjA.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/7HwoUhfzjA.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/FaNpjhWJnp.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/FaNpjhWJnp.verified.txt index 6bb49658e3..1d51fc24e0 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/FaNpjhWJnp.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/FaNpjhWJnp.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GFR12F2PgU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GFR12F2PgU.verified.txt index f9aa47e1b9..a53344c996 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GFR12F2PgU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GFR12F2PgU.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GGYsXO7NgY.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GGYsXO7NgY.verified.txt index 791cd40830..49f2686415 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GGYsXO7NgY.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/GGYsXO7NgY.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Gr0OHLjXmU.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Gr0OHLjXmU.verified.txt index faeea47dcb..6f9eb86e1d 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Gr0OHLjXmU.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Gr0OHLjXmU.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/PvSh3xfKNr.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/PvSh3xfKNr.verified.txt index 7209cbf8be..25063dcc31 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/PvSh3xfKNr.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/PvSh3xfKNr.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q0Mq3bhsum.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q0Mq3bhsum.verified.txt index 40fad5b344..016170f5a1 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q0Mq3bhsum.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q0Mq3bhsum.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q8OFEgFlen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q8OFEgFlen.verified.txt index 42c6ed2f7d..03a305a463 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q8OFEgFlen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Q8OFEgFlen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/S6kTKimLen.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/S6kTKimLen.verified.txt index 6aaa48d007..d5d8491c96 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/S6kTKimLen.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/S6kTKimLen.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Thad6nEDD5.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Thad6nEDD5.verified.txt index c59d74c923..dcc42298fd 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Thad6nEDD5.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Thad6nEDD5.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Uhx1npmK9K.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Uhx1npmK9K.verified.txt index a0ab25f9d7..8c987d3a94 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Uhx1npmK9K.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/Uhx1npmK9K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/WMVLzBfTuM.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/WMVLzBfTuM.verified.txt index e17bbaee29..b27cc88351 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/WMVLzBfTuM.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/WMVLzBfTuM.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/bkRaWa4KBI.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/bkRaWa4KBI.verified.txt index 412427f631..457c7873f7 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/bkRaWa4KBI.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/bkRaWa4KBI.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/iS1nna8CAC.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/iS1nna8CAC.verified.txt index 5aed693a08..805710be04 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/iS1nna8CAC.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/iS1nna8CAC.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/jLSQYXoUZ7.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/jLSQYXoUZ7.verified.txt index 24c6958811..53eaa7f21e 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/jLSQYXoUZ7.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/jLSQYXoUZ7.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/o2otLTg8Vl.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/o2otLTg8Vl.verified.txt index b30e17de26..3cf9da4391 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/o2otLTg8Vl.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/o2otLTg8Vl.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/oQTi0amgPS.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/oQTi0amgPS.verified.txt index a4bbe25001..d26096f432 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/oQTi0amgPS.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/oQTi0amgPS.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/tiGNpHQWuQ.verified.txt b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/tiGNpHQWuQ.verified.txt index ea9545ca3e..f19aca4227 100644 --- a/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/tiGNpHQWuQ.verified.txt +++ b/tests/SnapshotTests/GenerationPermutations/snapshots/snap-v8.0/tiGNpHQWuQ.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, internal_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJson___Conversions_EfCoreValueConverter___Conversions_DapperTypeHandler___Conversions_LinqToDbValueConverterSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/07PcIVuj3q.verified.txt index 9d6e8f9f09..c9a932b544 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/07PcIVuj3q.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/0KEv27PfZM.verified.txt index a7aadd5c24..aa24c7860b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/0KEv27PfZM.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/53M01mFed0.verified.txt index bf74124927..b886543318 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/53M01mFed0.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/5gozITB9Re.verified.txt index 8e7534a952..15bcd98716 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/5gozITB9Re.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/7hiNp5tlXd.verified.txt index ff8a56f773..a1be9bf0af 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/7hiNp5tlXd.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BQCdbuCyxx.verified.txt index d65f49a0b5..c42a52262e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BQCdbuCyxx.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BYxnvHUM5h.verified.txt index fc6fd0a0a1..815a943b81 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BYxnvHUM5h.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Ba6Ah7G9BT.verified.txt index 78f69fbfb1..6bed429d38 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Ba6Ah7G9BT.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BbUYWGSZ7t.verified.txt index 0dc4cfa057..b443885bac 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/BbUYWGSZ7t.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Bbqck2QQEe.verified.txt index 5ed12e44ac..71b2d46b93 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Bbqck2QQEe.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/C3aV5bGuhC.verified.txt index 34057d5cb2..9b140cd760 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/C3aV5bGuhC.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/CpMibF5X1W.verified.txt index e538149d99..13208a6b35 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/CpMibF5X1W.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ETkaLLh9Fh.verified.txt index 215e2bc94b..6cd4a33fe4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ETkaLLh9Fh.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/F0A7L16fq0.verified.txt index bed74c6c50..f1ba78d208 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/F0A7L16fq0.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G2mouoq1fx.verified.txt index ad0550ff56..7a21074054 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G2mouoq1fx.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G7fYp2vqR9.verified.txt index ada1b5c6bf..01fdeeb1f4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/G7fYp2vqR9.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/GTwMaPNJRP.verified.txt index ee86fe9897..81c7d86596 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/GTwMaPNJRP.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Hhh5fuVEaa.verified.txt index a94375ef25..f58f6604a4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Hhh5fuVEaa.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ITWVYMGhio.verified.txt index 444f2d06fb..d799f94c01 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ITWVYMGhio.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/J8SezX4ArK.verified.txt index 21afa4ac2b..adf54d6141 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/J8SezX4ArK.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JY3027oK9C.verified.txt index 98bf6c2fdf..d3f0314a1f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JY3027oK9C.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JYus242bhT.verified.txt index f8f4c65610..4f08cca771 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/JYus242bhT.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/O3fNbJ8VN2.verified.txt index 420b34f38a..3f1dead8f7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/O3fNbJ8VN2.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/PWSj9aUbl7.verified.txt index 08dad97cc5..36daf1dc43 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/PWSj9aUbl7.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/RdmiRTq0Io.verified.txt index 10c8d4d9fb..078d3b3c60 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/RdmiRTq0Io.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/SwRDtR0cOK.verified.txt index 6e01020298..5c59f2d528 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/SwRDtR0cOK.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Wm4zfAVYP7.verified.txt index 442c59de5f..1588052654 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/Wm4zfAVYP7.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ZC2jtVGSox.verified.txt index bdee34d281..95dfb73924 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ZC2jtVGSox.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/beUUeB1dtC.verified.txt index 414af6c71c..27af35daae 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/beUUeB1dtC.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/fWP2lfWLPk.verified.txt index 3d482458cf..30b6f7afda 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/fWP2lfWLPk.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ij75EzZOvs.verified.txt index 6d5299676f..e0bd0e0703 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/ij75EzZOvs.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/l0KgzJEYIx.verified.txt index 8436f016c4..e18535d862 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/l0KgzJEYIx.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mFIIJTvHXY.verified.txt index f65f98a868..bfb6ee0951 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mFIIJTvHXY.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mLHmiGlOxG.verified.txt index 15acb1994c..d49cd1231e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/mLHmiGlOxG.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/o4gwuUPNtq.verified.txt index eeb5f5330c..b6b775e9b2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/o4gwuUPNtq.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/smZgSpu29K.verified.txt index 65b7b0a25e..a277c6d95a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/smZgSpu29K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uE3HXfhovg.verified.txt index 977c0dd74f..9ad3bc0ab3 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uE3HXfhovg.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uKvBMJhwaD.verified.txt index 75e48618a4..ef3dde11bc 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/uKvBMJhwaD.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/udEoaZL1DV.verified.txt index 3d9e8682c9..3d18694282 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/udEoaZL1DV.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/w68jlFSN6b.verified.txt index 0b648d6832..e8c8a104fa 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v3.1/w68jlFSN6b.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/07PcIVuj3q.verified.txt index 35d8bf2d8b..617f81b2c0 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/07PcIVuj3q.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/0KEv27PfZM.verified.txt index 2b1955a28d..9b4cd71e6b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/0KEv27PfZM.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/53M01mFed0.verified.txt index 60ed13ca0d..8c882dbe3b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/53M01mFed0.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/5gozITB9Re.verified.txt index 13df22a53c..b1233b1e03 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/5gozITB9Re.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/7hiNp5tlXd.verified.txt index cfea310eba..b3b98ad313 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/7hiNp5tlXd.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BQCdbuCyxx.verified.txt index 93826f3e4e..a1b9d30851 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BQCdbuCyxx.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BYxnvHUM5h.verified.txt index d35203dbfe..75877fcc4f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BYxnvHUM5h.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Ba6Ah7G9BT.verified.txt index e3b3d5c6c4..249a11bb6a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Ba6Ah7G9BT.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BbUYWGSZ7t.verified.txt index 596befeedf..06a46e7b85 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/BbUYWGSZ7t.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Bbqck2QQEe.verified.txt index d2722cf7e0..6adf835925 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Bbqck2QQEe.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/C3aV5bGuhC.verified.txt index 8f8b32643f..7a4a9c6360 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/C3aV5bGuhC.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/CpMibF5X1W.verified.txt index a6650ee4ad..7dba1bbe00 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/CpMibF5X1W.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ETkaLLh9Fh.verified.txt index d9464c3b56..4916c95d49 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ETkaLLh9Fh.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/F0A7L16fq0.verified.txt index 8c6f02292e..f3acc2d80f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/F0A7L16fq0.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G2mouoq1fx.verified.txt index 7fb12b6956..4fcf8eeeb2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G2mouoq1fx.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G7fYp2vqR9.verified.txt index 67da11f6ae..aba6e93fbe 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/G7fYp2vqR9.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/GTwMaPNJRP.verified.txt index 69c55b89e4..64f693442a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/GTwMaPNJRP.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Hhh5fuVEaa.verified.txt index 3ad0f97cbe..4ca5eb4509 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Hhh5fuVEaa.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ITWVYMGhio.verified.txt index 5f15c61ecb..7c19293132 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ITWVYMGhio.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/J8SezX4ArK.verified.txt index 04ed18d096..7484bc6fee 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/J8SezX4ArK.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JY3027oK9C.verified.txt index c2ce7366d2..abd1460437 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JY3027oK9C.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JYus242bhT.verified.txt index 0de40aa9d6..4776febf98 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/JYus242bhT.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/O3fNbJ8VN2.verified.txt index c00c216504..fbb1a585b2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/O3fNbJ8VN2.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/PWSj9aUbl7.verified.txt index 064bd4a414..ce2ec69135 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/PWSj9aUbl7.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/RdmiRTq0Io.verified.txt index 0705bb7816..57b13ca5f9 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/RdmiRTq0Io.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/SwRDtR0cOK.verified.txt index 1cf94cef5e..192c344b12 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/SwRDtR0cOK.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Wm4zfAVYP7.verified.txt index 526c4fba02..caea496977 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/Wm4zfAVYP7.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ZC2jtVGSox.verified.txt index ad1a0e27a4..d34d68ae64 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ZC2jtVGSox.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/beUUeB1dtC.verified.txt index 0ede22f1ed..821cde1fa7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/beUUeB1dtC.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/fWP2lfWLPk.verified.txt index 9650b3d537..edfc4041b7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/fWP2lfWLPk.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ij75EzZOvs.verified.txt index 46ebfc03fa..c9754af162 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/ij75EzZOvs.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/l0KgzJEYIx.verified.txt index 7a53a20efc..54e1501852 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/l0KgzJEYIx.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mFIIJTvHXY.verified.txt index 3590ee05f7..81b7612f1f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mFIIJTvHXY.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mLHmiGlOxG.verified.txt index cbea20b027..d9dcb0c6ac 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/mLHmiGlOxG.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/o4gwuUPNtq.verified.txt index 8daf91d2d5..c22a487752 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/o4gwuUPNtq.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/smZgSpu29K.verified.txt index bb8de2cc22..2c9e82340a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/smZgSpu29K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uE3HXfhovg.verified.txt index 474269ce97..de258500a9 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uE3HXfhovg.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uKvBMJhwaD.verified.txt index e9806c03c2..121c5daabf 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/uKvBMJhwaD.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/udEoaZL1DV.verified.txt index 1be659f4dc..1f2d2aba4f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/udEoaZL1DV.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/w68jlFSN6b.verified.txt index 4dc4cdd381..ddf825a61d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.6.1/w68jlFSN6b.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/07PcIVuj3q.verified.txt index 35d8bf2d8b..617f81b2c0 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/07PcIVuj3q.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/0KEv27PfZM.verified.txt index 2b1955a28d..9b4cd71e6b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/0KEv27PfZM.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/53M01mFed0.verified.txt index 60ed13ca0d..8c882dbe3b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/53M01mFed0.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/5gozITB9Re.verified.txt index 13df22a53c..b1233b1e03 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/5gozITB9Re.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/7hiNp5tlXd.verified.txt index cfea310eba..b3b98ad313 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/7hiNp5tlXd.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BQCdbuCyxx.verified.txt index 93826f3e4e..a1b9d30851 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BQCdbuCyxx.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BYxnvHUM5h.verified.txt index d35203dbfe..75877fcc4f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BYxnvHUM5h.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Ba6Ah7G9BT.verified.txt index e3b3d5c6c4..249a11bb6a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Ba6Ah7G9BT.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BbUYWGSZ7t.verified.txt index 596befeedf..06a46e7b85 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/BbUYWGSZ7t.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Bbqck2QQEe.verified.txt index d2722cf7e0..6adf835925 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Bbqck2QQEe.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/C3aV5bGuhC.verified.txt index 8f8b32643f..7a4a9c6360 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/C3aV5bGuhC.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/CpMibF5X1W.verified.txt index a6650ee4ad..7dba1bbe00 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/CpMibF5X1W.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ETkaLLh9Fh.verified.txt index d9464c3b56..4916c95d49 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ETkaLLh9Fh.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/F0A7L16fq0.verified.txt index 8c6f02292e..f3acc2d80f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/F0A7L16fq0.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G2mouoq1fx.verified.txt index 7fb12b6956..4fcf8eeeb2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G2mouoq1fx.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G7fYp2vqR9.verified.txt index 67da11f6ae..aba6e93fbe 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/G7fYp2vqR9.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/GTwMaPNJRP.verified.txt index 69c55b89e4..64f693442a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/GTwMaPNJRP.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Hhh5fuVEaa.verified.txt index 3ad0f97cbe..4ca5eb4509 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Hhh5fuVEaa.verified.txt @@ -234,7 +234,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -242,10 +242,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ITWVYMGhio.verified.txt index 5f15c61ecb..7c19293132 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ITWVYMGhio.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/J8SezX4ArK.verified.txt index 04ed18d096..7484bc6fee 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/J8SezX4ArK.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JY3027oK9C.verified.txt index c2ce7366d2..abd1460437 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JY3027oK9C.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JYus242bhT.verified.txt index 0de40aa9d6..4776febf98 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/JYus242bhT.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/O3fNbJ8VN2.verified.txt index c00c216504..fbb1a585b2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/O3fNbJ8VN2.verified.txt @@ -218,7 +218,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -226,10 +226,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/PWSj9aUbl7.verified.txt index 064bd4a414..ce2ec69135 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/PWSj9aUbl7.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/RdmiRTq0Io.verified.txt index 0705bb7816..57b13ca5f9 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/RdmiRTq0Io.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/SwRDtR0cOK.verified.txt index 1cf94cef5e..192c344b12 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/SwRDtR0cOK.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Wm4zfAVYP7.verified.txt index 526c4fba02..caea496977 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/Wm4zfAVYP7.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ZC2jtVGSox.verified.txt index ad1a0e27a4..d34d68ae64 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ZC2jtVGSox.verified.txt @@ -237,7 +237,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -245,10 +245,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/beUUeB1dtC.verified.txt index 0ede22f1ed..821cde1fa7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/beUUeB1dtC.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/fWP2lfWLPk.verified.txt index 9650b3d537..edfc4041b7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/fWP2lfWLPk.verified.txt @@ -214,7 +214,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -222,10 +222,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ij75EzZOvs.verified.txt index 46ebfc03fa..c9754af162 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/ij75EzZOvs.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/l0KgzJEYIx.verified.txt index 7a53a20efc..54e1501852 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/l0KgzJEYIx.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mFIIJTvHXY.verified.txt index 3590ee05f7..81b7612f1f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mFIIJTvHXY.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mLHmiGlOxG.verified.txt index cbea20b027..d9dcb0c6ac 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/mLHmiGlOxG.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/o4gwuUPNtq.verified.txt index 8daf91d2d5..c22a487752 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/o4gwuUPNtq.verified.txt @@ -233,7 +233,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -241,10 +241,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/smZgSpu29K.verified.txt index bb8de2cc22..2c9e82340a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/smZgSpu29K.verified.txt @@ -215,7 +215,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -223,10 +223,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uE3HXfhovg.verified.txt index 474269ce97..de258500a9 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uE3HXfhovg.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uKvBMJhwaD.verified.txt index e9806c03c2..121c5daabf 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/uKvBMJhwaD.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/udEoaZL1DV.verified.txt index 1be659f4dc..1f2d2aba4f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/udEoaZL1DV.verified.txt @@ -219,7 +219,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -227,10 +227,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/w68jlFSN6b.verified.txt index 4dc4cdd381..ddf825a61d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v4.8/w68jlFSN6b.verified.txt @@ -238,7 +238,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -246,10 +246,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/07PcIVuj3q.verified.txt index 9d6e8f9f09..c9a932b544 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/07PcIVuj3q.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/0KEv27PfZM.verified.txt index a7aadd5c24..aa24c7860b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/0KEv27PfZM.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/53M01mFed0.verified.txt index bf74124927..b886543318 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/53M01mFed0.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/5gozITB9Re.verified.txt index 8e7534a952..15bcd98716 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/5gozITB9Re.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/7hiNp5tlXd.verified.txt index ff8a56f773..a1be9bf0af 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/7hiNp5tlXd.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BQCdbuCyxx.verified.txt index d65f49a0b5..c42a52262e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BQCdbuCyxx.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BYxnvHUM5h.verified.txt index fc6fd0a0a1..815a943b81 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BYxnvHUM5h.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Ba6Ah7G9BT.verified.txt index 78f69fbfb1..6bed429d38 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Ba6Ah7G9BT.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BbUYWGSZ7t.verified.txt index 0dc4cfa057..b443885bac 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/BbUYWGSZ7t.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Bbqck2QQEe.verified.txt index 5ed12e44ac..71b2d46b93 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Bbqck2QQEe.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/C3aV5bGuhC.verified.txt index 34057d5cb2..9b140cd760 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/C3aV5bGuhC.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/CpMibF5X1W.verified.txt index e538149d99..13208a6b35 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/CpMibF5X1W.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ETkaLLh9Fh.verified.txt index 215e2bc94b..6cd4a33fe4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ETkaLLh9Fh.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/F0A7L16fq0.verified.txt index bed74c6c50..f1ba78d208 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/F0A7L16fq0.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G2mouoq1fx.verified.txt index ad0550ff56..7a21074054 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G2mouoq1fx.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G7fYp2vqR9.verified.txt index ada1b5c6bf..01fdeeb1f4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/G7fYp2vqR9.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/GTwMaPNJRP.verified.txt index ee86fe9897..81c7d86596 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/GTwMaPNJRP.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Hhh5fuVEaa.verified.txt index a94375ef25..f58f6604a4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Hhh5fuVEaa.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ITWVYMGhio.verified.txt index 444f2d06fb..d799f94c01 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ITWVYMGhio.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/J8SezX4ArK.verified.txt index 21afa4ac2b..adf54d6141 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/J8SezX4ArK.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JY3027oK9C.verified.txt index 98bf6c2fdf..d3f0314a1f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JY3027oK9C.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JYus242bhT.verified.txt index f8f4c65610..4f08cca771 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/JYus242bhT.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/O3fNbJ8VN2.verified.txt index 420b34f38a..3f1dead8f7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/O3fNbJ8VN2.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/PWSj9aUbl7.verified.txt index 08dad97cc5..36daf1dc43 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/PWSj9aUbl7.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/RdmiRTq0Io.verified.txt index 10c8d4d9fb..078d3b3c60 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/RdmiRTq0Io.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/SwRDtR0cOK.verified.txt index 6e01020298..5c59f2d528 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/SwRDtR0cOK.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Wm4zfAVYP7.verified.txt index 442c59de5f..1588052654 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/Wm4zfAVYP7.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ZC2jtVGSox.verified.txt index bdee34d281..95dfb73924 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ZC2jtVGSox.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/beUUeB1dtC.verified.txt index 414af6c71c..27af35daae 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/beUUeB1dtC.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/fWP2lfWLPk.verified.txt index 3d482458cf..30b6f7afda 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/fWP2lfWLPk.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ij75EzZOvs.verified.txt index 6d5299676f..e0bd0e0703 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/ij75EzZOvs.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/l0KgzJEYIx.verified.txt index 8436f016c4..e18535d862 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/l0KgzJEYIx.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mFIIJTvHXY.verified.txt index f65f98a868..bfb6ee0951 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mFIIJTvHXY.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mLHmiGlOxG.verified.txt index 15acb1994c..d49cd1231e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/mLHmiGlOxG.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/o4gwuUPNtq.verified.txt index eeb5f5330c..b6b775e9b2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/o4gwuUPNtq.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/smZgSpu29K.verified.txt index 65b7b0a25e..a277c6d95a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/smZgSpu29K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uE3HXfhovg.verified.txt index 977c0dd74f..9ad3bc0ab3 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uE3HXfhovg.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uKvBMJhwaD.verified.txt index 75e48618a4..ef3dde11bc 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/uKvBMJhwaD.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/udEoaZL1DV.verified.txt index 3d9e8682c9..3d18694282 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/udEoaZL1DV.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/w68jlFSN6b.verified.txt index 0b648d6832..e8c8a104fa 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v5.0/w68jlFSN6b.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/07PcIVuj3q.verified.txt index 9d6e8f9f09..c9a932b544 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/07PcIVuj3q.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/0KEv27PfZM.verified.txt index a7aadd5c24..aa24c7860b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/0KEv27PfZM.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/53M01mFed0.verified.txt index bf74124927..b886543318 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/53M01mFed0.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/5gozITB9Re.verified.txt index 8e7534a952..15bcd98716 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/5gozITB9Re.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/7hiNp5tlXd.verified.txt index ff8a56f773..a1be9bf0af 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/7hiNp5tlXd.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BQCdbuCyxx.verified.txt index d65f49a0b5..c42a52262e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BQCdbuCyxx.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BYxnvHUM5h.verified.txt index fc6fd0a0a1..815a943b81 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BYxnvHUM5h.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Ba6Ah7G9BT.verified.txt index 78f69fbfb1..6bed429d38 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Ba6Ah7G9BT.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BbUYWGSZ7t.verified.txt index 0dc4cfa057..b443885bac 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/BbUYWGSZ7t.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Bbqck2QQEe.verified.txt index 5ed12e44ac..71b2d46b93 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Bbqck2QQEe.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/C3aV5bGuhC.verified.txt index 34057d5cb2..9b140cd760 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/C3aV5bGuhC.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/CpMibF5X1W.verified.txt index e538149d99..13208a6b35 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/CpMibF5X1W.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ETkaLLh9Fh.verified.txt index 215e2bc94b..6cd4a33fe4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ETkaLLh9Fh.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/F0A7L16fq0.verified.txt index bed74c6c50..f1ba78d208 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/F0A7L16fq0.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G2mouoq1fx.verified.txt index ad0550ff56..7a21074054 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G2mouoq1fx.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G7fYp2vqR9.verified.txt index ada1b5c6bf..01fdeeb1f4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/G7fYp2vqR9.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/GTwMaPNJRP.verified.txt index ee86fe9897..81c7d86596 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/GTwMaPNJRP.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Hhh5fuVEaa.verified.txt index a94375ef25..f58f6604a4 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Hhh5fuVEaa.verified.txt @@ -268,7 +268,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -276,10 +276,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ITWVYMGhio.verified.txt index 444f2d06fb..d799f94c01 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ITWVYMGhio.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/J8SezX4ArK.verified.txt index 21afa4ac2b..adf54d6141 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/J8SezX4ArK.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JY3027oK9C.verified.txt index 98bf6c2fdf..d3f0314a1f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JY3027oK9C.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JYus242bhT.verified.txt index f8f4c65610..4f08cca771 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/JYus242bhT.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/O3fNbJ8VN2.verified.txt index 420b34f38a..3f1dead8f7 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/O3fNbJ8VN2.verified.txt @@ -252,7 +252,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -260,10 +260,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/PWSj9aUbl7.verified.txt index 08dad97cc5..36daf1dc43 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/PWSj9aUbl7.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/RdmiRTq0Io.verified.txt index 10c8d4d9fb..078d3b3c60 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/RdmiRTq0Io.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/SwRDtR0cOK.verified.txt index 6e01020298..5c59f2d528 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/SwRDtR0cOK.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Wm4zfAVYP7.verified.txt index 442c59de5f..1588052654 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/Wm4zfAVYP7.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ZC2jtVGSox.verified.txt index bdee34d281..95dfb73924 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ZC2jtVGSox.verified.txt @@ -271,7 +271,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -279,10 +279,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/beUUeB1dtC.verified.txt index 414af6c71c..27af35daae 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/beUUeB1dtC.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/fWP2lfWLPk.verified.txt index 3d482458cf..30b6f7afda 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/fWP2lfWLPk.verified.txt @@ -248,7 +248,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -256,10 +256,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ij75EzZOvs.verified.txt index 6d5299676f..e0bd0e0703 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/ij75EzZOvs.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/l0KgzJEYIx.verified.txt index 8436f016c4..e18535d862 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/l0KgzJEYIx.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mFIIJTvHXY.verified.txt index f65f98a868..bfb6ee0951 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mFIIJTvHXY.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mLHmiGlOxG.verified.txt index 15acb1994c..d49cd1231e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/mLHmiGlOxG.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/o4gwuUPNtq.verified.txt index eeb5f5330c..b6b775e9b2 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/o4gwuUPNtq.verified.txt @@ -267,7 +267,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -275,10 +275,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/smZgSpu29K.verified.txt index 65b7b0a25e..a277c6d95a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/smZgSpu29K.verified.txt @@ -249,7 +249,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -257,10 +257,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uE3HXfhovg.verified.txt index 977c0dd74f..9ad3bc0ab3 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uE3HXfhovg.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uKvBMJhwaD.verified.txt index 75e48618a4..ef3dde11bc 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/uKvBMJhwaD.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/udEoaZL1DV.verified.txt index 3d9e8682c9..3d18694282 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/udEoaZL1DV.verified.txt @@ -253,7 +253,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -261,10 +261,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/w68jlFSN6b.verified.txt index 0b648d6832..e8c8a104fa 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v6.0/w68jlFSN6b.verified.txt @@ -272,7 +272,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -280,10 +280,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/07PcIVuj3q.verified.txt index 0873fddf31..b416d62706 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/07PcIVuj3q.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/0KEv27PfZM.verified.txt index db5fea3b99..67ca303b3e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/0KEv27PfZM.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/53M01mFed0.verified.txt index 50242bb4c4..5eb72c72d1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/53M01mFed0.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/5gozITB9Re.verified.txt index f082f89216..a4367d73fd 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/5gozITB9Re.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/7hiNp5tlXd.verified.txt index b1a58d3d5c..de104b179f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/7hiNp5tlXd.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BQCdbuCyxx.verified.txt index 3cc926a6ef..ec978b9a4c 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BQCdbuCyxx.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BYxnvHUM5h.verified.txt index 8df9e0f30b..66cc276015 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BYxnvHUM5h.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Ba6Ah7G9BT.verified.txt index 102b0c759e..2be0fc6f18 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Ba6Ah7G9BT.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BbUYWGSZ7t.verified.txt index d9730b4c90..4352e2f2e8 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/BbUYWGSZ7t.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Bbqck2QQEe.verified.txt index 833664b668..9453def20a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Bbqck2QQEe.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/C3aV5bGuhC.verified.txt index 502c84fabf..21603f3b38 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/C3aV5bGuhC.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/CpMibF5X1W.verified.txt index 81fe2ae1d1..4ca23d5d9d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/CpMibF5X1W.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ETkaLLh9Fh.verified.txt index e3cbf62851..6a6be6b62f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ETkaLLh9Fh.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/F0A7L16fq0.verified.txt index 2a687d89ae..2ff7dd3e6c 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/F0A7L16fq0.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G2mouoq1fx.verified.txt index 49918f2d73..10c1d126f1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G2mouoq1fx.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G7fYp2vqR9.verified.txt index e301731f90..6bd9ff1c0d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/G7fYp2vqR9.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/GTwMaPNJRP.verified.txt index cb0689f5d6..404f10ddef 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/GTwMaPNJRP.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Hhh5fuVEaa.verified.txt index 600f51f647..9cc986e19b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Hhh5fuVEaa.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ITWVYMGhio.verified.txt index 503d66aed3..fa03e6e3d5 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ITWVYMGhio.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/J8SezX4ArK.verified.txt index 683d23934d..4948252306 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/J8SezX4ArK.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JY3027oK9C.verified.txt index 630528fdf7..e1899d28e1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JY3027oK9C.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JYus242bhT.verified.txt index c3079fde55..db2bb13a01 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/JYus242bhT.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/O3fNbJ8VN2.verified.txt index 5d6e1ae525..1840fdd74d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/O3fNbJ8VN2.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/PWSj9aUbl7.verified.txt index d33ed12984..001e66792e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/PWSj9aUbl7.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/RdmiRTq0Io.verified.txt index d4e3b4d16e..6f0d81b888 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/RdmiRTq0Io.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/SwRDtR0cOK.verified.txt index e251c738ee..877a01e319 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/SwRDtR0cOK.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Wm4zfAVYP7.verified.txt index de1c9a4172..e0df6b1c4a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/Wm4zfAVYP7.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ZC2jtVGSox.verified.txt index fa1b6ed0bc..c89b55e79b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ZC2jtVGSox.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/beUUeB1dtC.verified.txt index 2ce29992f3..2f5a90cb22 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/beUUeB1dtC.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/fWP2lfWLPk.verified.txt index 03fbc952db..7cbf39f2f9 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/fWP2lfWLPk.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ij75EzZOvs.verified.txt index 2d6affa456..fde1de8615 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/ij75EzZOvs.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/l0KgzJEYIx.verified.txt index a89b1cf504..55ffa2e4a6 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/l0KgzJEYIx.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mFIIJTvHXY.verified.txt index 52b5ba79a1..bd52f06b5a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mFIIJTvHXY.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mLHmiGlOxG.verified.txt index bcf0a786e1..675b061d53 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/mLHmiGlOxG.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/o4gwuUPNtq.verified.txt index dc854e0922..cb2406aed8 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/o4gwuUPNtq.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/smZgSpu29K.verified.txt index a49134fa90..221bb14976 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/smZgSpu29K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uE3HXfhovg.verified.txt index a82c57213e..9bc889fe86 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uE3HXfhovg.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uKvBMJhwaD.verified.txt index 658d943655..7712e2e265 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/uKvBMJhwaD.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/udEoaZL1DV.verified.txt index 21749f95d5..d6984f0a98 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/udEoaZL1DV.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/w68jlFSN6b.verified.txt index fd50d0b74b..09914ba3e1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v7.0/w68jlFSN6b.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/07PcIVuj3q.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/07PcIVuj3q.verified.txt index 0873fddf31..b416d62706 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/07PcIVuj3q.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/07PcIVuj3q.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/0KEv27PfZM.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/0KEv27PfZM.verified.txt index db5fea3b99..67ca303b3e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/0KEv27PfZM.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/0KEv27PfZM.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/53M01mFed0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/53M01mFed0.verified.txt index 50242bb4c4..5eb72c72d1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/53M01mFed0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/53M01mFed0.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/5gozITB9Re.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/5gozITB9Re.verified.txt index f082f89216..a4367d73fd 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/5gozITB9Re.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/5gozITB9Re.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/7hiNp5tlXd.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/7hiNp5tlXd.verified.txt index b1a58d3d5c..de104b179f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/7hiNp5tlXd.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/7hiNp5tlXd.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BQCdbuCyxx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BQCdbuCyxx.verified.txt index 3cc926a6ef..ec978b9a4c 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BQCdbuCyxx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BQCdbuCyxx.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BYxnvHUM5h.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BYxnvHUM5h.verified.txt index 8df9e0f30b..66cc276015 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BYxnvHUM5h.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BYxnvHUM5h.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Ba6Ah7G9BT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Ba6Ah7G9BT.verified.txt index 102b0c759e..2be0fc6f18 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Ba6Ah7G9BT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Ba6Ah7G9BT.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BbUYWGSZ7t.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BbUYWGSZ7t.verified.txt index d9730b4c90..4352e2f2e8 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BbUYWGSZ7t.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/BbUYWGSZ7t.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Bbqck2QQEe.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Bbqck2QQEe.verified.txt index 833664b668..9453def20a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Bbqck2QQEe.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Bbqck2QQEe.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/C3aV5bGuhC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/C3aV5bGuhC.verified.txt index 502c84fabf..21603f3b38 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/C3aV5bGuhC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/C3aV5bGuhC.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/CpMibF5X1W.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/CpMibF5X1W.verified.txt index 81fe2ae1d1..4ca23d5d9d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/CpMibF5X1W.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/CpMibF5X1W.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ETkaLLh9Fh.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ETkaLLh9Fh.verified.txt index e3cbf62851..6a6be6b62f 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ETkaLLh9Fh.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ETkaLLh9Fh.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/F0A7L16fq0.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/F0A7L16fq0.verified.txt index 2a687d89ae..2ff7dd3e6c 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/F0A7L16fq0.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/F0A7L16fq0.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G2mouoq1fx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G2mouoq1fx.verified.txt index 49918f2d73..10c1d126f1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G2mouoq1fx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G2mouoq1fx.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G7fYp2vqR9.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G7fYp2vqR9.verified.txt index e301731f90..6bd9ff1c0d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G7fYp2vqR9.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/G7fYp2vqR9.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/GTwMaPNJRP.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/GTwMaPNJRP.verified.txt index cb0689f5d6..404f10ddef 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/GTwMaPNJRP.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/GTwMaPNJRP.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Hhh5fuVEaa.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Hhh5fuVEaa.verified.txt index 600f51f647..9cc986e19b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Hhh5fuVEaa.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Hhh5fuVEaa.verified.txt @@ -336,7 +336,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -344,10 +344,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ITWVYMGhio.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ITWVYMGhio.verified.txt index 503d66aed3..fa03e6e3d5 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ITWVYMGhio.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ITWVYMGhio.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/J8SezX4ArK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/J8SezX4ArK.verified.txt index 683d23934d..4948252306 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/J8SezX4ArK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/J8SezX4ArK.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JY3027oK9C.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JY3027oK9C.verified.txt index 630528fdf7..e1899d28e1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JY3027oK9C.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JY3027oK9C.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JYus242bhT.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JYus242bhT.verified.txt index c3079fde55..db2bb13a01 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JYus242bhT.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/JYus242bhT.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/O3fNbJ8VN2.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/O3fNbJ8VN2.verified.txt index 5d6e1ae525..1840fdd74d 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/O3fNbJ8VN2.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/O3fNbJ8VN2.verified.txt @@ -320,7 +320,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -328,10 +328,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/PWSj9aUbl7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/PWSj9aUbl7.verified.txt index d33ed12984..001e66792e 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/PWSj9aUbl7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/PWSj9aUbl7.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/RdmiRTq0Io.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/RdmiRTq0Io.verified.txt index d4e3b4d16e..6f0d81b888 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/RdmiRTq0Io.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/RdmiRTq0Io.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/SwRDtR0cOK.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/SwRDtR0cOK.verified.txt index e251c738ee..877a01e319 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/SwRDtR0cOK.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/SwRDtR0cOK.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Wm4zfAVYP7.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Wm4zfAVYP7.verified.txt index de1c9a4172..e0df6b1c4a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Wm4zfAVYP7.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/Wm4zfAVYP7.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ZC2jtVGSox.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ZC2jtVGSox.verified.txt index fa1b6ed0bc..c89b55e79b 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ZC2jtVGSox.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ZC2jtVGSox.verified.txt @@ -339,7 +339,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -347,10 +347,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_recordConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/beUUeB1dtC.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/beUUeB1dtC.verified.txt index 2ce29992f3..2f5a90cb22 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/beUUeB1dtC.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/beUUeB1dtC.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/fWP2lfWLPk.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/fWP2lfWLPk.verified.txt index 03fbc952db..7cbf39f2f9 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/fWP2lfWLPk.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/fWP2lfWLPk.verified.txt @@ -316,7 +316,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -324,10 +324,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ij75EzZOvs.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ij75EzZOvs.verified.txt index 2d6affa456..fde1de8615 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ij75EzZOvs.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/ij75EzZOvs.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/l0KgzJEYIx.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/l0KgzJEYIx.verified.txt index a89b1cf504..55ffa2e4a6 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/l0KgzJEYIx.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/l0KgzJEYIx.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mFIIJTvHXY.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mFIIJTvHXY.verified.txt index 52b5ba79a1..bd52f06b5a 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mFIIJTvHXY.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mFIIJTvHXY.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mLHmiGlOxG.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mLHmiGlOxG.verified.txt index bcf0a786e1..675b061d53 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mLHmiGlOxG.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/mLHmiGlOxG.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_recordConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/o4gwuUPNtq.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/o4gwuUPNtq.verified.txt index dc854e0922..cb2406aed8 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/o4gwuUPNtq.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/o4gwuUPNtq.verified.txt @@ -335,7 +335,7 @@ public System.Guid Value { public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -343,10 +343,15 @@ public System.Guid Value writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_classConversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/smZgSpu29K.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/smZgSpu29K.verified.txt index a49134fa90..221bb14976 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/smZgSpu29K.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/smZgSpu29K.verified.txt @@ -317,7 +317,7 @@ namespace Whatever { public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -325,10 +325,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_readonly_partial_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uE3HXfhovg.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uE3HXfhovg.verified.txt index a82c57213e..9bc889fe86 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uE3HXfhovg.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uE3HXfhovg.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uKvBMJhwaD.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uKvBMJhwaD.verified.txt index 658d943655..7712e2e265 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uKvBMJhwaD.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/uKvBMJhwaD.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_sealed_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/udEoaZL1DV.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/udEoaZL1DV.verified.txt index 21749f95d5..d6984f0a98 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/udEoaZL1DV.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/udEoaZL1DV.verified.txt @@ -321,7 +321,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -329,10 +329,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_structConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) diff --git a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/w68jlFSN6b.verified.txt b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/w68jlFSN6b.verified.txt index fd50d0b74b..09914ba3e1 100644 --- a/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/w68jlFSN6b.verified.txt +++ b/tests/SnapshotTests/JsonNumberCustomizations/snapshots/snap-v8.0/w68jlFSN6b.verified.txt @@ -340,7 +340,7 @@ namespace Whatever { public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(reader.GetGuid()); } public override void Write(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options) @@ -348,10 +348,15 @@ namespace Whatever writer.WriteStringValue(value.Value); } -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER // we can't call Read or use GetGuid from JsonReader as it expects a token type of string, but here we have have 'propertyname'. public override stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) { - return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(System.Guid.Parse(reader.GetString())); + if (global::System.Guid.TryParse(reader.GetString(), out global::System.Guid g)) + { + return stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized.Deserialize(g); + } + + throw new global::System.Text.Json.JsonException("Unable to parse the GUID for an instance of stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized"); } public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, stj_number_as_string_public_partial_record_classConversions_NewtonsoftJson___Conversions_SystemTextJsonSystem_Guid_customized value, global::System.Text.Json.JsonSerializerOptions options)