2007-01-28 Marek Sieradzki <marek.sieradzki@gmail.com>
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / GroupingCollection.cs
index a1ce496532cab4b2863626996707c0ece326192d..96b86eaa47b0fc4256435053cd70f0994ebed3a2 100644 (file)
@@ -28,6 +28,7 @@
 
 #if NET_2_0
 
+using System;
 using System.Collections;
 using System.Collections.Generic;
 
@@ -144,6 +145,10 @@ namespace Microsoft.Build.BuildEngine {
 
                internal void Remove (BuildItemGroup big)
                {
+                       if (big.ParentProject != project)
+                               throw new InvalidOperationException (
+                                       "The \"BuildItemGroup\" object specified does not belong to the correct \"Project\" object.");
+
                        big.Detach ();
                        list.Remove (big);
                }