error CS1504: Source file '...' could not be opened ('The system cannot find the file specified. ')

710 views
Skip to first unread message

Mike Dazzo

unread,
Oct 16, 2013, 12:37:28 PM10/16/13
to cs-s...@googlegroups.com



Hi Oleg and community,

Occasionally we encounter the below error.  This started occurring after upgrading to the newer version.  Previously we were encountering the similar error around the caching naming collision issue (on rare occasions): "couldn't open file as it was already opened".  After upgrading I now run in to the below error on semi rare occasions.  It is occurring more frequent than the previous mentioned issue, but not enough to narrow in on the issue.  The below example (UpdateLastProcessedFileId.cs) was not run in concurrency however the abstract class (CSWrapper.cs) is leveraged in all scripts which are executing concurrently.

I know this is a long shot but any guesses what this could be?  I tried digging into csscript.CSExecutor.ProcessCompilingResult() but I didn't see anything jumping out at me.  Not sure if this matters but this is running on both Windows Server 2003 (x64) and 2008 (x64).  The below example is from an 03 server.


C# Script execution engine. Version 3.6.0.0.
Copyright (C) 2004-2013 Oleg Shilo.

Error: Specified file could not be compiled.

csscript.CompilerException: (0,0): error CS1504: Source file 'c:\Documents and Settings\SvcDMA3_SCRA\Local Settings\Temp\CSSCRIPT\Cache\1710766447\i_CSWrapper_-1603028500.cs' could not be opened ('The system cannot find the file specified. ')
(0,0): error CS1504: Source file 'c:\Documents and Settings\SvcDMA3_SCRA\Local Settings\Temp\CSSCRIPT\Cache\1710766447\UpdateLastProcessedFileId.attr.g.cs' could not be opened ('The system cannot find the file specified. ')

at csscript.CSExecutor.ProcessCompilingResult(CompilerResults results, CompilerParameters compilerParams, ScriptParser parser, String scriptFileName, String assemblyFileName, String[] additionalDependencies)
at csscript.CSExecutor.Compile(String scriptFileName)
at csscript.CSExecutor.ExecuteImpl()

Oleg Shilo

unread,
Oct 16, 2013, 7:42:05 PM10/16/13
to cs-s...@googlegroups.com
Hi Mike,

It is a strange one. The generation of the *.attr.g.cs files is system-wide synchronized (to handle the race conditions). Saying that the synchronization is done in the parent method "Compile" and the Mutex.WaitOne has a deliberate short timeout (just 3 seconds) to avoid dead-locks and trigger "FileLocked" exceptions instead. This mechanism worked OK so far, however it let some small probability for the auto-code generating go out of sync. Such a probability would increase when system is under stress. Also previously I have had some rare (and not fully confirmed) reports indicating that the MS C# compiler (csc.exe) may keep source files locked for some time after it returns the compiling result. So may be it is what you have....

To deal with is I have prepared the HotFix release v3.6.4 for you (http://www.csscript.net/LatestBuild.html). It is identical to the previous release except it introduces the error handling with the retry mechanism for the generation of the *.attr.g.cs files. On top of it it implements additional independent synchronization (global Mutex). 

Please try the fix as it may be exactly what you are looking for.

Cheers,
Oleg

--
You received this message because you are subscribed to the Google Groups "CS-Script" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cs-script+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mike Dazzo

unread,
Nov 1, 2013, 4:32:36 PM11/1/13
to cs-s...@googlegroups.com, osh...@gmail.com
Oleg, Thanks for the reply.  I am slowly working this into our environments and will post an update when I can confirm or deny anything.

Regards,
Mike
Reply all
Reply to author
Forward
0 new messages