Skip to content

Improve run process errors#7302

Merged
waruqi merged 18 commits intodevfrom
missdll
Feb 7, 2026
Merged

Improve run process errors#7302
waruqi merged 18 commits intodevfrom
missdll

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Feb 6, 2026

@waruqi waruqi added this to the v3.0.7 milestone Feb 6, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @waruqi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the diagnostic capabilities of Xmake when running executables, particularly on Windows. It provides users with more actionable feedback by allowing control over Windows Error Reporting Dialogs and by offering detailed information about missing DLLs when an application fails to start. This makes debugging runtime issues much more straightforward for developers.

Highlights

  • Enhanced Windows Error Reporting: Introduced a new winos.set_error_mode function and a run.windows_error_dialog policy to control Windows Error Reporting Dialogs during process execution, allowing users to suppress or enable these dialogs.
  • Improved DLL Loading Error Diagnostics: Enhanced os.execv and os.exec to provide more detailed error messages, specifically for Windows applications failing due to missing DLLs (error code 0xC0000135). It now attempts to identify and list the specific missing DLLs.
  • New Windows DLL Linking Test Cases: Added new test projects to validate the improved error handling for Windows DLL linking scenarios, ensuring the new diagnostics work as expected.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • core/src/xmake/engine.c
    • Added declaration and registration for xm_winos_set_error_mode.
  • core/src/xmake/winos/set_error_mode.c
    • New file: Implements xm_winos_set_error_mode to wrap the Windows SetErrorMode API, allowing programmatic control over error dialogs.
  • tests/projects/windows/windows_links/src/foo.c
    • New file: A simple C source file exporting a function foo for testing shared library linking on Windows.
  • tests/projects/windows/windows_links/src/main.c
    • New file: A simple C program that imports foo from a DLL and includes GetProcessMemoryInfo for testing purposes.
  • tests/projects/windows/windows_links/xmake.lua
    • New file: Xmake project configuration for the new Windows DLL linking tests, defining targets for a shared library and an executable, and setting the run.windows_error_dialog policy.
  • xmake/actions/run/main.lua
    • Implemented logic to temporarily set and restore the Windows error mode based on the run.windows_error_dialog policy before and after executing processes.
  • xmake/core/base/os.lua
    • Modified os.execv to retrieve and include detailed error messages from process.get_exit_errors when an external process fails.
    • Refined error message formatting to handle cases where errors might be nil more gracefully.
  • xmake/core/base/process.lua
    • Added _get_missing_dlls function to analyze an executable and identify its imported DLLs that are not found in the system PATH.
    • Introduced get_exit_errors function to provide specific, user-friendly error messages for Windows STATUS_DLL_NOT_FOUND (0xC0000135) errors, including a list of missing DLLs if identifiable.
  • xmake/core/project/policy.lua
    • Added a new policy run.windows_error_dialog to control the display of Windows Error Reporting Dialogs during execution, defaulting to false.
  • xmake/core/sandbox/modules/os.lua
    • Updated sandbox_os.exec and sandbox_os.execv to propagate the detailed error messages from the underlying os.exec and os.execv calls when raising exceptions.
  • xmake/core/sandbox/modules/winos.lua
    • Exposed the new winos.set_error_mode function to the sandbox environment.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves error reporting for missing DLLs on Windows and adds a policy to control error dialogs. The implementation for detecting missing DLLs is a great addition. I've found a critical issue in the error reporting logic that would prevent it from working, and a high-severity issue related to resource management when changing the process error mode. I've also included a couple of medium-severity suggestions for code style and consistency.

@waruqi waruqi merged commit 15d8fed into dev Feb 7, 2026
74 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants