replaysMike / AnyClone

A CSharp library that can deep clone any object using only reflection.
MIT License
49 stars 8 forks source link

clone System.Text.Json.Serialization.JsonSerializerOptions throws exception. #8

Open StevenTCramer opened 5 years ago

StevenTCramer commented 5 years ago

trying to clone JsonSerializerOptions in dotnet core 3 throws exception.

JsonNamingPolicy.CamelCase is not an enum but some crazy object.

using System.Text.Json.Serialization;

    public void ShouldCloneJsonSerializationOptions()
    {
      var jsonSerializerOptions = new JsonSerializerOptions
      {
        PropertyNamingPolicy = JsonNamingPolicy.CamelCase
      };

      JsonSerializerOptions clone = jsonSerializerOptions.Clone();
      clone.PropertyNamingPolicy.ShouldBe(JsonNamingPolicy.CamelCase);
    }
replaysMike commented 5 years ago

This is being looked at today, I'll follow up when the fix is merged

StevenTCramer commented 5 years ago

@replaysMike Any update on this and https://github.com/TimeWarpEngineering/blazor-state/issues/148

I'm pushing out another update to Blazor-State today.