Open Mutuduxf opened 8 months ago
The serialization should does not handle null checks at the moment since it is deferring the usage to the caller. But thanks for mentioning this, I can put a null check in place to avoid the exception.
@Mutuduxf , I have pushed the changes to version 1.4.4. Please test again and reopen if it is still an issue. Thanks
@Mutuduxf , I have pushed the changes to version 1.4.4. Please test again and reopen if it is still an issue. Thanks
Hi, @rpgmaker , Thanks for your great work. I upgraded to 1.4.4 and tested it, but something interesting has happened. The new code can pass in Net Core, but Framework 4.8 cannot. I have decompiled the dll file from the nuget package (version 1.4.4, net 6.0) and found that there is no new code in it (but it can pass the test in net core!). So I debug the unit test code and step into the source code from NetJson (IDE Rider). In Framework 4.8, there is no new code in it (determine whether it is null in the method SerializeObject), so it cannot pass the tests. But in Net Core, there is an error in the code line positioning (it feels like the problem is with the pdb file). Finally, to verify if there is a problem with my development environment, I launch it in Visual Studio and try it again, and the test results are the same. I am sorry, I am not the collaborator, so I cannot reopen this issue.
That is strange. I wonder if I did not copy the assembly correctly from my machine. I will check it tomorrow. Thanks
Because
SerializeObject
is merely a wrapper aroundSerialize
, the type information is obtained by callingvalue.GetType()
. This is not how json serializers are typically used. (Perhaps I do not have enough experience.)