From 7972bb567d3957868ea531dded384f38385c81c6 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 23 Aug 2018 20:13:34 -0400 Subject: Actually handle context-less Classes. --- src/WixToolset.Core/Compiler.cs | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'src/WixToolset.Core') diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index a4c289f7..bbe21b1c 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -992,7 +992,7 @@ namespace WixToolset.Core bool class32bit = false; string classId = null; YesNoType classAdvertise = YesNoType.NotSet; - string[] contexts = null; + string[] contexts = new string[0]; string formattedContextString = null; bool control = false; string defaultInprocHandler = null; @@ -1097,27 +1097,24 @@ namespace WixToolset.Core } HashSet uniqueContexts = new HashSet(); - if (contexts != null) + foreach (string context in contexts) { - foreach (string context in contexts) + if (uniqueContexts.Contains(context)) { - if (uniqueContexts.Contains(context)) - { - this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context)); - } - else - { - uniqueContexts.Add(context); - } + this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context)); + } + else + { + uniqueContexts.Add(context); + } - if (context.EndsWith("32", StringComparison.Ordinal)) - { - class32bit = true; - } - else - { - class16bit = true; - } + if (context.EndsWith("32", StringComparison.Ordinal)) + { + class32bit = true; + } + else + { + class16bit = true; } } -- cgit v1.2.3-55-g6feb