Inherit patcher types - #39
Conversation
|
I'm cool with this change as long as it doesn't break existing or future pre-patchers. Meaning it would require some extensive testing. |
|
I've tested it with Arti's FourLeafClover mod and it works, I'm not sure what else there is to test. |
|
as relevant context heres why my upstream pr was denied for now |
|
Download the artifacts for this pull request: |
|
Well I've decided to do some testing, and I tried this setup: PatcherA.dll defines class which inherits BasePatcher This works, but if I rename PatcherA.dll to zzPatcherA.dll it stops working. There's no error message or anything in the log either. Here's a zip with the source code to both PatcherA and PatcherB and the compiled dlls that I used for this test: |
|
I mean isn't this just because PatcherB.dll references PatcherA.dll which now doesn't exist because you renamed it? |
|
oh maybe |
|
still no warning or error on that is not the best I Think |
|
Nothing in bepinex log? I'd think this would be a .NET thing not something I need to handle explicitly |
|
bepinex might be swallowing it somewhere, but nope, nothing at all in the log when the referenced assembly is missing. only thing relevant to patcher b when it's dependancy has been renamed is this: interestingly enough the patcher A still runs successfully even though it's been renamed. I haven't looked fully at the prepatcher stuff but do they put each dll in a separate load context? otherwise I think c#'s type resolution shuld find the types if they're already loaded in memory beforehand |
|
I don't think the load context would matter because it uses Cecil to get the DLL references I think |
This makes pre-patcher types be inherited which matches the behavior of plugin types.
Description
There is some difference between the way plugin types and patcher types are found in assemblies.
The plugin types will search with inheritance whereas the patcher types will not.
This PR makes the plugins and patchers use the same searching code essentially.
Current plugin searching code which this PR is based off:
BepisLoader/BepInEx.Core/Bootstrap/BaseChainloader.cs
Line 112 in 29e3aeb
BepisLoader/BepInEx.Core/Bootstrap/BaseChainloader.cs
Line 115 in 29e3aeb
Plugin attribute code which passes the third parameter to make it use inheritance:
BepisLoader/BepInEx.Core/Contract/Attributes.cs
Line 68 in 29e3aeb
Motivation and Context
I need this for my UniModFramework
How Has This Been Tested?
Tested by loading some pre-patchers and they seem to work.
Screenshots (if appropriate):
N/a
Types of changes
Checklist: