Giter Site home page Giter Site logo

Comments (2)

GregRos avatar GregRos commented on June 8, 2024

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.

awgil avatar awgil commented on June 8, 2024

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)

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.