@joebigelow / wix-1 / commits / 3a2c3c79

Fix Feature parent

Rob Mensching committed Oct 7, 2019 at 14:20 UTC 3a2c3c799eead15c26f5d65d16e6e01b4a0e8c64
4 files changed +206 -244
src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs
+1
@@ -185,6 +185,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
185 case TupleDefinitionType.WixFile:
186 case TupleDefinitionType.WixComponentGroup:
187 case TupleDefinitionType.WixDeltaPatchFile:
188 + case TupleDefinitionType.WixFeatureGroup:
189 break;
190
191 default:
src/WixToolset.Core/Compiler.cs
+2 -41
@@ -4855,6 +4855,7 @@ namespace WixToolset.Core
4855 {
4856 var tuple = new FeatureTuple(sourceLineNumbers, id)
4857 {
4858 + ParentFeatureRef = null, // this field is set in the linker
4859 Title = title,
4860 Description = description,
4861 Display = display,
@@ -4867,46 +4868,6 @@ namespace WixToolset.Core
4868 };
4869
4870 this.Core.AddTuple(tuple);
4870 - //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Feature, id);
4871 - //// row.Set(1, null); - this column is set in the linker
4872 - //row.Set(2, title);
4873 - //row.Set(3, description);
4874 - //if (0 < display.Length)
4875 - //{
4876 - // switch (display)
4877 - // {
4878 - // case "collapse":
4879 - // lastDisplay = (lastDisplay | 1) + 1;
4880 - // row.Set(4, lastDisplay);
4881 - // break;
4882 - // case "expand":
4883 - // lastDisplay = (lastDisplay + 1) | 1;
4884 - // row.Set(4, lastDisplay);
4885 - // break;
4886 - // case "hidden":
4887 - // row.Set(4, 0);
4888 - // break;
4889 - // default:
4890 - // int value;
4891 - // if (!Int32.TryParse(display, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
4892 - // {
4893 - // this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Display", display, "collapse", "expand", "hidden"));
4894 - // }
4895 - // else
4896 - // {
4897 - // row.Set(4, value);
4898 - // // save the display value of this row (if its not hidden) for subsequent rows
4899 - // if (0 != (int)row[4])
4900 - // {
4901 - // lastDisplay = (int)row[4];
4902 - // }
4903 - // }
4904 - // break;
4905 - // }
4906 - //}
4907 - //row.Set(5, level);
4908 - //row.Set(6, configurableDirectory);
4909 - //row.Set(7, bits);
4871
4872 if (ComplexReferenceParentType.Unknown != parentType)
4873 {
@@ -6228,7 +6189,7 @@ namespace WixToolset.Core
6189 this.ParseFeatureElement(child, ComplexReferenceParentType.Unknown, null, ref featureDisplay);
6190 break;
6191 case "FeatureGroup":
6231 - this.ParseFeatureGroupElement(child, ComplexReferenceParentType.Unknown, id.Id);
6192 + this.ParseFeatureGroupElement(child, ComplexReferenceParentType.Unknown, id?.Id);
6193 break;
6194 case "FeatureRef":
6195 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Unknown, null);
src/WixToolset.Core/Linker.cs
+201 -201
@@ -244,12 +244,12 @@ namespace WixToolset.Core
244 break;
245 #endif
246
247 - case TupleDefinitionType.Class:
248 - if (SectionType.Product == resolvedSection.Type)
249 - {
250 - this.ResolveFeatures(tuple, 2, 11, componentsToFeatures, multipleFeatureComponents);
251 - }
252 - break;
247 + case TupleDefinitionType.Class:
248 + if (SectionType.Product == resolvedSection.Type)
249 + {
250 + this.ResolveFeatures(tuple, 2, 11, componentsToFeatures, multipleFeatureComponents);
251 + }
252 + break;
253
254 #if MOVE_TO_BACKEND
255 case "CustomAction":
@@ -303,12 +303,12 @@ namespace WixToolset.Core
303 }
304 break;
305 #endif
306 - case TupleDefinitionType.Extension:
307 - if (SectionType.Product == resolvedSection.Type)
308 - {
309 - this.ResolveFeatures(tuple, 1, 4, componentsToFeatures, multipleFeatureComponents);
310 - }
311 - break;
306 + case TupleDefinitionType.Extension:
307 + if (SectionType.Product == resolvedSection.Type)
308 + {
309 + this.ResolveFeatures(tuple, 1, 4, componentsToFeatures, multipleFeatureComponents);
310 + }
311 + break;
312
313 #if MOVE_TO_BACKEND
314 case TupleDefinitionType.ModuleSubstitution:
@@ -320,12 +320,12 @@ namespace WixToolset.Core
320 break;
321 #endif
322
323 - case TupleDefinitionType.Assembly:
324 - if (SectionType.Product == resolvedSection.Type)
325 - {
326 - this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents);
327 - }
328 - break;
323 + case TupleDefinitionType.Assembly:
324 + if (SectionType.Product == resolvedSection.Type)
325 + {
326 + this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents);
327 + }
328 + break;
329
330 #if MOVE_TO_BACKEND
331 case "ProgId":
@@ -347,26 +347,26 @@ namespace WixToolset.Core
347 break;
348 #endif
349
350 - case TupleDefinitionType.PublishComponent:
351 - if (SectionType.Product == resolvedSection.Type)
352 - {
353 - this.ResolveFeatures(tuple, 2, 4, componentsToFeatures, multipleFeatureComponents);
354 - }
355 - break;
350 + case TupleDefinitionType.PublishComponent:
351 + if (SectionType.Product == resolvedSection.Type)
352 + {
353 + this.ResolveFeatures(tuple, 2, 4, componentsToFeatures, multipleFeatureComponents);
354 + }
355 + break;
356
357 - case TupleDefinitionType.Shortcut:
358 - if (SectionType.Product == resolvedSection.Type)
359 - {
360 - this.ResolveFeatures(tuple, 3, 4, componentsToFeatures, multipleFeatureComponents);
361 - }
362 - break;
357 + case TupleDefinitionType.Shortcut:
358 + if (SectionType.Product == resolvedSection.Type)
359 + {
360 + this.ResolveFeatures(tuple, 3, 4, componentsToFeatures, multipleFeatureComponents);
361 + }
362 + break;
363
364 - case TupleDefinitionType.TypeLib:
365 - if (SectionType.Product == resolvedSection.Type)
366 - {
367 - this.ResolveFeatures(tuple, 2, 6, componentsToFeatures, multipleFeatureComponents);
368 - }
369 - break;
364 + case TupleDefinitionType.TypeLib:
365 + if (SectionType.Product == resolvedSection.Type)
366 + {
367 + this.ResolveFeatures(tuple, 2, 6, componentsToFeatures, multipleFeatureComponents);
368 + }
369 + break;
370
371 #if SOLVE_CUSTOM_TABLE
372 case "WixCustomTable":
@@ -384,9 +384,9 @@ namespace WixToolset.Core
384 break;
385 #endif
386
387 - case TupleDefinitionType.WixEnsureTable:
388 - ensureTableRows.Add(tuple);
389 - break;
387 + case TupleDefinitionType.WixEnsureTable:
388 + ensureTableRows.Add(tuple);
389 + break;
390
391
392 #if MOVE_TO_BACKEND
@@ -409,46 +409,46 @@ namespace WixToolset.Core
409 break;
410 #endif
411
412 - case TupleDefinitionType.WixMerge:
413 - if (SectionType.Product == resolvedSection.Type)
414 - {
415 - this.ResolveFeatures(tuple, 0, 7, modulesToFeatures, null);
416 - }
417 - break;
418 -
419 - case TupleDefinitionType.WixComplexReference:
420 - copyTuple = false;
421 - break;
412 + case TupleDefinitionType.WixMerge:
413 + if (SectionType.Product == resolvedSection.Type)
414 + {
415 + this.ResolveFeatures(tuple, 0, 7, modulesToFeatures, null);
416 + }
417 + break;
418
423 - case TupleDefinitionType.WixSimpleReference:
424 - copyTuple = false;
425 - break;
419 + case TupleDefinitionType.WixComplexReference:
420 + copyTuple = false;
421 + break;
422
427 - case TupleDefinitionType.WixVariable:
428 - // check for colliding values and collect the wix variable rows
429 - {
430 - var row = (WixVariableTuple)tuple;
431 - var id = row.Id.Id;
423 + case TupleDefinitionType.WixSimpleReference:
424 + copyTuple = false;
425 + break;
426
433 - if (wixVariables.TryGetValue(id, out var collidingRow))
427 + case TupleDefinitionType.WixVariable:
428 + // check for colliding values and collect the wix variable rows
429 {
435 - if (collidingRow.Overridable && !row.Overridable)
430 + var row = (WixVariableTuple)tuple;
431 + var id = row.Id.Id;
432 +
433 + if (wixVariables.TryGetValue(id, out var collidingRow))
434 {
437 - wixVariables[id] = row;
435 + if (collidingRow.Overridable && !row.Overridable)
436 + {
437 + wixVariables[id] = row;
438 + }
439 + else if (!row.Overridable || (collidingRow.Overridable && row.Overridable))
440 + {
441 + this.OnMessage(ErrorMessages.WixVariableCollision(row.SourceLineNumbers, id));
442 + }
443 }
439 - else if (!row.Overridable || (collidingRow.Overridable && row.Overridable))
444 + else
445 {
441 - this.OnMessage(ErrorMessages.WixVariableCollision(row.SourceLineNumbers, id));
446 + wixVariables.Add(id, row);
447 }
448 }
444 - else
445 - {
446 - wixVariables.Add(id, row);
447 - }
448 - }
449
450 - copyTuple = false;
451 - break;
450 + copyTuple = false;
451 + break;
452 }
453
454 if (copyTuple)
@@ -1152,154 +1152,154 @@ namespace WixToolset.Core
1152 ConnectToFeature connection;
1153 switch (wixComplexReferenceRow.ParentType)
1154 {
1155 - case ComplexReferenceParentType.Feature:
1156 - switch (wixComplexReferenceRow.ChildType)
1157 - {
1158 - case ComplexReferenceChildType.Component:
1159 - connection = componentsToFeatures[wixComplexReferenceRow.Child];
1160 - if (null == connection)
1161 - {
1162 - componentsToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary));
1163 - }
1164 - else if (wixComplexReferenceRow.IsPrimary)
1155 + case ComplexReferenceParentType.Feature:
1156 + switch (wixComplexReferenceRow.ChildType)
1157 {
1166 - if (connection.IsExplicitPrimaryFeature)
1167 - {
1168 - this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), connection.PrimaryFeature ?? resolvedSection.Id));
1169 - continue;
1170 - }
1171 - else
1172 - {
1173 - connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects
1174 - connection.PrimaryFeature = wixComplexReferenceRow.Parent; // set the new primary feature
1175 - connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again
1176 - }
1177 - }
1178 - else
1179 - {
1180 - connection.ConnectFeatures.Add(wixComplexReferenceRow.Parent);
1181 - }
1158 + case ComplexReferenceChildType.Component:
1159 + connection = componentsToFeatures[wixComplexReferenceRow.Child];
1160 + if (null == connection)
1161 + {
1162 + componentsToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary));
1163 + }
1164 + else if (wixComplexReferenceRow.IsPrimary)
1165 + {
1166 + if (connection.IsExplicitPrimaryFeature)
1167 + {
1168 + this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), connection.PrimaryFeature ?? resolvedSection.Id));
1169 + continue;
1170 + }
1171 + else
1172 + {
1173 + connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects
1174 + connection.PrimaryFeature = wixComplexReferenceRow.Parent; // set the new primary feature
1175 + connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again
1176 + }
1177 + }
1178 + else
1179 + {
1180 + connection.ConnectFeatures.Add(wixComplexReferenceRow.Parent);
1181 + }
1182
1183 - // add a row to the FeatureComponents table
1184 - var featureComponent = new FeatureComponentsTuple();
1185 - featureComponent.FeatureRef = wixComplexReferenceRow.Parent;
1186 - featureComponent.ComponentRef = wixComplexReferenceRow.Child;
1183 + // add a row to the FeatureComponents table
1184 + var featureComponent = new FeatureComponentsTuple();
1185 + featureComponent.FeatureRef = wixComplexReferenceRow.Parent;
1186 + featureComponent.ComponentRef = wixComplexReferenceRow.Child;
1187
1188 - featureComponents.Add(featureComponent);
1188 + featureComponents.Add(featureComponent);
1189
1190 - // index the component for finding orphaned records
1191 - var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child);
1192 - referencedComponents.Add(symbolName);
1190 + // index the component for finding orphaned records
1191 + var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child);
1192 + referencedComponents.Add(symbolName);
1193
1194 - break;
1194 + break;
1195
1196 - case ComplexReferenceChildType.Feature:
1197 - connection = featuresToFeatures[wixComplexReferenceRow.Child];
1198 - if (null != connection)
1199 - {
1200 - this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1201 - continue;
1202 - }
1196 + case ComplexReferenceChildType.Feature:
1197 + connection = featuresToFeatures[wixComplexReferenceRow.Child];
1198 + if (null != connection)
1199 + {
1200 + this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1201 + continue;
1202 + }
1203
1204 - featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary));
1205 - break;
1204 + featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary));
1205 + break;
1206
1207 - case ComplexReferenceChildType.Module:
1208 - connection = modulesToFeatures[wixComplexReferenceRow.Child];
1209 - if (null == connection)
1210 - {
1211 - modulesToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary));
1212 - }
1213 - else if (wixComplexReferenceRow.IsPrimary)
1214 - {
1215 - if (connection.IsExplicitPrimaryFeature)
1216 - {
1217 - this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1218 - continue;
1219 - }
1220 - else
1221 - {
1222 - connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects
1223 - connection.PrimaryFeature = wixComplexReferenceRow.Parent; // set the new primary feature
1224 - connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again
1225 - }
1226 - }
1227 - else
1228 - {
1229 - connection.ConnectFeatures.Add(wixComplexReferenceRow.Parent);
1207 + case ComplexReferenceChildType.Module:
1208 + connection = modulesToFeatures[wixComplexReferenceRow.Child];
1209 + if (null == connection)
1210 + {
1211 + modulesToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary));
1212 + }
1213 + else if (wixComplexReferenceRow.IsPrimary)
1214 + {
1215 + if (connection.IsExplicitPrimaryFeature)
1216 + {
1217 + this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1218 + continue;
1219 + }
1220 + else
1221 + {
1222 + connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects
1223 + connection.PrimaryFeature = wixComplexReferenceRow.Parent; // set the new primary feature
1224 + connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again
1225 + }
1226 + }
1227 + else
1228 + {
1229 + connection.ConnectFeatures.Add(wixComplexReferenceRow.Parent);
1230 + }
1231 + break;
1232 +
1233 + default:
1234 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1235 }
1236 break;
1237
1233 - default:
1234 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1235 - }
1236 - break;
1237 -
1238 - case ComplexReferenceParentType.Module:
1239 - switch (wixComplexReferenceRow.ChildType)
1240 - {
1241 - case ComplexReferenceChildType.Component:
1242 - if (componentsToModules.ContainsKey(wixComplexReferenceRow.Child))
1243 - {
1244 - this.OnMessage(ErrorMessages.ComponentReferencedTwice(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.Child));
1245 - continue;
1246 - }
1247 - else
1238 + case ComplexReferenceParentType.Module:
1239 + switch (wixComplexReferenceRow.ChildType)
1240 {
1249 - componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new
1241 + case ComplexReferenceChildType.Component:
1242 + if (componentsToModules.ContainsKey(wixComplexReferenceRow.Child))
1243 + {
1244 + this.OnMessage(ErrorMessages.ComponentReferencedTwice(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.Child));
1245 + continue;
1246 + }
1247 + else
1248 + {
1249 + componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new
1250
1251 - // add a row to the ModuleComponents table
1252 - var moduleComponent = new ModuleComponentsTuple();
1253 - moduleComponent.Component = wixComplexReferenceRow.Child;
1254 - moduleComponent.ModuleID = wixComplexReferenceRow.Parent;
1255 - moduleComponent.Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage);
1256 - }
1251 + // add a row to the ModuleComponents table
1252 + var moduleComponent = new ModuleComponentsTuple();
1253 + moduleComponent.Component = wixComplexReferenceRow.Child;
1254 + moduleComponent.ModuleID = wixComplexReferenceRow.Parent;
1255 + moduleComponent.Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage);
1256 + }
1257 +
1258 + // index the component for finding orphaned records
1259 + var componentSymbolName = String.Concat("Component:", wixComplexReferenceRow.Child);
1260 + referencedComponents.Add(componentSymbolName);
1261
1258 - // index the component for finding orphaned records
1259 - var componentSymbolName = String.Concat("Component:", wixComplexReferenceRow.Child);
1260 - referencedComponents.Add(componentSymbolName);
1262 + break;
1263
1264 + default:
1265 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1266 + }
1267 break;
1268
1264 - default:
1265 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1266 - }
1267 - break;
1269 + case ComplexReferenceParentType.Patch:
1270 + switch (wixComplexReferenceRow.ChildType)
1271 + {
1272 + case ComplexReferenceChildType.PatchFamily:
1273 + case ComplexReferenceChildType.PatchFamilyGroup:
1274 + break;
1275
1269 - case ComplexReferenceParentType.Patch:
1270 - switch (wixComplexReferenceRow.ChildType)
1271 - {
1272 - case ComplexReferenceChildType.PatchFamily:
1273 - case ComplexReferenceChildType.PatchFamilyGroup:
1276 + default:
1277 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1278 + }
1279 break;
1280
1276 - default:
1277 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1278 - }
1279 - break;
1280 -
1281 - case ComplexReferenceParentType.Product:
1282 - switch (wixComplexReferenceRow.ChildType)
1283 - {
1284 - case ComplexReferenceChildType.Feature:
1285 - connection = featuresToFeatures[wixComplexReferenceRow.Child];
1286 - if (null != connection)
1281 + case ComplexReferenceParentType.Product:
1282 + switch (wixComplexReferenceRow.ChildType)
1283 {
1288 - this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1289 - continue;
1290 - }
1284 + case ComplexReferenceChildType.Feature:
1285 + connection = featuresToFeatures[wixComplexReferenceRow.Child];
1286 + if (null != connection)
1287 + {
1288 + this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1289 + continue;
1290 + }
1291 +
1292 + featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, null, wixComplexReferenceRow.IsPrimary));
1293 + break;
1294
1292 - featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, null, wixComplexReferenceRow.IsPrimary));
1295 + default:
1296 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1297 + }
1298 break;
1299
1300 default:
1296 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType)));
1297 - }
1298 - break;
1299 -
1300 - default:
1301 - // Note: Groups have been processed before getting here so they are not handled by any case above.
1302 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType)));
1301 + // Note: Groups have been processed before getting here so they are not handled by any case above.
1302 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType)));
1303 }
1304 }
1305
@@ -1614,7 +1614,7 @@ namespace WixToolset.Core
1614 groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Package, false);
1615 groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Container, false);
1616 groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Layout, false);
1617 -
1617 +
1618 // Create Chain packages...
1619 groups.UseTypes(new[] { ComplexReferenceParentType.PackageGroup }, new[] { ComplexReferenceChildType.Package, ComplexReferenceChildType.PackageGroup });
1620 groups.FlattenAndRewriteRows(ComplexReferenceChildType.PackageGroup, "WixChain", false);
@@ -1631,17 +1631,17 @@ namespace WixToolset.Core
1631 {
1632 foreach (ConnectToFeature connection in featuresToFeatures)
1633 {
1634 - var wixSimpleReferenceRow = new WixSimpleReferenceTuple();
1635 - wixSimpleReferenceRow.Table = "Feature";
1636 - wixSimpleReferenceRow.PrimaryKeys = connection.ChildId;
1634 + var wixSimpleReferenceRow = new WixSimpleReferenceTuple
1635 + {
1636 + Table = "Feature",
1637 + PrimaryKeys = connection.ChildId
1638 + };
1639
1638 - if (!allSymbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbol))
1640 + if (allSymbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbol))
1641 {
1640 - continue;
1642 + var featureTuple = (FeatureTuple)symbol.Row;
1643 + featureTuple.ParentFeatureRef = connection.PrimaryFeature;
1644 }
1642 -
1643 - var row = symbol.Row;
1644 - row.Set(1, connection.PrimaryFeature);
1645 }
1646 }
1647
src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+2 -2
@@ -217,7 +217,7 @@ namespace WixToolsetTest.CoreIntegration
217 }
218 }
219
220 - [Fact(Skip = "Test demonstrates failure")]
220 + [Fact]
221 public void PopulatesDirectoryTableWithValidDefaultDir()
222 {
223 var folder = TestData.Get(@"TestData");
@@ -259,7 +259,7 @@ namespace WixToolsetTest.CoreIntegration
259 }
260 }
261
262 - [Fact(Skip = "Test demonstrates failure")]
262 + [Fact]
263 public void PopulatesFeatureTableWithParent()
264 {
265 var folder = TestData.Get(@"TestData");