Skip to content

Fix failed registration of SyncWorkers for MultiplayerCompat#4509

Closed
perkinslr wants to merge 8 commits intoDevelopmentfrom
mpfix
Closed

Fix failed registration of SyncWorkers for MultiplayerCompat#4509
perkinslr wants to merge 8 commits intoDevelopmentfrom
mpfix

Conversation

@perkinslr
Copy link
Copy Markdown
Contributor

Changes

Use templated registration of sync workers.
Use nullable types.

References

Covers the first half of #4505

Reasoning

The new mono runtime included with Rimworld is stricter about argument type matching with automatic delegate construction. This entirely breaks automatic SyncWorker registration via the [SyncWorker] attribute, so we make that explicit.

Additionally, the multiplayer API and internal representation use nullable types for the comps, which implies the method might get called with the ref parameter holding a null. Enabling #nullable for that section ensures all accesses must be checked.

Alternatives

#4505 has a slightly alternative implementation, which explicitly passes the target type as an extra parameter. This is not required when using the templated version, but would be harmless to include. It also doesn't use nullable parameters.

Testing

Check tests you have performed:

  • Compiles without warnings
  • Game runs without errors
  • (For compatibility patches) ...with and without patched mod loaded
  • Playtested a colony (minutes)

@perkinslr perkinslr requested review from a team as code owners March 18, 2026 20:28
@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-23265505660.zip

@github-actions github-actions bot added the Download in Comments This PR has a zipfile download available. label Mar 18, 2026
@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-23266134629.zip

@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-23276884057.zip

@perkinslr perkinslr closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Download in Comments This PR has a zipfile download available.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant