07-18-2022
03:54 AM
- last edited
a week ago
by
JackLacava
I am getting an error while trying to access the file from the BR .
The process cannot access the file '\\XXXXXX.file.core.windows.net\onestreamshareprd1\FileShare\Applications\XXXXXXX\Groups\Everyone\XXXXXX\File_XXXXX.zip' because it is being used by another process.
07-18-2022 09:36 AM
If you access a file from a business rule, you first need open the file, than you do your activity, and then you close it. This is VB.net standard. If you open the file, but not close it, an error message like yours appears.
A common reason for open files is an error during the runtime, so that you opened the file but never succeed closing it. To avoid such a situation, you can use the try error handling to close the file even after running in a bug.
11-29-2022 10:04 AM
I am getting the same error when trying to write to a file ... I think it's due to multithreading
Dim oFile As StreamWriter = New StreamWriter(BRAPi.Utilities.GetFileShareFolder(si, FileShareFolderTypes.ApplicationIncoming, Nothing).Replace("\Incoming","\Groups\Everyone\test1.txt"),True)
oFile.WriteLine( api.Pov.Time.Name & " | " & api.Pov.Entity.Name & " | " & dataBuffSource.DataBufferCells.Count & " | " & elapsedTime )
oFile.Close
12-25-2022 08:09 AM
Probably. There are asynchronous versions of Write and WriteLine: WriteAsync and WriteLineAsync. But didn‘t tried it yet, so I don‘t know details.
01-03-2023 09:33 AM
Thank You Chrsitian for the reply! I will look into those two methods for my business rule