Skip to content

Fix cyclical dependency crash#113

Merged
PassivePicasso merged 1 commit into
PassivePicasso:masterfrom
risk-of-thunder:cyclical-dependency-fix
Dec 3, 2025
Merged

Fix cyclical dependency crash#113
PassivePicasso merged 1 commit into
PassivePicasso:masterfrom
risk-of-thunder:cyclical-dependency-fix

Conversation

@Nebby1999
Copy link
Copy Markdown
Contributor

Fixes an issue caused by packages having cyclical dependencies.

Issue was originally caused by the behaviour described in this screenshot:
image

Steps to reproduce the crash:

  1. Create a new unity project in version 2021.3.33f1
  2. Install ThunderKit
  3. Install the package "RoR2ImportExtensions" (latest version)
  4. Disable all the importer steps except for "Install BepInEx"
  5. Replace the method IEnumerable<PackageVersion> EnumerateDependencies(PackageVersion package, bool yield latestVersions) with this (It will force to download a version of RoR2BepInExPack with a cyclical dependency):
        IEnumerable<PackageVersion> EnumerateDependencies(PackageVersion package, bool yieldLatestVersions)
        {
            foreach (var dependency in package.dependencies)
            {
                string versionToUse = "latest";
                if(dependency.groupDependencyId == "RiskofThunder-RoR2BepInExPack")
                {
                    versionToUse = "1.37.0";
                }

                PackageGroup packageGroup = groupMap[dependency.groupDependencyId];
                var dep = yieldLatestVersions ? packageGroup[versionToUse] : dependency;

                foreach (var subDependency in EnumerateDependencies(dep, yieldLatestVersions))
                {
                    yield return subDependency;
                }
            }
            yield return package;
        }
  1. Run the importer
  2. The importer crashes due to a stack overflow exception during the dependency enumeration process.

@PassivePicasso PassivePicasso merged commit 47ef62b into PassivePicasso:master Dec 3, 2025
0 of 35 checks passed
PassivePicasso pushed a commit that referenced this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants