"Replay item could not be found" problem

Oct 1, 2008 at 8:46 AM
First of all thanks for all the hard work on creating this.  I recently put this into my workgroup and the are reviewing it to see if will be usefull to our organisation. In the mean time i am trying to get myself familar with it.
Unfortunaly i hit a small problem. 

I first created a task and created a few code reviews. But whenever i open the replay window and select the task so that all the review items are shown i get the message "Replay item could not be found".  I
 can't figure out what is going on and was hoping someone could help me.

The project in question is positioned in the following structure:     [solution]\[solutionfolder]\[solutionfolder]\[project]
The project itself is stored in a different directory relative of the solution structure

Thanks in advance
Oct 2, 2008 at 7:20 PM
Edited Oct 2, 2008 at 7:43 PM
Hi - The "replay item could not be found" message indicates that TeamReview is unable to use the details of the Code Review Response to find the original code that was reviewed. (You probably new that)  TeamReview uses a Chain of Responsibility pattern to try and link-up the details to find the code, starting with the most precise (find the exact code in the exact original position) and ranging to less precise (find the class that the original code was in), with the last option being the "replay item could not be found" message.

If you get the message it could happen for a few reasons,
  • At the time of recording the code review responses the details weren't saved properly.
  • The code review responses that you are replaying are for a different Visual Studio solution than you have open. For example if I submit some code review responses about the MyApp solution, and then you try replaying them while you have the MyWebsite solution open TeamReview won't be able to find the original code in MyApp - because it's not open.
  • If enough code churn happens in-between the time of submitting the code review responses to the time they are replayed this message can pop-up. However TeamReview does it's best to avoid that issue.
So, to figure out what's going on look at the Code Details tab of one of the code review responses and see if you can manually "walk the tree" in your visual studio. For example if the code review response says MyApp solution make sure you have MyApp solution open. Then if the repsonse says the project name is "MyCoolProject" see if that project is part of the open VS solution in visual studio, etc.

If you find that "the tree" of code details in the Code Review Response is in-fact available then report back what you find and I'll file a bug and try to repro your issue to get it resolved.

Thanks for evaluating TeamReview,
Oct 2, 2008 at 7:57 PM
Hi - I was just thinking about this some more and looking at some of the code. I may know what the problem is, but will have to have it tested. If you look at this source part way down you the GetProject method - I think this method is failing to find your project because it's within a Solution Folder - a scenario that I haven't tested. If it turns out that this is in fact the problem it should be an easy thing to fix.

Oct 3, 2008 at 8:27 AM
Thank you for looking into this.  
I looked at your suggestion and i think you are right. 

The function 'getProject' assumes that the projects are directly under the solution tree item. 
It doesn't check the recursivly so it never finds the project in question.
To find this out i used a hit breakpoint that wrote down the project.Name everytime it was hit.

Every item below the top level item (in the solution tree) did not show up and was therefore not searched.
Mar 15, 2009 at 1:46 AM
http://support.microsoft.com/kb/555561 shows how to traverse the solution tree
Mar 15, 2009 at 6:38 PM
Edited Mar 15, 2009 at 6:39 PM
That's a good resource gigi24 - thanks! 

In release 1.0.8 I changed Code Review Item submission (CreateCodeSelection method) to use EnvDTE.Project.UniqueName instead of EnvDTE.Project.Name. Then during the Replay it finds the Project based on that unique name, like this..

//do it the quick way.. added after realizing there was a unique name      
try      {        
	string uniqueName = workItem.Fields[CONSTANTS.CODE_PROJECT_FIELD].Value.ToString();        
	EnvDTE.Project uniqueProject = DependencyLocater.Instance.VisualStudio.DTE.Solution.Item(uniqueName);
        if (uniqueProject != null)          
		return uniqueProject;      
}catch { }      

//do the slower old way... if unique names weren't used      
Projects projects = DependencyLocater.Instance.VisualStudio.DTE.Solution.Projects;

However, that change wouldn't handle any of the previously submitted items, so I think what you've linked too will help out in those instances. If anyone is finding other scenarios where review items cannot be found, please let me know.