Skip to content

Migrate to .NET 11 - #930

Merged
neon-nyan merged 11 commits into
mainfrom
feat/net11-migration
Nov 14, 2026
Merged

neon-nyan merged 11 commits into
mainfrom
feat/net11-migration

Conversation

@neon-nyan

@neon-nyan neon-nyan commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Main Goal

Migrate the runtime target and the dependency to .NET 11 and enable runtime-async app-wide.

PR Status :

  • Overall Status : Done
  • Commits : Done
  • Synced to base (Collapse:main) : Yes
  • Build status : OK
  • Crashing : No
  • Bug found caused by PR : N/A

Templates

Changelog Prefixes
  **[New]**
  **[Imp]**
  **[Fix]**
  **[Loc]**
  **[Doc]**

@neon-nyan neon-nyan self-assigned this Nov 11, 2026
@neon-nyan neon-nyan added Enhancement New feature or request Area: Runtime Issue labeled for runtime, Hi3Helper.Core and other libraries used by Collapse Size: Medium labels Nov 11, 2026
@neon-nyan
neon-nyan marked this pull request as ready for review November 14, 2026 18:31
Comment on lines +147 to +157
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +216 to +217
exceptionFromUnusedCategory.Add(combinedOldPath);
exceptionFromUnusedCategory.Add(combinedPatchPath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@neon-nyan
neon-nyan merged commit 9b249a8 into main Nov 14, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Runtime Issue labeled for runtime, Hi3Helper.Core and other libraries used by Collapse Enhancement New feature or request Size: Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant