[FileSystem] File System - file manipulation issues

[FileSystem] File System - file manipulation issues

  
Forge Component
(20)
Published on 5 Jan by Labs
20 votes
Published on 5 Jan by Labs

Recently I've been envolved in the development of a solution that requires to intensively manipulate files located in remote share folders.

Since it entered in production, we've started to have some random errors while trying to access existing files. As soon as the solution adoption increased, the issues were already happening almost everyday. Analyzing the occurrence behavior, we've perceived that these errors were only occurring on web requests that were trying to access files almost immediately after their creation had happen.


Checking the File System extension, the file actions use the Close method but don't explicitly dispose the resources used.

It is a best practice that, when using unmanaged resources (like streams, file handles, remote connections...), an approach should be used to inform the garbage collector that resources can be released as soon as they are not needed.

After including the "using" statement to the extension actions, the problem simply stopped to occur.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-statement

Hi Tiago,

Can you please provide the changes you made? 

I can give a look to incorporate them on the distributed version.


regards,

João Portela

In attach!

Regards,

Tiago Peres

Thanks,

I'll give a look and try to merge your changes next week.


regards,

João Portela