@joebigelow / wix / commits / e3b4af31

Fix compiler to handle util:ServiceConfig absent reset period and start delay

Fixes 7150

Rob Mensching committed Jan 12, 2023 at 11:39 UTC e3b4af31d93962a7bd0a417d400921e00e9e249a
3 files changed +46 -2
src/ext/Util/test/WixToolsetTest.Util/TestData/ServiceConfig/Package.wxs new
+27
@@ -0,0 +1,27 @@
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
2 + xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
3 + <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 + <MajorUpgrade DowngradeErrorMessage="A downgrade error message." />
5 +
6 + <Feature Id="ProductFeature" Title="A feature title">
7 + <ComponentGroupRef Id="ProductComponents" />
8 + </Feature>
9 + </Package>
10 +
11 + <Fragment>
12 + <StandardDirectory Id="ProgramFilesFolder">
13 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
14 + </StandardDirectory>
15 + </Fragment>
16 +
17 + <Fragment>
18 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
19 + <Component>
20 + <File Name="notanexe.exe" Source="Package.wxs" />
21 + <ServiceInstall Name="svc" Start="demand" Type="ownProcess" ErrorControl="normal">
22 + <util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" />
23 + </ServiceInstall>
24 + </Component>
25 + </ComponentGroup>
26 + </Fragment>
27 +</Wix>
src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+17
@@ -170,6 +170,23 @@ namespace WixToolsetTest.Util
170 }, results.OrderBy(s => s).ToArray());
171 }
172
173 + [Fact]
174 + public void CanBuildServiceConfig()
175 + {
176 + var folder = TestData.Get(@"TestData", "ServiceConfig");
177 + var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }, "test.msi");
178 +
179 + var results = build.BuildAndQuery(BuildX64, "Binary", "CustomAction", "ServiceConfig", "Wix4ServiceConfig");
180 + WixAssert.CompareLineByLine(new[]
181 + {
182 + "Binary:Wix4UtilCA_X64\t[Binary data]",
183 + "CustomAction:Wix4ExecServiceConfig_X64\t3073\tWix4UtilCA_X64\tExecServiceConfig\t",
184 + "CustomAction:Wix4RollbackServiceConfig_X64\t3329\tWix4UtilCA_X64\tRollbackServiceConfig\t",
185 + "CustomAction:Wix4SchedServiceConfig_X64\t1\tWix4UtilCA_X64\tSchedServiceConfig\t",
186 + "Wix4ServiceConfig:svc\tfilPeUUVRrj2.Q_YcmN55mro4H1aQY\t1\trestart\trestart\trestart\t\t\t\t",
187 + }, results.OrderBy(s => s).ToArray());
188 + }
189 +
190 [Fact]
191 public void CanBuildWithEventManifest()
192 {
src/ext/Util/wixext/UtilCompiler.cs
+2 -2
@@ -3072,8 +3072,8 @@ namespace WixToolset.Util
3072 var newService = false;
3073 string programCommandLine = null;
3074 string rebootMessage = null;
3075 - var resetPeriod = CompilerConstants.IntegerNotSet;
3076 - var restartServiceDelay = CompilerConstants.IntegerNotSet;
3075 + int? resetPeriod = null;
3076 + int? restartServiceDelay = null;
3077 string secondFailureActionType = null;
3078 string serviceName = null;
3079 string thirdFailureActionType = null;