Skip to content

After building from source code, winget "install" command crashes when trying load string from resources. #409

Closed

Description

@iksi4prs

Brief description of your issue

  1. I've built the client from sources.
  2. Some commands succeed, eg:
    AppInstallerCLI.exe show
  3. The following commands cause crash:
    AppInstallerCLI.exe install --verbose-logs TeXstudio
    AppInstallerCLI.exe install --verbose-logs 7Zip
    etc.

Steps to reproduce

  1. Build the solution
  2. Run following command:
    AppInstallerCLI.exe install --verbose-logs TeXstudio
  3. The app will exit without any message or log
  4. Checking with debugger shows an exception handled and app exiting with error

Expected behavior

  1. Command "install" should succeed
  2. In case of fatal error, some message should be displayed or logged without need to debug the application.
  3. If any additional steps required to run the app when building from code, they should be included in readme

Actual behavior

In release build application exits without message or log.

In debug build:
Before crash there are 2 exceptions in problem in finding the resource,
for showing string id "InstallationDisclaimer1" and "UnexpectedErrorExecutingCommand"
stack attached below.

After that the default catch(...) is triggered and app exits.

Regardless of the failure to install,
the crash, as far as I can tell, if a resource is missing,
so file copy is missing from post-build,
or there are additional requirements to install/use the app,
which are not found in "Building the client" in readme.

Stack trace:

AppInstallerCLI.exe!winrt::throw_hresult(const winrt::hresult result) Line 4274 C++
AppInstallerCLI.exe!winrt::check_hresult(const winrt::hresult result) Line 4320 C++
AppInstallerCLI.exe!winrt::Windows::Foundation::IActivationFactory::ActivateInstancewinrt::Windows::ApplicationModel::Resources::ResourceLoader() Line 5686 C++
AppInstallerCLI.exe!winrt::Windows::ApplicationModel::Resources::ResourceLoader::(const winrt::Windows::Foundation::IActivationFactory & f) Line 179 C++
AppInstallerCLI.exe!winrt::Windows::ApplicationModel::Resources::ResourceLoader (const winrt::Windows::Foundation::IActivationFactory &)::<lambda_invoker_cdecl>(const winrt::Windows::Foundation::IActivationFactory & f) Line 179 C++
AppInstallerCLI.exe!winrt::impl::factory_cache_entrywinrt::Windows::ApplicationModel::Resources::ResourceLoader,winrt::Windows::Foundation::IActivationFactory::call<winrt::Windows::ApplicationModel::Resources::ResourceLoader (__cdecl*)(winrt::Windows::Foundation::IActivationFactory const &)>(winrt::Windows::ApplicationModel::Resources::ResourceLoader()(const winrt::Windows::Foundation::IActivationFactory &) && callback) Line 5539 C++
AppInstallerCLI.exe!winrt::impl::call_factory_cast<winrt::Windows::ApplicationModel::Resources::ResourceLoader (__cdecl
)(winrt::Windows::Foundation::IActivationFactory const &),winrt::Windows::ApplicationModel::Resources::ResourceLoader,winrt::Windows::Foundation::IActivationFactory,winrt::Windows::ApplicationModel::Resources::ResourceLoader (const winrt::Windows::Foundation::IActivationFactory &)>(winrt::Windows::ApplicationModel::Resources::ResourceLoader::winrt::Windows::ApplicationModel::Resources::ResourceLoader (const winrt::Windows::Foundation::IActivationFactory &) && callback) Line 5578 C++
AppInstallerCLI.exe!winrt::Windows::ApplicationModel::Resources::ResourceLoader::ResourceLoader() Line 181 C++
AppInstallerCLI.exe!AppInstaller::CLI::Resource::Loader::Loader() Line 22 C++
AppInstallerCLI.exe!AppInstaller::CLI::Resource::Loader::Instance() Line 17 C++
AppInstallerCLI.exe!AppInstaller::CLI::Resource::LocString::LocString(AppInstaller::CLI::Resource::StringId id) Line 12 C++
AppInstallerCLI.exe!operator<<(std::basic_ostream<char,std::char_traits> & out, AppInstaller::CLI::Resource::StringId si) Line 172 C++
AppInstallerCLI.exe!AppInstaller::CLI::Execution::Reporter::OutputStream::operator<<AppInstaller::CLI::Resource::StringId(const AppInstaller::CLI::Resource::StringId & t) Line 93 C++
AppInstallerCLI.exe!AppInstaller::CLI::Workflow::ShowInstallationDisclaimer(AppInstaller::CLI::Execution::Context & context) Line 41 C++
AppInstallerCLI.exe!AppInstaller::CLI::Workflow::WorkflowTask::operator()(AppInstaller::CLI::Execution::Context & context) Line 57 C++
AppInstallerCLI.exe!operator<<(AppInstaller::CLI::Execution::Context & context, const AppInstaller::CLI::Workflow::WorkflowTask & task) Line 333 C++
AppInstallerCLI.exe!operator<<(AppInstaller::CLI::Execution::Context & context, void(*)(AppInstaller::CLI::Execution::Context &) f) Line 319 C++
AppInstallerCLI.exe!AppInstaller::CLI::InstallCommand::ExecuteInternal(AppInstaller::CLI::Execution::Context & context) Line 56 C++
AppInstallerCLI.exe!AppInstaller::CLI::Command::Execute(AppInstaller::CLI::Execution::Context & context) Line 469 C++
AppInstallerCLI.exe!AppInstaller::CLI::CoreMain(int argc, const wchar_t * * argv) Line 113 C++
AppInstallerCLI.exe!wmain(int argc, const wchar_t * * argv) Line 8 C++
AppInstallerCLI.exe!invoke_main() Line 91 C++
AppInstallerCLI.exe!__scrt_common_main_seh() Line 288 C++
AppInstallerCLI.exe!__scrt_common_main() Line 331 C++
AppInstallerCLI.exe!wmainCRTStartup() Line 17 C++

Environment

Windows 10 Pro, v# 1903
Visual Studio 2019, v# 16.5.4

Activity

  1. ghost added
    Needs-Triage
    on Jun 7, 2020
  2. added
    Issue-Bug
    and removed
    Needs-Triage
    on Jun 11, 2020
  3. added this to the milestone on Jun 11, 2020
  4. yao-msft commented on Jun 23, 2020

    @yao-msft
    Contributor

    The string resources are in resources.pri built with AppInstallerCli project. And it should be beside the AppInstallerCli.exe. Did you try to copy the AppInstallerCli.exe to other locations without copying the resources.pri?

  5. iksi4prs commented on Jun 23, 2020

    @iksi4prs
    Author

    "Did you try to copy the AppInstallerCli.exe to other locations without copying the resources.pri?"

    No, but after reading your comment and understanding what was missing, I've managed to fix it, and also to reproduce the problem.

    Steps to reproduce:

    1. Clean solution
    2. Set AppInstallerCLI as startup project
      (this was done so can debug it via VS)
    3. Build "AppInstallerCLI" (as project ,not the solution)
      Result:
      resources.pri is not copied to output folder.
    • if I build the whole solution.
      resources.pri is copied to output folder.

    As a developer, my expected results are:

    1. The copy will be dependent on build of project, not solution.
    2. If resources.pri not found in runtime, receive some relevant message instead of "crash".

    As end user, my expected results are:
    I add it only because I didnt plan to build/debug at all, and I did it just because the app just ran and stopped without giving any indication,
    so I would expect, as other app do, in case of crash, just give some error message,
    even a hard coded number code which is not dependent on translation.
    Usually I would create a parent process which does nothing except creating a child process,
    and if the exit-code of child process is not 0, print some error message. my 2 Cents.

  6. denelon commented on Apr 20, 2021

    @denelon
    Collaborator

    We will add a catch to the exception to give instructions, and we will update the instructions for building the client on the README.md

  7. modified the milestones: , v1.1 - Windows Package Manager on May 14, 2021
  8. ghost added
    In-PR
    on Sep 8, 2021
  9. ghost removed
    In-PR
    on Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-Bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions