KevinJump/uSync

Wrong serialization file when saving DocumentType

Closed this issue · 6 comments

Hi,

after saving DocumentType the serialized .config file in ContentTypes is replaced with .config file containing only <Empty change="Rename">, like the DocumentType was renamed, but it was not.
After exporting all Settings items using Settings Export button, then the corrupted .config file is repaired.
This behaviour is only in in the version 13.1.x of uSync, the previous versions are fine.

We are using ExportOnSave and we have custom Folders set up like this:

      "ExportOnSave": "All",
      "Folders": [ "c:\\Projects\\Customer\\Solution\\Project.Domain\\uSync", "uSync/v9/" ],
      "IsRootSite": true,
      "LockRoot": false,

The same behaviour is when switching to child site with custom folder like:

      "Folders": [ "uSync/root/", "c:\\Projects\\Solution\\Project.Domain\\uSync" ],
      "IsRootSite": false,

The RootFolder is set to the same folder as is in the Folders setting:

      "RootFolder": "c:\\Projects\\Solution\\Project.Domain\\uSync",

To Reproduce
Steps to reproduce the behavior:

  1. Setup custom RootFolder to a different directory
  2. Setup Folders to the same directory for root or child
  3. Enable ExportOnSave
  4. Try to save any DocumentType

Expected behavior
The saved .config file should contain the serialized DocumentType.

About your Site (please complete the following information):

  • Umbraco Version: 13.1.1
  • uSync Version: 13.1.1
  • Browser [e.g. chrome, safari]: Chrome

Hi,

Thanks for this, I looks like the roots thing isn't working out that the file has been saved somewhere else 🤔 - We will take a look at get this fixed !

Hi,

Just looking into this, and seeking a bit more info to reproduce

  • I am assuming the physical paths are outside of the Webroot for the site(s). is this correct?
  • does the doctype exist in any of the folders (root or site) before you attempt the save?
  • can you confirm there isn't another doctype in either the root or the site folder with the same key (guid value) as the doctype you are trying to save. that would cause a rename, because the key would be found and assumed it was renamed.

Hi there,

  • yes, you're right, we have Domain project that contains uSync serialized items and a Website project containing the site.

  • The doctype doesn't exist anywhere else. I've tried more doctypes with the same result.
    There is just the one serialized item in the whole solution. I've searched by filename and then all files containing the same GUID key and nothing else but the one file was found.
    Even git shows that just the one file was changed and nothing was added.
    Even when I create a new one, then there is generated rename file and nothing else.

<?xml version="1.0" encoding="utf-8"?>
<Empty Key="c307e5cc-42f0-40a0-8ee7-1766daf412e0" Alias="test" Change="Rename" />
  • When I export all doctypes then the file is filled with content again, I assume that the rename file would be preserved if it was found somewhere else.

Hi,

I would just add, that the same behaviour is with DataDatypes, MediaTypes, Templates and Translations.
On the other hand saving Media and Content is correct.
It is enough just to save without any change.
The Report shows no changes.
Is it possible to enable debug logging for uSync somehow?

Hi,

yeah the case where the folder the items are being saves is outside the site root was the issue :( . there is a clean up method at the end of the process that just makes sure we haven't created a duplicate, but it wasn't getting past the absolute path of the file when it's outside the site root.

Fixed and Nightly avalible now :
https://dev.azure.com/jumoo/Public/_artifacts/feed/nightly/NuGet/uSync/overview/13.1.2-build.20230306.1

Will do some further tested and look at a patch release

Thank you very much.