Comments (2)
Interesting. The reason it was supposed to work is described in GetBodySource
, though it's a bit arcane. The short reason is that I was trying to be clever.
The patching assembly has a reference to an unmodified copy of the target assembly, so resolving a reference to a thing from the patched assembly using the patching assembly should give you the definition of the thing from the original target assembly. So it shouldn't matter what modification is applied first, since we're not trying to get the body from the copy of the assembly being modified.
The process apparently doesn't work like I'd thought it did though, or maybe something else is going on.
It worked when I was worked on IE Mod and in some of my tests, but maybe I was just lucky.
I thought about doing things in a different order like you say, but it still introduced the possibility that the original method would be somehow changed by the steps before it, which might affect its body or something else.
More to the point, you can change the ordering by going to this file and ordering the thing being iterated over according to the attribute. You can use bool or int as the key. Something like this:
methodActions[typeof (ModifiesMemberAttribute), typeof (NewMemberAttribute)].OrderBy(x => KEY_OF(x))
I'm not sure if I'll be able to work on this library anytime soon. I don't even have a development environment set up for .NET nowadays. It's possible though, if I really feel like it. I'd love it if you made a pull request though.
from patchwork.
If I understood your proposal correctly, it is to have manually specified "priority" field in the attribute? While this is indeed more flexible, it would mean that one has to explicitly specify the priority in each case where method needs to be copied + modified, which is easy to forget. On the other hand, simple ordering "new always before modified" should cover the vast majority of required cases.
Anyway, I've created pull request with a simpler approach.
from patchwork.
Related Issues (18)
- How do you modify named constructors? HOT 17
- How do you modify readonly fields? HOT 6
- Encountered a feature that isn't supported. Details: MetadataType not supported: RequiredModifier HOT 2
- Improve error message when nested type isn't matched HOT 2
- Could not resolve a method reference, most likely because it wasn't imported HOT 8
- LaunchManager.Command_ChangeFolder shouldn't quit the application HOT 1
- TryConstructAttribute throws NullReferenceException while updating types HOT 7
- Feature Request: Support patching multiple assemblies HOT 1
- Patchwork problem with Generic/non-Generic method pair in source object HOT 4
- ArgumentOutOfRangeException while patching with multiple mods targeting different assemblies
- Feature Request: Keep the launcher open after patching
- Patch fails with "Internal message: The given key was not present in the dictionary."
- Patchwork Launcher Win11 doesnt Work
- Patchwork possibly losing method attributes that are non-patchwork related? HOT 5
- Unmatched Method Signature Gives Unhelpful Exception - Still happens HOT 2
- Support for multiple game executables. HOT 1
- Add support for arbitrary IL patching HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patchwork.