Actually handle context-less Classes.
Bob Arnson committed
Aug 23, 2018 at 20:13 UTC
7972bb567d3957868ea531dded384f38385c81c6
1 file changed
+16
-19
src/WixToolset.Core/Compiler.cs
+16
-19
@@ -992,7 +992,7 @@ namespace WixToolset.Core
992
bool class32bit = false;
993
string classId = null;
994
YesNoType classAdvertise = YesNoType.NotSet;
995
- string[] contexts = null;
995
+ string[] contexts = new string[0];
996
string formattedContextString = null;
997
bool control = false;
998
string defaultInprocHandler = null;
@@ -1097,27 +1097,24 @@ namespace WixToolset.Core
1097
}
1098
1099
HashSet<string> uniqueContexts = new HashSet<string>();
1100
- if (contexts != null)
1100
+ foreach (string context in contexts)
1101
{
1102
- foreach (string context in contexts)
1102
+ if (uniqueContexts.Contains(context))
1103
{
1104
- if (uniqueContexts.Contains(context))
1105
- {
1106
- this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context));
1107
- }
1108
- else
1109
- {
1110
- uniqueContexts.Add(context);
1111
- }
1104
+ this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context));
1105
+ }
1106
+ else
1107
+ {
1108
+ uniqueContexts.Add(context);
1109
+ }
1110
1113
- if (context.EndsWith("32", StringComparison.Ordinal))
1114
- {
1115
- class32bit = true;
1116
- }
1117
- else
1118
- {
1119
- class16bit = true;
1120
- }
1111
+ if (context.EndsWith("32", StringComparison.Ordinal))
1112
+ {
1113
+ class32bit = true;
1114
+ }
1115
+ else
1116
+ {
1117
+ class16bit = true;
1118
}
1119
}
1120