Conversation
- 在App.axaml.cs的ConfigureServices方法中添加ILogService和IErrorHandlerService注册 - 解决UnifiedEditorFactory无法解析依赖服务的启动错误 - 添加依赖注入测试以验证配置正确性 - 应用程序现在可以正常启动并显示Avalonia UI界面 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a dependency injection configuration issue that prevented the application from starting. The UnifiedEditorFactory was unable to resolve required dependencies (ILogService and IErrorHandlerService), causing startup failures.
- Added missing service registrations for
ILogServiceandIErrorHandlerServicein the DI container - Created comprehensive tests to verify dependency injection configuration
- Ensured all required services can be properly resolved by the service provider
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| BannerlordModEditor.UI/App.axaml.cs | Added missing service registrations for log and error handling services |
| BannerlordModEditor.UI.Tests/DependencyInjection/DependencyInjectionTests.cs | Added comprehensive test suite to verify dependency injection configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or 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
UnifiedEditorFactory无法解析ILogService和IErrorHandlerService的依赖注入问题App.axaml.cs的ConfigureServices方法中添加了缺失的服务注册Problem
应用程序启动时出现以下错误:
Root Cause
UnifiedEditorFactory类的构造函数需要以下依赖:ILogService logServiceIErrorHandlerService errorHandlerService但在
App.axaml.cs的ConfigureServices()方法中,这两个服务没有被注册到依赖注入容器中。Solution
在
App.axaml.cs中添加了缺失的服务注册:Test plan
🤖 Generated with Claude Code