NullReferenceException when using API to Get file

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
Amol

NullReferenceException when using API to Get file

Post by Amol » Thu Nov 11, 2004 3:28 pm

Hi,

I'm running CruiseControl for my builds, and as part of that I am using NAnt tasks for Vault to checkout, get, checkin files.

Everything works fine when I set the CruiseControl service to login as myself. However, when I set the service to run as a local admin account, I get a NullReferenceException when trying to get a file. The stack trace is as follows:

at VaultClientOperationsLib.WorkingFolder.GetHashedPathName(String path)
at VaultClientOperationsLib.WorkingFolder.HasWorkingFolderData(String diskFolderPath, Boolean lookInWorkingFolder, TreeCache treeCache)
at VaultClientOperationsLib.ClientInstance.CreateGetFileRequests(VaultClientFile[] files, Boolean forceLatest, Boolean forceDisplayVersion, Boolean dontCheckWorkingFolders, MakeWritableType makeWritable, Boolean isLabelGet, String labelSubItemPath, Boolean isLabelGetForSingleFile)
at VaultClientOperationsLib.ClientInstance.Get(VaultClientFile[] files, Boolean forceLatest, MakeWritableType makeWritable, SetFileTimeType setFileTime, MergeType merge, OverwritePrompt PromptData)
at VaultClientOperationsLib.ClientInstance.Get(VaultClientFile file, Boolean forceLatest, MakeWritableType makeWritable, SetFileTimeType setFileTime, MergeType merge, OverwritePrompt PromptData)
at NAnt.Contrib.Tasks.SourceGearVault.VaultCheckOut.CheckOut(String fileName)


Here is the code being run:

VaultClientFile vaultClientFile = ClientInstance.TreeCache.Repository.Root.FindFileRecursive( normalizedPath );
ClientInstance.CheckOut( vaultClientFile, VaultCheckOutType.CheckOut, Comment );
ClientInstance.Get( vaultClientFile, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null );

The ClientInstance.CheckOut works (I see the file checked out in Vault), and the NullReference mentioned above is while running ClientInstance.Get. I'm not sure what is occuring in VaultClientOperationsLib.WorkingFolder.GetHashedPathName that depends on who the CruiseControl.NET service is running as. Any ideas on what the problem might be (or what the method is trying to do to point me in the right direction)?


Any help is appreciated.

Thanks,
Amol

Amol

Post by Amol » Thu Nov 11, 2004 4:25 pm

Actually, it isn't failing on the ClientInstance.Get like I mentioned above - it is on the ClientInstance.CheckOut...

Thanks,
Amol

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Thu Nov 11, 2004 4:50 pm

Most likely, the problem is one of two things.

1. No working folder has been set for the user that the build is logging in as.

2. The get was specified with a destpath, which does not save working folder state information.

Amol

Post by Amol » Thu Nov 11, 2004 5:12 pm

Thanks... I had set the working folder for the vault user but with myself logged on to windows. When I logged on as the build user and went into vault and set the working folder, it started working fine.

Thanks,
Amol

Post Reply