Skip to content

Comments

Assembly loader#18

Merged
thygrrr merged 2 commits intomainfrom
assembly-loader
Feb 5, 2026
Merged

Assembly loader#18
thygrrr merged 2 commits intomainfrom
assembly-loader

Conversation

@thygrrr
Copy link
Contributor

@thygrrr thygrrr commented Feb 5, 2026

Contains fixes for the problem where referenced assemblies in tests are double-loaded (by Godot) or are loaded again but with a somewhat different context.

Fixes #17

Summary by CodeRabbit

  • Chores

    • Updated version to 0.1.16-pre
  • Bug Fixes

    • Enhanced assembly loading in test fixtures to prevent type identity conflicts across different assembly contexts
    • Game assemblies are now preloaded prior to Godot initialization in both standard and headless test fixtures, ensuring consistent behavior during test startup

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

This pull request introduces assembly preloading functionality to resolve type identity issues between the Default AssemblyLoadContext and Godot's PluginLoadContext. A new AssemblyPreloader utility discovers and preloads game assemblies before Godot initialization in both test fixtures, with version updated to 0.1.16-pre.

Changes

Cohort / File(s) Summary
Version Update
Directory.Build.props
Version property bumped from 0.1.15-pre to 0.1.16-pre.
Assembly Preloading Infrastructure
twodog.xunit/AssemblyPreloader.cs
New utility class providing public PreloadGameAssemblies(string projectPath) method to discover and preload game DLLs from .godot/mono/temp/bin directory into Default AssemblyLoadContext. Includes assembly filtering (excludes Godot/System assemblies) and exception handling with logging.
Fixture Integration
twodog.xunit/GodotFixture.cs, twodog.xunit/GodotHeadlessFixture.cs
Constructor modifications to invoke assembly preloading prior to Godot initialization, ensuring game assemblies load into Default context before engine startup.

Sequence Diagram

sequenceDiagram
    participant TestFramework as Test Framework
    participant Fixture as GodotFixture
    participant Preloader as AssemblyPreloader
    participant ALC as AssemblyLoadContext.Default
    participant Godot as Godot Engine

    TestFramework->>Fixture: Instantiate fixture
    Fixture->>Fixture: Gather assemblyDir
    Fixture->>Preloader: PreloadGameAssemblies(projectPath)
    Preloader->>Preloader: FindGameAssemblies()
    Preloader->>Preloader: Filter system/Godot assemblies
    Preloader->>ALC: Load filtered assemblies
    ALC-->>Preloader: Assemblies loaded
    Preloader-->>Fixture: Preloading complete
    Fixture->>Godot: Initialize Godot engine
    Godot->>Godot: Engine startup with assemblies in Default context
    Godot-->>TestFramework: Fixture ready
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Assemblies once wandered in contexts so lost,
Type castings would fail, oh what a cost!
But now we preload with care and with grace,
All game DLLs meet in the Default space.
No more identity crises, just harmony true—
The fixtures now share what the Godot engine knew! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Assembly loader' directly reflects the main change: introducing an AssemblyPreloader utility to preload game assemblies and avoid type-identity issues.
Linked Issues check ✅ Passed The PR implements assembly preloading to prevent type identity issues by loading game assemblies into the Default context before Godot initialization, directly addressing the root cause in issue #17.
Out of Scope Changes check ✅ Passed All changes are directly related to solving the assembly loading problem: new AssemblyPreloader utility, integration into fixtures, and version bump. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch assembly-loader

Comment @coderabbitai help to get the list of available commands and usage tips.

@thygrrr thygrrr merged commit 03731c5 into main Feb 5, 2026
7 checks passed
@thygrrr thygrrr deleted the assembly-loader branch February 5, 2026 21:10
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.

Test Referencing Game Assembly causes Type Identity Crisis

1 participant