Repository navigation
Migrate to .NET 11 - #930
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
As we already moved to .NET 11's ZstandardStream implementation, this should no longer necessary.
| if (asset.AssetIndex.PatchInfo?.FirstOrDefault() is { } patchInfo) | ||
| { | ||
| string basePath = Path.Combine(GetAssetBasePathByType(asset.AssetIndex.DataType), asset.AssetIndex.DataType.ToString().ToLowerInvariant()); | ||
| string oldFilePath = Path.Combine(basePath, $"{patchInfo.Value.OldFileName}.unity3d"); | ||
| string newFilePath = asset.AssetIndex.ConcatPath; | ||
|
|
||
|
|
||
| long patchFileSize = patchInfo.Value.PatchFileSize; | ||
| string patchFilePath = Path.Combine(basePath, patchInfo.Value.PatchName); | ||
| string patchFileUrl = string.Format(BuildAssetBundleURL(GameGateway), asset.AssetIndex.DataType.ToString().ToLowerInvariant()) | ||
| .CombineURLFromString("patch", patchInfo.Value.PatchName); |
There was a problem hiding this comment.
Bug: Fast check mode bypasses IsPatchExist, leaving unverified PatchInfo entries that cause UpdateCacheAsset to crash or apply patches to invalid base files.
Severity: HIGH
Suggested Fix
In fast check mode, ensure asset.PatchInfo is either verified or cleared so that UpdateCacheAsset falls back to a normal full download instead of attempting an unverified patch update.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: CollapseLauncher/Classes/CachesManagement/Honkai/Update.cs#L147-L157
Potential issue: When fast check mode is enabled (`UseFastMethod = true`), `CheckAsset`
skips calling `IsPatchExist`. As a result, candidate entries in `asset.PatchInfo` are
never validated against local files or trimmed to a verified match. When an asset needs
updating, `UpdateCacheAsset` attempts to process the patch route by arbitrarily taking
`PatchInfo?.FirstOrDefault()`. If that old candidate file does not exist on disk,
`File.Open` throws a `FileNotFoundException` and halts cache updates without falling
back to a full download. If the file exists but has different contents, the patch will
be applied to the wrong base file.
Also affects:
CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs:136~136
Did we get this right? 👍 / 👎 to inform future reviews.
| exceptionFromUnusedCategory.Add(combinedOldPath); | ||
| exceptionFromUnusedCategory.Add(combinedPatchPath); |
There was a problem hiding this comment.
Bug: HashSet<string> exceptionFromUnusedCategory is mutated concurrently without locking in Parallel.ForEachAsync, which can corrupt internal state or drop excluded paths.
Severity: MEDIUM
Suggested Fix
Protect exceptionFromUnusedCategory.Add with a lock or replace the HashSet<string> with a thread-safe collection such as ConcurrentBag<string> or ConcurrentDictionary<string, byte>.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs#L216-L217
Potential issue: During asset checking, `CheckAsset` is executed concurrently across
multiple threads in `Parallel.ForEachAsync`. Inside `CheckAsset`, `IsPatchExist` calls
`Add` on the shared `exceptionFromUnusedCategory` `HashSet<string>` without
synchronization. Because `HashSet<T>` is not thread-safe for concurrent writes, racing
operations can corrupt internal collection state or drop added paths, potentially
causing required patch or base files to be incorrectly flagged as unused and deleted by
`CheckUnusedAssets`.
Did we get this right? 👍 / 👎 to inform future reviews.
Main Goal
Migrate the runtime target and the dependency to .NET 11 and enable
runtime-asyncapp-wide.PR Status :
Templates
Changelog Prefixes