Page 1 of 1

System.IO.PathTooLongException: The specified path, file name, or both are too long.

Posted: Mon Jul 15, 2019 7:04 am
by bhavani
Hi,

I tried executing the exe file through ranorex agent from Powershell. In Ranorex Agent logs there is an exception which states that file name too long.
Error: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)
at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)
at Ranorex.Dex.Common.Util.ArchiveIO.ExtractAll(AbsoluteFilePath zipFile, AbsoluteDirPath destinationDir)
at Ranorex.Dex.Components.TestExecution.Steps.FetchTestSuiteStep.ExecuteStep(StepExecutionInformation config, ProgressLogger progress)
at Ranorex.Dex.Components.TestExecution.Steps.ExecutionStep.Execute(StepExecutionInformation config, ITaskProgress`1 p).

PFA logfile.
These temp paths are nowhere provided in the ranorex solution. What needs to be changed. Any suggestions on this would be really helpful

Regards,
Bhavani V

Re: System.IO.PathTooLongException: The specified path, file name, or both are too long.

Posted: Wed Jul 17, 2019 2:23 pm
by Support Team
Hello bhavani,

Unfortunately, windows enforces a character limit on file names and directories. If you are using server 2016 or windows 10 you can enable long paths by following the respective guides below:

Server 2016 - https://eocloud.cloudferro.com/knowledg ... cle&id=135
Windows 10 - https://betanews.com/2016/05/29/long-paths-windows-10/

Alternatively, you can edit the registry and make the %localAppData% folder name more shallow, this is the local execution directory when using Agent. It is highly recommended this be changed back as it may affect other application that utilizes the directory.

Registry Key - Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Guide - https://www.windows-commandline.com/cha ... -location/

Regards,
Sean