locked
Method 'DeleteFile' of object 'IFileSystem3' failed. System gets stuck if try to delete/rename after this error RRS feed

  • Question

  • I have a system with windows 7 OS. I have one automation project which does the job of building the setup using NSIS wrapper. There are many file operations happens like copying and deleting the files etc. When the specific file is being deleted in visual basic coding, I get the error like “Method 'DeleteFile' of object 'IFileSystem3' failed”. The file for this error coming is MDAC_TYP.EXE with size of 5 MB.

    Scenario:

    Server (Windows server 2012) drive is mapped to the local windows 7 system and whole operation is run in this mapped drive in client machine. Both the client and server are connected to the 1Gbps LAN. Now when I run my project to build the setup, it copies all the application files to a folder called Temp and then it builds the setup exe using the NSIS (makeNSIS). After the creation of NSIS setup, it will delete all the source files from temp folder and again it will copy some other files to the same temp folder for next setup.

    Sometimes, while deleting the MDAC_TYP.exe file, I get the error as mentioned above. There are two folders with same structure called ‘Build1’ and ‘Build2’. Build1 is used for testing environment and Build2 is for production environment. Temp folder will be created in both the folders while running testing and production setup.

    The above said error comes for both the Build1 & Build2 folders and the error comes occasionally (not every time) for the same exe. The MDAC_TYP.EXE file has read-only permission in the place from where I copy the file to the TEMP directory inside build1 & build2 for NSIS script. In the visual basic code, I use FileSystemObject.DeleteFile method with force option set to true.

    Once the error comes, I cannot rename/delete/move the file in any of the PC through UNC or even in server it cannot be deleted. If I try to rename/delete the file or its parent folder, the system from where I try to delete/rename gets hang. Even if we reboot the client machine where the error was came for the operation, it does not solve the problem. Only the solution I found is to reboot my server. After rebooting the server, file can be renamed or deleted.

    Other methods I tried are as below.

    • Checked for file handle using process explorer in both client as well as server – No handles were found
    • Checked Open files in the Shared folders of the server. - No open file connection found for the file.
    • Tried rebooting the client machine – Not solved.
    • Tried to delete/Rename the file using command in server – Not possible.
    • Tried to delete/rename the file in server – No error and no message. Instead, server gets stuck.
    • Checked for disk problems using chkdisk in server. No problems reported.
    • Folder permission – The user ha full permission and there is no issue.
    • Tried running the same build process after reboot – Everything works fine. But, again repeats after some time/day.
    • Tried disconnecting the mapped drive at the time of error exists. But, still not able to rename.
    • No antivirus/Event viewer log in both client as well as server.

     

    Initially the error was coming in my windows XP PC. Now I upgraded to windows 7 (Fresh installation) and the error is still coming in new windows 7 machine.


    Update:

    I recently noticed that the same error also occurs when deleting the file msstdfmt.dll 

    Update 2:

    I also got error for the ms word file, error is same. In all the 3 cases i found that there is only a common thing that is all 3 files has read-only attribute.

    • Edited by IT researcher Friday, December 29, 2017 12:24 PM more findings
    • Moved by Hart Wang Tuesday, January 2, 2018 1:57 AM
    Friday, December 8, 2017 7:03 AM

All replies

  • Did you also try to rename the file with API function "MoveFileEx" ?  (With app using Admin rights)

    Did yo try MOVEFILE_DELAY_UNTIL_REBOOT ?


    Disclaimer: No Warranty. No legal advice. Use at your own risk.


    I did not use this method since the MDAC_TYP.exe is not under use. As i stated in the question i create one folder called Temp and then i just copy the files required for one of my application to this folder and create the setup.exe and then i just delete all the files in Temp folder (during which i get the error). Even if the MDAC_TYP.exe is under use it should have been able to delete after the reboot of the automation running system, but in my case i cannot delete even after the reboot. i think you got my point. Anyway thanks for the suggestion.
    Monday, December 11, 2017 5:20 AM
  • Hi,

    Thank you for posting here.

    I am not sure whether  the NSIS wrapper belongs to the third product.   i think that the product that belongs to third product. According to MSDN policy i will move the case to off-topic forum. 

    If you want to build a setup application, i suggest that you can use click once that is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction. Visual Studio provides full support for publishing and updating applications deployed with ClickOnce technology if you have developed your projects with Visual Basic and Visual C#.


    Best Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 12, 2017 8:02 AM
  • Yes NSIS is the third party but i am not facing the issue there. I just explained the scenario of what is happening. Actually the error comes when i delete certain exe that i mentioned, and this happens in my automation which is built in VB6 and the function where i get error is FileSystemObject.DeleteFile. After all these time i still not able to pin point the exact source of the error (since the error is not regular).
    Tuesday, December 12, 2017 10:32 AM
  • Hi,

    Thank you for your feedback.

    If the error occurs again, you can use windbg tool to get dump file, and parse the file. 

    According to MSDN policy the VB6 code has not been supported, i will move the case to off-topic forum. 

    You can post the issue on here.

    Best Regards,

    Hart

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 14, 2017 7:44 AM