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

The type initializer for 'HarmonyLib.AccessTools' threw an exception #275

Closed
CaledoniaProject opened this issue Mar 31, 2020 · 5 comments · Fixed by #283
Closed

The type initializer for 'HarmonyLib.AccessTools' threw an exception #275

CaledoniaProject opened this issue Mar 31, 2020 · 5 comments · Fixed by #283
Assignees

Comments

@CaledoniaProject
Copy link

I'm getting this exception while calling PatchAll:

System.TypeInitializationException: The type initializer for 'HarmonyLib.AccessTools' threw an exception. ---> System.TypeLoadException: Access is denied: 'MonoMod.Utils.Cil.ILGeneratorShim'. 

What does it mean?

@pardeike
Copy link
Owner

Can you complete your report with all the details about your environment and also which version of everything and a full stacktrace. Thanks.

@CaledoniaProject
Copy link
Author

Windows 2012 R2 + .NET 4.5.1

screen 2020-03-31 at 14 43 05

The target class is an internal class. With ILSpy I updated the IsPublic attribute to true, does it matter?

@pardeike
Copy link
Owner

No idea. Maybe @0x0ade can help a bit more

@CaledoniaProject
Copy link
Author

Tried manual patching, no difference

exception-manual

@boformer
Copy link
Contributor

This happened to me when I tried to use the Harmony nuget package from a blacnk .Net 3.5 console application

0x0ade added a commit to 0x0ade/Harmony that referenced this issue Apr 5, 2020
pardeike added a commit that referenced this issue Apr 5, 2020
Fix issue #275 - Update MMC and add missing InternalsVisibleTo
(this does break .NET 4.8 testing in AppVeyor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants