wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
130 stars 24 forks source link

Patch build tries to set non-nullable field to null when deleting row #8689

Open barnson opened 3 months ago

barnson commented 3 months ago

WiX Version

5.0.1

.NET or MSBuild or Visual Studio Version

8.0.400

HeatWave Version

n/a

Windows Version

n/a

Repro Repo

No response

Repro Steps

Create a patch where an update package has rows deleted in the RemoveFile table.

Actual Result

wix.exe : error WIX0001: System.InvalidOperationException: Cannot set column 'InstallMode' with a null value because this is a required field.
   at WixToolset.Data.WindowsInstaller.Field.ValidateValue(ColumnDefinition column, Object value) in D:\a\wix\wix\src\api\wix\WixToolset.Data\WindowsInstaller\Field.cs:line 191
   at WixToolset.Core.WindowsInstaller.Bind.BindTransformCommand.Execute() in D:\a\wix\wix\src\wix\WixToolset.Core.WindowsInstaller\Bind\BindTransformCommand.cs:line 265
   at WixToolset.Core.WindowsInstaller.Bind.GenerateDatabaseCommand.ImportSubStorages(Database db) in D:\a\wix\wix\src\wix\WixToolset.Core.WindowsInstaller\Bind\GenerateDatabaseCommand.cs:line 365
   at WixToolset.Core.WindowsInstaller.Bind.GenerateDatabaseCommand.Execute() in D:\a\wix\wix\src\wix\WixToolset.Core.WindowsInstaller\Bind\GenerateDatabaseCommand.cs:line 110
   at WixToolset.Core.WindowsInstaller.Bind.BindDatabaseCommand.Execute() in D:\a\wix\wix\src\wix\WixToolset.Core.WindowsInstaller\Bind\BindDatabaseCommand.cs:line 461
   at WixToolset.Core.WindowsInstaller.MspBackend.Bind(IBindContext context) in D:\a\wix\wix\src\wix\WixToolset.Core.WindowsInstaller\MspBackend.cs:line 67
   at WixToolset.Core.Binder.BackendBind(IBindContext context) in D:\a\wix\wix\src\wix\WixToolset.Core\Binder.cs:line 65
   at WixToolset.Core.Binder.Bind(IBindContext context) in D:\a\wix\wix\src\wix\WixToolset.Core\Binder.cs:line 40
   at WixToolset.Core.CommandLine.BuildCommand.BindPhase(Intermediate output, IReadOnlyCollection`1 localizations, IReadOnlyCollection`1 filterCultures, String cabCachePath, Int32 cabbingThreadCount, IReadOnlyCollection`1 bindPaths, Dictionary`2 bindVariables, InputsAndOutputs inputsOutputs, CancellationToken cancellationToken) in D:\a\wix\wix\src\wix\WixToolset.Core\CommandLine\BuildCommand.cs:line 343
   at WixToolset.Core.CommandLine.BuildCommand.ExecuteAsync(CancellationToken cancellationToken) in D:\a\wix\wix\src\wix\WixToolset.Core\CommandLine\BuildCommand.cs:line 150
   at WixToolset.Tools.Program.Run(IServiceProvider serviceProvider, IMessageListener listener, String[] args, CancellationToken cancellationToken) in D:\a\wix\wix\src\wix\wix\Program.cs:line 103
   at WixToolset.Tools.Program.Main(String[] args) in D:\a\wix\wix\src\wix\wix\Program.cs:line 48

Expected Result

Successful patch build.

The failure comes in BindTransformCommand.Execute at https://github.com/wixtoolset/wix/blob/main/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs#L271. ColumnDefinition.MinValue is nullable as of WiX v4, so the assignment tries to set a non-nullable field to null. In WiX v3, ColumnDefinition.MinValue wasn't nullable so got a default value of 0, which isn't a legal value for that particular column, but survives the null check.

Acknowledgements