2
Vote

Checking-in a file that doesn't exist yet in a folder that do exist

description

Error saying that there is no pending changes.
 
This is due to the fact that when the method Workspace.GetPendingChanges() is called, nothing is returned. The program doesn't verify the existance of a file in TFS prior to making an "Edit" on the file. When requesting pending changes, it returns an empty array. The Check-in method can't have an empty array of PendingChange
 
Event Type: Error
Event Source: DependencyReplicator
Event Category: None
Event ID: 0
Date: 10/15/2008
Time: 8:35:44 AM
User: N/A
Computer: MONTRECSSTB01
Description:
An error occured processing the dependency '$/OurProject/Main/Project.dll' from build 'OurProjectCI_20081015.5' in project 'OurProject'. Processing subsequent rules will continue:
System.ArgumentException: The array must contain at least one element.
Parameter name: changes
at Microsoft.TeamFoundation.Common.TFCommonUtil.CheckArrayForNullOrEmpty(Object[] array, String arrayName)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.UploadChanges(PendingChange[] changes, OnProcessingChangeDelegate onPendingMethod)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.CheckInInternal(String author, PendingChange[] changes, String comment, CheckinNote checkinNote, WorkItemCheckinInfo[] workItemChanges, PolicyOverrideInfo policyOverride, CheckinOptions checkinOptions)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.CheckIn(PendingChange[] changes, String author, String comment, CheckinNote checkinNote, WorkItemCheckinInfo[] workItemChanges, PolicyOverrideInfo policyOverride, CheckinOptions checkinOptions)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.CheckIn(PendingChange[] changes, String comment)
at DependencyReplicator.BuildStoreWatcher.ExecuteDependencyReplicationRule(Rule rule, Workspace workspace)
 
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

file attachments

comments

donnfelker wrote Oct 23, 2008 at 4:46 PM

I also encountered an issue that resembles this exact scenario as described by the Title.

Error in Event Viewer:

Dependency Repliccator error:
Event Type: Error
Event Source: DependencyReplicator
Event Category: None
Event ID: 0
Date: 10/23/2008
Time: 11:24:30 AM
User: N/A
Computer: TFSSERVER
Description:
An error occured processing the dependency '$/TeamProject/Path/To/Dependency/dependency.dll' from build 'TeamProject_CI_20081023.5' in project 'TeamProject'. Processing subsequent rules will continue:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\DependencyReplicator\TeamProject\Path\To\Dependency\Dependency.dll'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at DependencyReplicator.BuildStoreWatcher.ExecuteDependencyReplicationRule(Rule rule, Workspace workspace)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Background:

The file that is the "dependency" does not exist in the destination yet. Therefore the replicator fails. If it does not find the destination file in the dependent project location it will fail.

Steps to recreate:
  1. Create two team projects
    • One being the one which will propogate the dependency (ex: shared utility dll or something). This would output a file called "utility.dll" which would then
      be propogated to other locations.
    • Other being the project which utilizes the dependency "MytestProject". DO NOT put the dependency (utility.dll) in this team project anywhere.
  2. Set Depdenency Replicator xml to have the utility.dll file placed somewhere in "MyTestProject".
  3. Kick off a build for the utililty project. This should kick off the dependency repliccator.
  4. Error (above) occurs.
Possible Solution: If the file is not found in the destination location, place it there anyway.

wrote Oct 23, 2008 at 4:46 PM

donnfelker wrote Oct 23, 2008 at 5:09 PM

I think I found the source of the error.

On BuildStoreWatcher.cs, on line 317, the workspace.Get(...) call returns 0 records. This is becacuse there IS NO FILE to get, since it does not exist. After this, it fails since the next command is the get.PendEdit(...). We cannot edit a file that does not exist.

Possilbe fix:


string fullyQualifiedSource = Path.Combine(rule.Event.Data.DropLocation, rule.Source);
string fullyQualifiedDestination = workspace.GetLocalItemForServerItem(rule.Destination);

if(status.NumOperations != 0)
{
workspace.PendEdit(rule.Destination);   
File.Copy(fullyQualifiedSource, fullyQualifiedDestination, true);
}
else
{
File.Copy(fullyQualifiedSource, fullyQualifiedDestination, true);
workspace.PendAdd(rule.Destination); 
}

wrote Oct 23, 2008 at 5:09 PM

wrote Feb 13, 2013 at 9:25 PM