Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > A Bug in DteHelper?
 

A Bug in DteHelper?


I found a method in DteHelper Class as following:

private static Project FindProjectInternal(ProjectItems items, Predicate<Project> match)
{
    foreach (ProjectItem item in items)
    {
        Project project = item.Object as Project;
        if ((project != null) && match(project))
        {
            return project;
        }
        if (item.ProjectItems != null)
        {
            Project project2 = FindProjectInternal(item.ProjectItems, match);
            if (project2 == null)
            {
                continue;
            }
            return project2;
        }
    }
    return null;
}

I think there maybe something wrong with this line:
if (item.ProjectItems != null)

I think it should be changed to

if (project!=null&project.ProjectItems != null)


Any suggestions?
xu ning  Monday, December 10, 2007 6:47 AM
Hi Idior,

I've passed this onto the GAX dev team. I'll let you know here when I get a reply.

thanks,
-V.
vga  Monday, December 10, 2007 11:28 AM
Hi Idior,

I've passed this onto the GAX dev team. I'll let you know here when I get a reply.

thanks,
-V.
vga  Monday, December 10, 2007 11:28 AM
Hi Idior,

The above code is correct, note that one is "item" and the other is "project", so the project could be null in the first evaluation due to that item could be a SolutionFolder instead a project. Anyway tell me if you're getting any particular issue/exception with that helper method.

hth
jose.


Jose Escrich  Monday, December 10, 2007 4:16 PM
[Service]
|
|----[Contract]
|
|-----(Pam.DataService.Contract)

Take above as an example
[...] stands for a folder
(...) stands for a project

thus, we can't get the Pam.DataService.Contract through this helper method,and thus GetProject action.
xu ning  Tuesday, December 11, 2007 7:06 AM

yes, I agree with Idior. The old searching can miss some project items.

kobe082005  Tuesday, December 11, 2007 8:13 AM

You can use google to search for other answers

Custom Search

More Threads

• Cannot create WizardPage , Constructor on type ... not found
• Target solution assemblies get loaded on the guidance package on runtime
• Business module creation problem
• Error creating ServiceContract, also not displaying my current project's DataContracts / FaultContracts???
• Adding a solution to source control during CreateSolution Recipe
• UnfoldTemplateAction - with template parameter
• Application Block Software Factory Templates
• Blog post
• Error Installing to RTM Version of VS2005
• Create Virtual Directory from a Guidance Package.