Bug 25581 - xbuild crashes due to NullReferenceException when removing items from ItemGroup (bugjar included)
Summary: xbuild crashes due to NullReferenceException when removing items from ItemGro...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-22 16:54 UTC by Roger Twede
Modified: 2015-01-05 15:12 UTC (History)
2 users (show)

Tags: xbuild crash
Is this bug a regression?: ---
Last known good build:


Attachments
Project file that when built demonstrates the xbuild crash (999 bytes, application/octet-stream)
2014-12-22 16:54 UTC, Roger Twede
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 25581 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Roger Twede 2014-12-22 16:54:20 UTC
Created attachment 9170 [details]
Project file that when built demonstrates the xbuild crash

XBuild/Mono Release Version 3.10.0  (among others)

A project file bugjar.proj is attached.  Building the project file will cause the crash.


When Items are removed from an ItemGroup and then re-added, it is no longer possible to remove them without crashing xbuild.  The collection maintenance appears to have a defect that doesn't maintain the group's clean/good state after the initial remove since re-adding items will result in a different state than the initial adding of the items.

Stack back-trace:

Error building target Setup: System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.Build.BuildEngine.BuildItem.InsertElementAfter (Microsoft.Build.BuildEngine.BuildItem parent, Microsoft.Build.BuildEngine.BuildItem child, System.Xml.XmlElement insertAfter) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.BuildItem.SplitParentItem () [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.BuildItem.Detach () [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.BuildItemGroup.RemoveItem (ITaskItem itemToRemove) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.BuildItem.RemoveItems (Microsoft.Build.BuildEngine.Project project) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.BuildItem.Evaluate (Microsoft.Build.BuildEngine.Project project, Boolean evaluatedTo) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.BuildTaskItem.Execute () [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.TaskBatchingImpl.Execute (IBuildTask buildTask, TaskExecutionMode taskExecutionMode) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.TaskBatchingImpl.Build (IBuildTask buildTask, TaskExecutionMode taskExecutionMode, System.Boolean& executeOnErrors) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.TargetBatchingImpl.RunTargetWithBucket (System.Collections.Generic.Dictionary`2 bucket, Microsoft.Build.BuildEngine.Target target, System.Boolean& executeOnErrors) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.TargetBatchingImpl.Run (Microsoft.Build.BuildEngine.Target target, System.Boolean& executeOnErrors) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.TargetBatchingImpl.Build (Microsoft.Build.BuildEngine.Target target, System.Boolean& executeOnErrors) [0x00000] in <filename unknown>:0
  at Microsoft.Build.BuildEngine.Target.DoBuild (System.Boolean& executeOnErrors) [0x00000] in <filename unknown>:0