Search

NullReferenceException when add an ItemGroup to Another by baccali

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 775889
Opened: 1/5/2013 5:00:18 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
When adding an ItemGroup to Another, the load of the Project fail with an MBox saying that an 'Object reference not set to an instance of an object'.

The Project is a Cpp UnitTest project and builds just fine in msbuild. Am I doing something wrong?

Thanks.

Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

Unload the Cpp Project.
Edit the vcxproj and add and itemGroup.
add the ItemGroup to the ClCompile Group. (As shown below)
Restart VS 2012.
Feel the pain!

=====================================

<ItemGroup>
    <Foo Include="foo.cpp" >
...
    </Foo>
</ItemGroup>

<ItemGroup>
    <ClCompile Include="@(Foo)">
     <PrecompiledHeader>NotUsing</PrecompiledHeader>
    </ClCompile>
     ...
</ItemGroup>

Product Language

English

Operating System

Windows 7 SP1

Operating System Language

English

Actual results

error : Object reference not set to an instance of an object.

Expected results

load succeeded.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/11/2013 at 1:41 PM
Hello Baccali, Thank you for openning a connect report with us. We have identified the issue and are looking for a solution. We will fix the project loading in a future release. Despite the exception, this is not a support scenerio.
The reason is that itemgroups can have multiple files. For ClCompile to import @(Foo), ClCompile will see @(Foo) as a list of files (a.cpp;b.cpp;c.cpp). This is fine for just building. The issue arrise when the IDE tries to modify the item. Suppose you try to modify a.cpp to have a different Predefinition. The system can't break up @(Foo) into smaller pieces. Further more @(Foo) may not even been set in the project file (imported from another file). Due to this complexity, it is not support at this time.
Thanks
Felix Huang
Posted by Microsoft on 1/6/2013 at 9:44 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/5/2013 at 5:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.