App-V Error 4615186-1F701639-0000010B Directory Name is Invalid Print E-mail
Under the Microscope
Written by Darwin Sanoy   
Monday, June 11, 2012 11:54am

"App-V Directory Name is Invalid" is fairly simple to fix, but why does it come up specifically on software that seems like it should be super simple to sequence?  And how do we prevent it in future packges?  Let's dive in and put it under the microscope.

Evidence of The Error

First let's discuss what you'll see on the screen and in your logs verify that this is the problem you might be having.  We are going to use the example of the freeware version of Tree DB Notes.  It is designed to be installed in a "Portable" mode - which allows it to run out of a folder with no registry entries or other Windows integration requirements - so you'd think it would sequence like a dream! Welcome to the real world.

The error that presents on the screen is:

image

The Application Virtualization Client could not launch TreeDBNotes 4 4.2.5.2
The directory name is invalid.
Error code: 4615186-1F701639-0000010B

In sftlog.txt ("Information" logging level) you'll find something similar to:

[06/11/2012 16:05:13:521 SWAP ERR] {hap=1B:app=TreeDBNotes 4 4.2.5.2:tid=2F5C:usr=sanoyd}
The client could not launch Q:\TREEDBNT.001\TreeDBNotes.exe (rc 1F701639-0000010B, last error 0).


[06/11/2012 16:05:13:525 TRAY ERR] {tid=1864:usr=userid}
The Application Virtualization Client could not launch TreeDBNotes 4 4.2.5.2.
The directory name is invalid.
Error code: 4615186-1F701639-0000010B 

Eventlog messages:

image

Application Virtualization Client 3001

The Application Virtualization Client could not launch TreeDBNotes 4 4.2.5.2.
The directory name is invalid.
Error code: 4615186-1F701639-0000010B

Application Virtualization Client 3079

The client could not launch Q:\TREEDBNT.001\TreeDBNotes.exe (rc 1F701639-0000010B, last error 0).

If you've been working with App-V for a while your first hunch may be to use "sfttray.exe /launch" to start a cmd.exe prompt and look to see if the EXE is available at the path location you sequenced it to ("Q:\APPFOLDER.001\AppName.exe" in our sample error).  Unfortunately attempting to launch with an alternate EXE results in the same error message!  The error prevents any EXE from starting in the bubble.

Using the sequencer to open the package reveals that the EXE is right there where you expect it to be and that it is properly referenced by the OSD.

My next step was to enable Verbose logging for the App-V Client. 

This is done by starting the client and right clicking on Application Virtualization (local) and selecting Properties:

image

On the General tab, for Log Level, select Verbose:

image

This time an attempted run shows many more messages in sftlog.txt (including a repetition of the previous ones noted). 

Among the new messages will be something similar to the following:

[06/11/2012 16:38:28:024 SWAP VRB] {hap=1D:app=TreeDBNotes 4 4.2.5.2:tid=2234:usr=sanoyd}
Will create process with...
Command: '"C:\Program Files (x86)\Microsoft Application Virtualization Client\sftlp.exe"'
Params: '/WaitForGUI:600000 /WorkingDir:"C:\Users\userid\Documents\TreeDBNotes 4" "Q:\TREEDBNT.001\TreeDBNotes.exe"'
Working Dir: ''

This message gives more details about the attempt to create the application process within the App-V client. 

Notice that we have another directory in the mix, namely “C:\users\userid\Documents\TreeDBNotes 4”

A quick check of my configuration confirmed that this folder did not exist.  Creating the folder immediately fixed the problem.

Why Does It Happen?

Let’s take a look at what creates this type of error.  Many bits of productivity software can be installed in a “Portable” mode.  This mode allows the software to be completely installed to a folder – sometimes a folder on a flash drive.  Since the data folder for the application might be on a portable location and the data folder can’t be stored in the registry – some developers use the app’s “working folder” as it’s data folder.  The data folder can then be configured by simply changing it in the shortcut of the application.

Applications that use this approach do not require the folder to exist on startup because they will usually create the folder on startup or default to another folder.  The App-V client, however, does care whether the folder in it's WORKINGDIR exists upon process startup and throws the error.  By default the sequencer uses the working directory of one of the application shortcuts as the OSD WORKINGDIR for the shortcuts created by the App-V client.

The shortcut properties of the shortcut on the sequencer show that the working folder of the shortcut is the same subfolder indicated in the verbose log file (there are benefits to not resetting your sequencer machine before testing the package):

image

This could be an empty folder created by the installer or it may contain sample data or templates (which it does for this application).

By default the App-V Sequencer excludes “Documents” (CSIDL_PERSONAL) and any subfolders to avoid virtualizing user data documents when they use the software.

This can be seen in the standard exclusions in the sequencer under Tools > Options > Exclusion Items:

image

Ways To Fix The Package

One solution is to use an .OSD script to create the folder if it does not exist.

This simple one line script would work (works on Windows 7 as well due to compatibility reparse points):

if not exist "%userprofile%\My Documents\TreeDBNotes 4" mkdir "%USERPROFILE%\My Documents\TreeDBNotes 4"

This approach is required if you absolutely MUST have the my documents subfolder.

Another approach is to eliminate the application’s Documents subfolder and reconfigure the application during sequencing to point to the Documents folder.  In this case we would reconfigure the application shortcut during sequencing to point to Documents.  In some cases you may need to find the Documents setting in an INI file or the registry.

If, however, it is undesirable to sequence the application again, we can just find the configuration item containing the folder and change the reference to “Documents”.

In this case that is the working folder of the shortcut which is stored in the OSD file.

To do this, edit the sequence and click OSD (tab), then expand IMPLEMENTATION and click WORKINGDIR:

image

Remove everything except %CSIDL_PERSONAL%

This could also be done directly to the .OSD with a text editor – however, if you use the .MSI to deploy - make sure to use the sequencer to regenerate the .MSI so an updated copy of the .OSD makes it into the .MSI.

Ways To Fix The Packaging Process

We want to make sure that you not only fix the specific package that brought you to this page, but that you can eliminate having the problem in the future!

First, keep in mind that this specific launch error will only occur when App-V has a non-existent directory indicated as the “WORKINGDIR” of the App-V shortcuts.  If a non-existent folder is specified as the application data folder in the registry or an INI file, you won’t experience this specific launch error.

Improve Your Game Item 1: Validate OSD WORKINGDIR

Add to your sequencing process list “Validate that OSD WORKINGDIR makes sense and will exist at application launch.”  This is more effective than trying to audit the shortcuts during the snapshot process since that would increase the potential noise in the package.

Improve Your Game Item 2: Use Verbose Logging on App-V Client

During problem diagnosis the simple step of turning on verbose logging for the App-V client can give some critical clues.  (Don't forget to turn it back off if it is a production machine).

Improve Your Game Item 3: Keep Sequencer Session Until Done Testing

If possible, test the package before you trash the sequencer session that built the package.  The simple way is to keep the sequencer VM running until you’ve done a satisfactory test.  If your testing process does not lend itself to this or if you want to be able to look at the sequencing session after User Acceptance Testing – then save a snapshot of each sequencer session and setup a procedure for cleaning them up after they are no longer needed.

I hope this article has helped you solve your immediate problem as well as prepared you to build better packages in the future!