Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__state is mapped by FullName instead of AssemblyQualifiedName #408

Closed
bwoebi opened this issue Jun 20, 2021 · 1 comment
Closed

__state is mapped by FullName instead of AssemblyQualifiedName #408

bwoebi opened this issue Jun 20, 2021 · 1 comment
Assignees

Comments

@bwoebi
Copy link

bwoebi commented Jun 20, 2021

Describe the bug

MethodPatcher uses the FullName to distinguish __state variables of individual patchers. This leads to patches in classes with the identical name (but defined in different assemblies) sharing a same __state, causing incompatibilites.

Mapping by AssemblyQualifiedName will fix this.

To Reproduce

Create a simple class with a Prefix and Postfix method, which each take a __state. Assign __state some class V { public int i = 0; } in Prefix. In Postfix increment and dump V.i.
Include the exact same class in another assembly, with the same name and namespace.
Then apply both patches to a method and run it.

Now, observe V.i being output once as 1 and once as 2.

Expected behavior

Both patches should dump 1, i.e. not be shared.

Runtime environment:

  • Harmony version: master
@pardeike
Copy link
Owner

pardeike commented Jul 5, 2021

Fixed in the upcoming 2.1 release

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

No branches or pull requests

2 participants