Base solution for your next web application
Open Closed

Upgrade Notes From v12 to v13.1 #11893


User avatar
0
rickfrankel created

Hi All,

I'm going to document notes of frustration here on the upgrade from v12 to v13.

First thing is the change from Newtonsoft to System.Text.Json is massive and one to be very aware of.

Issue List

  1. The change to System.Text.Json breaks serialization of TimeSpan objects if you are using them in your DTO's (which we were). The long story short here is that Swashbuckle doesn't know how to handle TimeSpans correctly when using System.Text.Json refer to this link for how to make it go back to using strings for them. https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2505

Oh boy where to start on this one. If you are storing json in the DB at all you're going to have a lot of fun. System.Text.Json doesn't use camelCase by default and our Json was all camelCase. That's easy enough to work around you can just use the JsonExtensions.CreateJsonSerializerOptions and pass in the correct parameters when you are using FromJsonString etc.

Next thing to note however is that CreateJsonSerializationOptions adds in a bunch of AbpConvertors. One of them doesn't play nicely with nullable objects. Eg: We have a nullable int. We want to also use the numberhandling options to allow for numbers to be strings. ~~ Except this doesn't work when you have a nullable int because the AbpConvertor takes over and doesn't respect the numberhandling options or attributes.~~

Ok the attribute doesn't work but the options on the seralizer do. However you need to note that the serializer options are cached and once they are setup and used once they cannot ever be changed. We had to modify our startup.cs to create the JSON serialisation options with all combinations of camelcase and write intended. Set the number handling options we want there to ensure the options were cached with our correct settings from the start.

To handle that we have to manually remove that convertor from our options after creation and then it seems to work.

  1. We were using Metronic card objects and creating them dynamically using new KTCard(#xxxx). The Metronic upgrade changes how card's work and they are now based off of Boostrap cards, which removes card.js and also removes KTCard and the way it works. We haven't found a work around yet. Will update this ticket if/when we find a workaround.
    • WORKAROUND: We were using collapsing cards which is why we needed to new KTCard them. We can use ngx-bootstrap collapse and got around this problem. Not native metronic but it works.

~~3) Scrollbars in modals seem to disappear when the modal loses focus. This is in particular to scrollbars which exist within the modal and not full pages scrollbars. We're still investigating this one.~~ This is not an issue and was our own fault.

  1. Features and redis caching and potentially other items you cache are broken. See the link in the comment below. More to come :)

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @rickfrankel

    Thanks for pointing out these breaking changes. For System.Text.Json, you can switch back to Newtonsoft if you wish. For Metronic, maybe you can copy KTCard code from old version and use it in your project.

  • User Avatar
    0
    rickfrankel created

    Thanks.

    We've worked around KTCard for now. However for anyone who stumbles on this support ticket at a later date.

    Please note the following issue with v13.1.0, which is a problem if you are using features and redis caching.

    https://support.aspnetzero.com/QA/Questions/11899/Feature-Management-Not-Working-When-Redis-Cache-Enabled-In-v1310

    I've also added a third item to the list above we are still working on.

  • User Avatar
    0
    ismcagdas created
    Support Team

    We will try to fix bugs as soon as possible. Thanks again for your effort :).