Skip to content

Refactor method access to use AccessTools for Harmony#19

Closed
twobit97 wants to merge 1 commit intodatvm:masterfrom
twobit97:patch-1
Closed

Refactor method access to use AccessTools for Harmony#19
twobit97 wants to merge 1 commit intodatvm:masterfrom
twobit97:patch-1

Conversation

@twobit97
Copy link
Copy Markdown

No description provided.

@datvm
Copy link
Copy Markdown
Owner

datvm commented Mar 30, 2026

Hi, what's the point of this PR? Surely typeof() is faster than using AccessTools to get the type since it's already known? Isn't it essentially the same?

@twobit97
Copy link
Copy Markdown
Author

Hi, what's the point of this PR? Surely typeof() is faster than using AccessTools to get the type since it's already known? Isn't it essentially the same?

The extension call .Method(...) relies on HarmonyLib.AccessToolsExtensions, and that was causing a crash on my setup. This change keeps the same target type and only changes how the method is resolved. The crash may be specific to my environment

@datvm
Copy link
Copy Markdown
Owner

datvm commented Mar 30, 2026

Do you have Beaver Buddies? I heard that they are incompatible with Harmony and I have seen stack trace like that when people had that mod. Anyway, if the extension method does not work, this will not either. It's calling the same method. When compiled by C# compiler, it will be the same.

image

@twobit97
Copy link
Copy Markdown
Author

Got it, thanks for clarifying. No, I don’t have Beaver Buddies installed. I’ll go through the mods I have and see what’s causing the issue, I'll close the request.

@twobit97 twobit97 closed this Mar 30, 2026
@datvm
Copy link
Copy Markdown
Owner

datvm commented Mar 30, 2026

Then it's because you have BepExIn. Which Timberborn no longer uses.

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