wixtoolset / issues

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

ExePackagePayload Version attribute nullable object must have a value #8615

Open chrpai opened 4 months ago

chrpai commented 4 months ago

WiX Version

5.0.0

.NET or MSBuild or Visual Studio Version

VS 17.10.3

HeatWave Version

1.0.4

Windows Version

Win 11 23H2

Repro Repo

None

Repro Steps

Create a bootstrapper with the following fragment. It will build. Remove the ExePackagePayload element's Version attribute and it will fail.

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    <Fragment>
        <PackageGroup Id="WebView2">
      <ExePackage 
        DisplayName="Microsoft WebView" 
        CacheId="webview2"
        PerMachine="yes" 
        DetectCondition="WebView2Found &gt;= WebView2MinVersion" 
        Id="WebView2Web" 
        Vital="yes" 
        Permanent="yes" 
        InstallArguments="/silent /install" 
        RepairArguments="/silent /install">
        <ExePackagePayload 
          CertificatePublicKey="59B20D824EF56E7B220A21733E5E90BCB35FB9D5" 
          CertificateThumbprint="EDFF0D6EA868D5A5A1A7367AEF3528F7A5512842" 
          Description="Microsoft Edge Update Setup" 
          ProductName="Microsoft Edge Update" 
          Size="1853216" 
          Version="1.3.187.41" 
          Name="WebView2Web\MicrosoftEdgeWebview2Setup.exe" 
          DownloadUrl="https://go.microsoft.com/fwlink/p/?LinkId=2124703" />
      </ExePackage>
        </PackageGroup>
    </Fragment>
</Wix>

Actual Result

Severity Code Description Project File Line Suppression State Error (active) WIX0001 System.InvalidOperationException: Nullable object must have a value. REDACTEDBundle C:\GitHub\WindowsInstaller\Installer\REDACTEDBundle\wix.exe 1

Expected Result

according to https://wixtoolset.org/docs/schema/wxs/exepackagepayload/ the Version must not be speciied when the Hash is not specified. I expected it to build.

Acknowledgements

bevanweiss commented 4 months ago

Is this not expected? If you have an ExePackage element, but it has nothing to actually define what to execute (i.e. no ExePackagePayload, no DownloadUrl, no SourceFile) then shouldn't it throw some kind of error and not build?

I would agree that a System.InvalidOperationException: Nullable object must have a value. error message is not ideal, and it probably should reference something about an "ExePackage element without a valid executable reference provided"

I would also expect a build error if you included multiple executable ExePackagePayload elements under the ExePackage

chrpai commented 4 months ago

But it does have a ExePackagePayload which does download and install.

bevanweiss commented 4 months ago

Create a bootstrapper with the following fragment. It will build. Remove the ExePackagePayload element and it will fail.

Your repro says when you remove the ExePackagePayload, the build fails.

chrpai commented 4 months ago

Ah! I'm sorry, I meant to write remove the version attribute.

barnson commented 3 months ago

Definitely shouldn't crash...