Read file is occupied, CBOTS will close, please help me

Created at 13 Nov 2017, 17:13
34

344260146

Joined 04.11.2017

Read file is occupied, CBOTS will close, please help me
13 Nov 2017, 17:13


 

  if (System.IO.File.Exists(fiNameA) == true)
            { 
                MT4ask = double.Parse(File.ReadAllText(fiNameA));

           }

 

When I read the "fiNameA" file, just the file is written.
"Crashed in OnTimer with IOException: The process cannot access the file'c:\download\calgo\exp-USDTRYBIDCOPY.csv'because it is being used by another process.""
Then the CBOTS automatically closes. Do you have 2 solutions?,
1: determine whether the file is occupied?
2: make CBOTS error does not automatically quit?

Thanks.

 

Thanks


@344260146
Replies

PanagiotisCharalampous
20 Nov 2017, 12:10

Hi 344260146,

The solution to your problem is to properly handle the exception thrown by your code. Read more about exception handling here or here.

Best Regards,

Panagiotis


@PanagiotisCharalampous