Stack trace: Invalid attempt to call WinAPI::findFirstFile running in CIL on the client
This error you will normally encounter when running a batch job. The issue is that batch processing doesn't suppport WINAPI::findFirstFile method. Actually I was trying to find a file in the folder and moving to some other folder, you can use this alternative:
public void run()
{
System.IO.DirectoryInfo di;
System.Type arrayType;
System.Array array;
System.IO.FileInfo
fi;
FilePath filePath, moveFilePath,
shortFile;
int i;
int l;
;
super();
baseFolder = tEC_InterfaceSetup.TEC_DefaultFolder +"\\";
di = new System.IO.DirectoryInfo(baseFolder);
arrayType = System.Type::GetType("System.IO.FileInfo");
array = System.Array::CreateInstance(arrayType, 1);
array = di.GetFiles("*" + #txt);
l = array.get_Length();
if (l > 0)
{
//Find the files in the base folder and iterate.
for (i = 0; i < l; i++)
{
fi = array.GetValue(i);
mainFolder = fi.get_FullName();
foundBaseFileName = fi.get_Name();
//**********Your logic************
}
InterfaceTransfer::moveFile(foundBaseFileName , moveFilePath);
}
}
server static void moveFile(str fileName, str newFileName)
{
#File
Set permissionSet;
permissionSet = new Set(Types::Class);
permissionSet.add(new FileIOPermission(fileName,#io_write));
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
CodeAccessPermission::assertMultiple(permissionSet);
System.IO.File::Move(fileName, newFileName);
CodeAccessPermission::revertAssert();
}
Hope this helps.
Have you seen this error: Stack trace: Invalid attempt to call formletterParmData.promptChooseLinesOnClient running in CIL on the client. What does this mean and how do I resolve it? Also, when are you supposed to run the "Compile into .net framework CIL" from the system admin screen in AX2012? Thanks, I am a newbie.
ReplyDeleteI am not sure about this error. Can you further elaborate what are you trying yo do which causes this error?
ReplyDeleteAs far as your second question is concerned, whenever you make changes in the code or in SSRS design fom .net, its better you perform incremental IL generation in AX2012 so that everything is synced. I have sometimes encountered that you make a code change and if you don't run incremental IL then your old code is reflected at the time of execution of the code.
Great Site, The Course were so simple and easy to understand.
ReplyDeleteMEAN Stack Online Training
MEAN Stack Training Institute
MEAN Stack Training
MEAN Stack Training in Hyderabad
MEAN Stack Training in Ameerpet
I very much appreciate your help.
ReplyDeleteFull Stack Training in Chennai | Certification | Online Training Course | Full Stack Training in Bangalore | Certification | Online Training Course | Full Stack Training in Hyderabad | Certification | Online Training Course | Full Stack Training in Pune | Certification | Online Training Course | Full Stack Training | Certification | Full Stack Online Training Course