-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Harmony AccessTools.MakeDeepCopy fails when target contains a constant or static readonly field #619
Comments
xADDBx
changed the title
Harmony AccessTools.MakeDeepCopy fails when target contains a constant field
Harmony AccessTools.MakeDeepCopy fails when target contains a constant field or static readonly
Aug 14, 2024
xADDBx
changed the title
Harmony AccessTools.MakeDeepCopy fails when target contains a constant field or static readonly
Harmony AccessTools.MakeDeepCopy fails when target contains a constant or static readonly field
Aug 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using AccessTools.MakeDeepCopy on a class which contains a constant field, Harmony will cause a
System.FieldAccessException: Cannot set a constant field
.To Reproduce
Expected behavior
Const fields should be ignored when creating a DeepCopy
Screenshots / Code
Runtime environment (please complete the following information):
OS:
Windows 10, 64bit.NET Version:
I've managed to reproduce this error in .NET Framework 4.8.1 (Unity and non-Unity runtime), .NET 6.0 and .NET 8.0. I assume it's an issue on all versionsHarmony Version:
Tested on Harmony 2.3.3 and Harmony 2.3.1.1.Runtime:
I've reproduced it in bothPathfinder: Wrath of the Righteous
andWarhammer 40,000: Rogue Trader
additionally I can reproduce this in a simple console applicationThe text was updated successfully, but these errors were encountered: