microsoft / msix-packaging

MSIX SDK
MIT License
963 stars 163 forks source link

Added code changes for Improving the Error Messages being outputted and to resolve the Github Bug #590

Closed pratiksinha07 closed 11 months ago

pratiksinha07 commented 11 months ago

Part 1 -

Why the change been made ?

On every execution, the MSIXMGR Tool generates a Response which denotes whether it is a successful execution (S_OK) or an erroneous execution (some error code). During an erroneous execution, the tool generates an HRESULT code which indicates the error that has occurred and also a custom message that indicates the information related to that particular flow.

There are few shortcomings with the current way of outputting the error message to the user –

The Error Messages are sometimes specific to the Execution flow and we are not outputting the details related to the HRESULT code, which might give deeper information regarding the failure/error that has occurred. For example, while unpacking to a VHDX, the error currently being thrown is “Creating the VHDX failed. HRESULT 0x80889382”, but we are not showing the underlying reason for the failure and the description for the HRESULT.

Due to recent changes due to the VHDSize parameter (making it optional), the error messages being outputted needs to be changed to comply with the new changes. (Details in next section)

What change has been made ?

Added a middleware library to extract the Error Description corresponding to the HRESULT code. Appending the Error Desc corresponding to HRESULT code to Telemetry Output and to Console Output Handling the Error Messaging for the code changes done for VHD Size parameter

Testing

Tested every workflow in the MSIXMGR Tool by running the Tool and verifying the output.

Part 2 -

Why the change been made ?

Link to the Bug - https://github.com/microsoft/msix-packaging/issues/507

As per the above GitHub issue, whenever we are trying to unpack multiple packages present in a directory, the unpack might fail for some of the packages. In this case the Response HRESULT code being returned should be one of the Erroneous HRESULT code, but the tool is currently returning a successful Response for the execution.

The User is not able to find the LAST HRESULT CODE using the $LASTEXITCODE command in Powershell.

What change has been made ?

In the above case we will be returning the last HRESULT code that has been encountered while unpacking the set of packages as the Process output.  Added code changes for the same.

Testing

Tested the concerned workflow in the MSIXMGR Tool by running the Tool and verifying the output.