Fix Avalonia IDE startup by moving packet workspace off the executable directory#18
Conversation
Agent-Logs-Url: https://github.com/GeneralLibrary/GeneralUpdate.Tools/sessions/3713e717-448c-4e9c-b05a-40d972079fc4 Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Agent-Logs-Url: https://github.com/GeneralLibrary/GeneralUpdate.Tools/sessions/3713e717-448c-4e9c-b05a-40d972079fc4 Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
|
@copilot 异常原因是什么? |
根因是启动阶段就发生了对可执行目录的写操作。 |
现在可以正常运行了吗 |
从当前验证看,这个问题已经修掉了:我刚重新执行了 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses Avalonia startup/debug reliability issues caused by runtime writes targeting the executable/output directory by moving the default packet workspace to a user-writable location and adjusting where update_config.json is generated.
Changes:
- Default packet workspace moved from
AppContext.BaseDirectoryto%LocalAppData%/GeneralUpdate.Tool.Avalonia(withpackets/patchbeneath it). update_config.jsonis now written intoConfigModel.PatchDirectoryand the directory is created before writing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var json = JsonConvert.SerializeObject(configInfo, Formatting.Indented); | ||
| var configFilePath = Path.Combine(AppContext.BaseDirectory, "update_config.json"); | ||
| Directory.CreateDirectory(ConfigModel.PatchDirectory); | ||
| var configFilePath = Path.Combine(ConfigModel.PatchDirectory, "update_config.json"); | ||
|
|
||
| await File.WriteAllTextAsync(configFilePath, json, Encoding.UTF8); |
| var localApplicationData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | ||
| if (string.IsNullOrWhiteSpace(localApplicationData)) | ||
| { | ||
| return AppContext.BaseDirectory; | ||
| } | ||
|
|
||
| return Path.Combine(localApplicationData, "GeneralUpdate.Tool.Avalonia"); |
Debugging
GeneralUpdate.Tool.Avaloniafrom the IDE could leave the process running without showing the window, while the packaged executable only started reliably with administrator privileges. The shared failure mode was runtime writes targeting the app’s install/output directory.Move runtime workspace to a user-writable location
PacketViewModelnow creates its defaultpackets/patchworkspace underLocalApplicationData/GeneralUpdate.Tool.Avaloniainstead ofAppContext.BaseDirectory.Write generated config into the patch output
update_config.jsonis now created inConfigModel.PatchDirectory, matching the existing method contract and keeping generated artifacts with the packet output.Scope
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
av-build-tel-api-v1.avaloniaui.net/usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll(dns block)If you need me to access, download, or install something from one of these locations, you can either: