Conversation
There was a problem hiding this comment.
Hey - 我发现了两个问题,并给出了一些总体反馈:
- 在 ci.yml 中,更新后的条件
github.ref == format('refs/heads/{0}', steps.build.outputs.default_branch)很可能需要包裹在表达式中(${{ format(...) }});按当前写法它会被视为字面字符串,而不会被求值。 - MaaAgentServer 中的 SetLogDirectory 在文档中声明会抛出 ArgumentNullException,但目前是直接将目录传给 SetOption,没有进行空/空字符串检查;建议对输入进行校验,使其与 XML 文档一致,并避免产生含糊不清的互操作错误。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- 在 ci.yml 中,更新后的条件 `github.ref == format('refs/heads/{0}', steps.build.outputs.default_branch)` 很可能需要包裹在表达式中(`${{ format(...) }}`);按当前写法它会被视为字面字符串,而不会被求值。
- MaaAgentServer 中的 SetLogDirectory 在文档中声明会抛出 ArgumentNullException,但目前是直接将目录传给 SetOption,没有进行空/空字符串检查;建议对输入进行校验,使其与 XML 文档一致,并避免产生含糊不清的互操作错误。
## Individual Comments
### Comment 1
<location path="src/MaaFramework.Binding/IMaaAgentServer.cs" line_range="24-26" />
<code_context>
+ /// <summary>
+ /// Sets the log directory.
+ /// </summary>
+ /// <param name="directory">The log directory.</param>
+ /// <exception cref="ArgumentNullException"/>
+ /// <exception cref="MaaInteroperationException"/>
+ IMaaAgentServer SetLogDirectory(string directory);
+
</code_context>
<issue_to_address>
**issue:** `SetLogDirectory`/`SetStdoutLevel` 文档中声明的 `ArgumentNullException` 与当前实现不匹配。
该接口在 `SetLogDirectory` 和 `SetStdoutLevel` 上记录了 `ArgumentNullException`,但 `MaaAgentServer` 是委托给 `MaaGlobal.Shared.SetOption`,并未显式强制这一异常。如果 `SetOption` 在接收到 null 时不会抛出 `ArgumentNullException`,那么 XML 文档就是不准确的。请考虑要么添加显式的 null 检查以匹配文档中声明的异常,要么更新 XML 注释以反映实际行为。
</issue_to_address>
### Comment 2
<location path="docs/articles/overview-of-wrapper-and-api.md" line_range="1" />
<code_context>
-# Overview of Wrapper (v5.8.0) and Api ([v5.8.1](https://github.com/MaaXYZ/MaaFramework/tree/v5.8.1))
+# Overview of Wrapper (v5.10.0) and Api ([v5.10.5](https://github.com/MaaXYZ/MaaFramework/tree/v5.10.5))
## Enums
</code_context>
<issue_to_address>
**suggestion (typo):** 建议将标题中的 "Api" 改为更常见的大写形式 "API"。
在这里使用标准缩写大写形式 "API" 可以让文档在风格上更统一,也更清晰易读。
```suggestion
# Overview of Wrapper (v5.10.0) and API ([v5.10.5](https://github.com/MaaXYZ/MaaFramework/tree/v5.10.5))
```
</issue_to_address>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English
Hey - I've found 2 issues, and left some high level feedback:
- In ci.yml, the updated condition
github.ref == format('refs/heads/{0}', steps.build.outputs.default_branch)should likely be wrapped in an expression (${{ format(...) }}); as written it will be treated as a literal string rather than evaluated. - SetLogDirectory in MaaAgentServer is documented as throwing ArgumentNullException but currently passes the directory directly to SetOption without a null/empty check; consider validating the input to match the XML documentation and avoid ambiguous interop errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In ci.yml, the updated condition `github.ref == format('refs/heads/{0}', steps.build.outputs.default_branch)` should likely be wrapped in an expression (`${{ format(...) }}`); as written it will be treated as a literal string rather than evaluated.
- SetLogDirectory in MaaAgentServer is documented as throwing ArgumentNullException but currently passes the directory directly to SetOption without a null/empty check; consider validating the input to match the XML documentation and avoid ambiguous interop errors.
## Individual Comments
### Comment 1
<location path="src/MaaFramework.Binding/IMaaAgentServer.cs" line_range="24-26" />
<code_context>
+ /// <summary>
+ /// Sets the log directory.
+ /// </summary>
+ /// <param name="directory">The log directory.</param>
+ /// <exception cref="ArgumentNullException"/>
+ /// <exception cref="MaaInteroperationException"/>
+ IMaaAgentServer SetLogDirectory(string directory);
+
</code_context>
<issue_to_address>
**issue:** The documented `ArgumentNullException` for `SetLogDirectory`/`SetStdoutLevel` does not match the current implementation.
The interface documents `ArgumentNullException` for `SetLogDirectory` and `SetStdoutLevel`, but `MaaAgentServer` delegates to `MaaGlobal.Shared.SetOption` and does not explicitly enforce this. If `SetOption` doesn’t throw `ArgumentNullException` for null values, the XML docs are inaccurate. Please either add explicit null checks to match the documented exceptions or update the XML comments to reflect the actual behavior.
</issue_to_address>
### Comment 2
<location path="docs/articles/overview-of-wrapper-and-api.md" line_range="1" />
<code_context>
-# Overview of Wrapper (v5.8.0) and Api ([v5.8.1](https://github.com/MaaXYZ/MaaFramework/tree/v5.8.1))
+# Overview of Wrapper (v5.10.0) and Api ([v5.10.5](https://github.com/MaaXYZ/MaaFramework/tree/v5.10.5))
## Enums
</code_context>
<issue_to_address>
**suggestion (typo):** Consider capitalizing "Api" to the more standard "API" in this heading.
Using the standard acronym capitalization "API" here will keep the documentation consistent and clearer for readers.
```suggestion
# Overview of Wrapper (v5.10.0) and API ([v5.10.5](https://github.com/MaaXYZ/MaaFramework/tree/v5.10.5))
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
Release PR for v5.10.0, updating the C# bindings to align with MaaFramework v5.10.5, introducing AgentServer logging configuration APIs, and refreshing docs/tests/CI-CD for the new release line.
Changes:
- Updated dependency versions to MaaFramework runtimes
5.10.5and refreshed version references across samples/docs/changelogs. - Added
IMaaAgentServerlogging configuration APIs (SetLogDirectory,SetStdoutLevel) and marked the legacy toolkit init-option extension as obsolete. - Updated unit tests and GitHub Actions workflows for the new release/publishing flow.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/MaaFramework/packages.lock.json | Updates locked MaaFramework runtime dependencies to 5.10.5. |
| src/MaaFramework.Binding/MaaMsg.cs | Updates embedded API document version reference. |
| src/MaaFramework.Binding/IMaaAgentServer.cs | Adds AgentServer logging configuration methods to the public interface. |
| src/MaaFramework.Binding.UnitTests/Test_IMaaController.cs | Adjusts controller option test scoping and shell output expectations. |
| src/MaaFramework.Binding.UnitTests/Test_IMaaAgentServer.cs | Updates AgentServer test to use new logging APIs. |
| src/MaaFramework.Binding.UnitTests/packages.lock.json | Updates unit test project lockfile to MaaFramework runtimes 5.10.5. |
| src/MaaFramework.Binding.UnitTests/MaaTypes.cs | Introduces a Win32 MaaTypes flag for platform-specific test selection. |
| src/MaaFramework.Binding.Native/NativeBindingContext.cs | Bumps binding version constant to v5.10.0. |
| src/MaaFramework.Binding.Native/MaaAgentServer.cs | Implements new logging APIs and marks legacy init-option extension obsolete. |
| src/Directory.Packages.props | Updates central package version for MaaFramework runtimes to 5.10.5. |
| sample/csharp/3.CSBinding README Example.cs | Updates sample package reference to 5.10.0. |
| sample/csharp/2.AgentMain.cs | Updates sample package reference to 5.10.0. |
| sample/csharp/2.AgentChild.cs | Updates sample package reference to 5.10.0. |
| sample/csharp/1.main.cs | Updates sample package reference to 5.10.0. |
| README.zh_cn.md | Updates MaaFramework doc links to v5.10.5. |
| README.md | Updates MaaFramework doc links to v5.10.5. |
| docs/articles/overview-of-wrapper-and-api.md | Updates wrapper/API version header references to v5.10.x. |
| docs/articles/changelog-all-version.md | Adds 5.10.0 entry to the aggregated changelog. |
| CHANGELOG.md | Updates top-level changelog for v5.10.0 release notes and links. |
| .github/workflows/ci.yml | Updates CI workflow action versions and branch condition syntax. |
| .github/workflows/cd.yml | Updates CD action versions and switches NuGet publishing to NuGet/login (OIDC). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
发布 v5.10.0,使 C# 绑定与 MaaFramework v5.10.5 保持一致,并更新 CI/CD 工作流与发布流程。
新功能:
错误修复:
use_win32_vk_code方法签名,使其与更新日志中的说明一致。增强:
MaaTypes标志,用于区分平台特定的控制器选项。构建:
CI:
文档:
测试:
Original summary in English
Summary by Sourcery
Release v5.10.0 aligning the C# bindings with MaaFramework v5.10.5 and updating CI/CD workflows and publishing flows.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Documentation:
Tests: