ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Software import fails due to character limit in name and/or directory path

book

Article ID: 173207

calendar_today

Updated On:

Products

Software Management Solution

Issue/Introduction

Problem #1: During Software import into software catalog, if file names or directory length exceeds 260 character limit, import will fail, due to Microsoft .NET limitation. Files will be skipped or error will be raised and import fail.

Problem #2: During Software delivery to endpoints, delivery doesn't complete due to 260 characters file name or directory length limit in Windows API. Files which exceed this limit will be skipped, or error will be raised.

During Software Import in Software Management:

An error has occurred that prevents the data displaying. Check server logs for details.

 

In Altiris log viewer:

Failed to get UNC tree.

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.
   [System.IO.PathTooLongException @ mscorlib]
   at System.IO.PathHelper.GetFullPathName()
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.FileInfo.Init(String fileName, Boolean checkHost)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.<>c.b__21_2(String o)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.d__1.MoveNext()
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String packageFolder, String path, PackageTreeNode parent, String& archivedInstallFile)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String path, AllowedPathTypes pathTypes, ImpersonationProfiles profile)

Exception logged from:
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.BuildTree(String, Altiris.SoftwareManagement.WebApi.Controllers.PackageController+AllowedPathTypes, Altiris.SoftwareManagement.WebApi.Controllers.PackageController+ImpersonationProfiles)
   at Altiris.SoftwareManagement.WebApi.Controllers.PackageController.GetPackageTreeFromSoftwareLibrary(System.Guid, Altiris.SoftwareManagement.WebApi.Models.Requests.SoftwareLibraryPackageTreeRequest)
   at .lambda_method(System.Runtime.CompilerServices.Closure, Object, Object[])
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor+ActionExecutor+<>c__DisplayClass10.b__9(Object, Object[])
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext, System.Collections.Generic.IDictionary, System.Threading.CancellationToken)
   at System.Web.Http.Controllers.ApiControllerActionInvoker+d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine&)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsyncCore(System.Web.Http.Controllers.HttpActionContext, System.Threading.CancellationToken)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsync(System.Web.Http.Controllers.HttpActionContext, System.Threading.CancellationToken)
   at System.Web.Http.Controllers.ActionFilterResult+d__2.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine&)
   at System.Web.Http.Controllers.ActionFilterResult.ExecuteAsync(System.Threading.CancellationToken)
   at System.Web.Http.Controllers.ExceptionFilterResult+d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine&)
   at System.Web.Http.Controllers.ExceptionFilterResult.ExecuteAsync(System.Threading.CancellationToken)
   at System.Web.Http.ApiController.ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext, System.Threading.CancellationToken)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher+d__1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine&)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at Altiris.SoftwareManagement.WebApi.ApiControllerAntiForgeryHandler.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Web.Http.HttpServer+d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine&)
   at System.Web.Http.HttpServer.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
   at System.Web.Http.WebHost.HttpControllerHandler+d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine&)
   at System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(System.Web.HttpContextBase)
   at System.Web.TaskAsyncHelper.BeginTask(System.Func, AsyncCallback, Object)
   at System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(System.Web.HttpApplication+IExecutionStep)
   at System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication+IExecutionStep, Boolean&)
   at System.Web.HttpApplication+PipelineStepManager.ResumeSteps(Exception)
   at System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, AsyncCallback)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus&)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus&)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)

Cause

1. Microsoft Windows API limitation - https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maxpath

2. Microsoft .NET Framework limitation - https://referencesource.microsoft.com/#mscorlib/system/io/pathinternal.cs,dc7ed89a40bfd4d9

Environment

Currently all of the Microsoft operating systems have this limitation, due to Windows API build structure (including .NET framework), however in Windows 10 version 1607 and newer, this limitation has been removed, but not to incur this limitation, need to opt-in by changing a registry key HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled or by enabling Group Policy - Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths

 

Currently affecting Microsoft Navision 2018

Resolution

Currently there is no solution to this problem. There is only a workaround:

1. Use "Alternate Location" to save your files in different path than SMA cache

2. If above doesn't work, deliver software to custom location as a zip file with a batch script which would unzip it at the final destination.

Windows 10 version 1607 and newer, this limitation has been removed, but not to incur this limitation, need to opt-in by changing a registry key HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled or by enabling Group Policy - Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths

Currently there is no information in regards to removal of this limitation from Microsoft .NET Framework

Attachments