Giter Club home page Giter Club logo

Comments (4)

ghorsington avatar ghorsington commented on September 21, 2024

Greetings!

Based on the stack trace, the issue is not related to HarmonyX, but rather BepInEx and how your plugin is set up.
I'll address the issue here, but next time please create issues related to BepInEx in BepInEx repo instead.

Since the error actually happens when your plugin is loaded, the problem is likely in your plugin project setup.
Monster Sanctuary is using normal .NET Framework -equivalent API (as evidenced by lack of netstandard.dll in game's _Data\Managed folder). BepInEx core DLLs themselves are built to support both .NET Standard and .NET Framework APIs, so it leaves only your plugin DLL.

Make sure your plugin is built targeting .NET Framework and not .NET Standard. This is well documented in BepInEx plugin development documentation.
In nutshell, check version of mscorlib.dll in game's Managed folder: if it's 4.0.0.0 or higher, you can usually target .NET Framework 4.6; in case of lower versions target .NET Framework 3.5. If you are unsure, targeting .NET Framework 3.5 is always a safe bet (although you won't get all available API and there can be problems with referencing some game DLLs).

Refer to the documentation of the development tools you use on how to change the target framework.

from harmonyx.

EvaisaDev avatar EvaisaDev commented on September 21, 2024

Ah I see, Thank you.
Sorry I assumed it was HarmonyX related because it happened when calling a HarmonyX function, just running a Debug.Log("test") inside of Awake() worked fine and printed to the BepInEx console so my assumption was that everything else was working fine.

from harmonyx.

ghorsington avatar ghorsington commented on September 21, 2024

Sorry I assumed it was HarmonyX related because it happened when calling a HarmonyX function

This most likely happened because when calling PatchAll, your assembly happened to reference some type that in .NET Standard is part of netstandard.dll which added the assembly as a dependency to your plugin DLL. Same will happen if you use something like StringBuilder API.

One way to check it is via tools like ilSpy or dnSpy which allow you to look at the contents of managed DLLs. Very likely your plugin DLL has the netstandard as one of references when using PatchAll which is indicative of plugin being built against .NET Standard API.

from harmonyx.

EvaisaDev avatar EvaisaDev commented on September 21, 2024

Yep it works now!
Thank you so much ❤️ Sorry again for posting in the wrong repo.

from harmonyx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.