Skip to content

cs_loader: support stateful class instances#795

Open
G00dS0ul wants to merge 1 commit into
metacall:developfrom
G00dS0ul:feature/cs-stateful-loader
Open

cs_loader: support stateful class instances#795
G00dS0ul wants to merge 1 commit into
metacall:developfrom
G00dS0ul:feature/cs-stateful-loader

Conversation

@G00dS0ul
Copy link
Copy Markdown

Description

This PR completely modifies the C# loader's reflection logic to support instantiating and persisting non-static (stateful) classes from the host language

Type of change

  • Updated FunctionContainer.cs to hold TargetInstance state.
  • Modified LoaderBase.cs to dynamically instantiate classes before registering their methods
  • Fixed the static method bug where pure static classes were being ignored
  • Added fallback for classes without parameterless constructors
  • Added a dedicated xUnit test to validate reflection logic and state persistence across the bridge.

Note: This also lays the groundwork to issue #123. the logic is now modular enough that we can begin wrapping ProcessType inside CollectibleAssemblyLoadContext for proper unloading.

@viferga the loader can now list functions in a file and passing the tests.

@G00dS0ul G00dS0ul force-pushed the feature/cs-stateful-loader branch from e4c3d93 to fbb43a2 Compare May 28, 2026 12:39
@G00dS0ul G00dS0ul force-pushed the feature/cs-stateful-loader branch from fbb43a2 to 63e2543 Compare May 28, 2026 14:09
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.

1 participant