Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

FileProvider keeps recreating a remotely deleted folder

We have a seemingly randomly (and rarely) reproducible bug when a Microsoft Word (or Excel, Powerpoint...) temporary file with the ~$ prefix is not removed when the document is closed and causes a remotely deleted folder to be recreated via our file provider extension. We have received multiple issues from our users for some time now, and we could not reproduce it so far, but finally got a repro but could not identify the cause.

We could reproduce it with the following steps, however not always, and only on one computer:

  1. We have the following file: FileProviderRoot/TEST/INSIDE/somefile.docx
  2. Open this file, edit with MS Word. A ~$mefile.docx hidden, temporary file is created next to the original file, while it is open in Word. This temp file is ignored by our file provider implementation by returning an .excludeFromSync error code.
  3. Save the file, modifications are synced. (don't know if this step is needed)
  4. We delete the container folder (FileProviderRoot/TEST/INSIDE) from within our app, the deletion change is propagated to the file provider, which in turn receives a call to createItem(basedOn:fields:contents:options:request:completionHandler:) that recreates the INSIDE folder, as - for some reason - the temp file cannot be deleted. Now we are stuck in this loop of delete/recreate until we go into the file provider folder and manually remove the stuck temp file.

We would expect that the folder is not recreated but also removed from the file provider and disk along with the temp file. On the device that this issue was reproduced, it also seems to work correctly most of the time, but needs manual fixing when this issue occurs.

We have a related bugreport: FB17928069

FileProvider keeps recreating a remotely deleted folder
 
 
Q