I wrote code in AX 2009 to poll a directory on a network drive every 1 second, waiting for a file to respond from another system. I noticed that using the file explorer window, I could see that the file appeared, but my code did not see or process the file for several seconds - up to 9 seconds (and 9 polls) after the file appeared!
AX code calls System.IO.Directory::GetFiles()with ClrInterop:
interopPerm = new InteropPermission(InteropKind::ClrInterop);
interopPerm.assert();
files = System.IO.Directory::GetFiles(
// etc...
CodeAccessPermission::revertAssert();
After long experiments, it turned out that for the first time in my life program, the program that I call ::GetFiles(), it starts the conditional "ticking clock" with a period of 10 seconds. Only every 10 seconds calls all new files that may have appeared, although they still report files found in an earlier 10-second tick from the first call ::GetFiles().
If there is no file when starting the program, all other calls ::GetFiles(), 1 second after the first call, 2 seconds, etc., up to 9 seconds after that, just do not see the file, although it may have sat there from 0, 5 seconds after the first call!
, , 10 . 11 19 , , 20 . , 10 .
, AX AOS-, , , , , .
10s , , , , .
, , 10- ; , .
?