winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

COM InProc E2E tests cannot load the string resources

Open florelis opened this issue 3 years ago • 1 comments

Brief description of your issue

In the COM InProc E2E tests, if the COM call hits a path that needs to resolve a string resource, the call will fail with "File Not Found" when looking for the resources file, which later causes the tests to fail.

Steps to reproduce

  1. Add a use of the ResourceLoader in a path used by the COM commands, for example a Resource::LocString{ someStringId } in any common code path.
  2. Build the project.
  3. Copy the WindowsPackageManager.dll to the E2E tests build output folder (needed to run the InProc tests)
  4. Run the tests

Expected behavior

The tests should pass

Actual behavior

The tests fail due to the COM call not finding the Resources.pri. Using ProcMon one can see that it is looking for it under C:\Program Files\dotnet\Resources.pri, which likely means it's trying to find it next to the executable running.

A hacky solution is to copy the file there (and it did work for me), but we should find a better way before we hit this.

Environment

N/A

florelis avatar Aug 11 '22 23:08 florelis

Per @AmelBawa-msft , we already do this copying a file to the dotnet directory for it to be found for the .winmd: https://github.com/microsoft/winget-cli/blob/5390e1c7873bf9455261be189083498bcb2e8dc1/azure-pipelines.yml#L238-L244

florelis avatar Aug 11 '22 23:08 florelis