Giter Site home page Giter Site logo

Comments (13)

aelij avatar aelij commented on August 22, 2024

It's already supported, as properties (and events) are included in the Methods property in Cecil (unlike Reflection).

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

Well, seems like it is not - I was trying to expose some properties on Avalonia DataGrid e.g. DataGrid.SlotCount (for read only) and it was not exposed without my modifications

    internal int SlotCount
    {
        get;
        private set;
    }

Neither many others - e.g. VisibleSlotCount or RowGroupHeadersTable or HorizontalScrollBar:

    internal IndexToValueTable<DataGridRowGroupInfo> RowGroupHeadersTable
    {
        get;
        private set;
    }

   internal ScrollBar HorizontalScrollBar => _hScrollBar;

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

I modified your project to add some functionality that I need and created a new repo while giving you the proper attribution. Please, take a look at DotNetBinaryAdjuster

from ignoresaccesscheckstogenerator.

weltkante avatar weltkante commented on August 22, 2024

It sounds like your fork is permanently patching assemblies, not just providing access to internals at compiletime while still running the original assembly at runtime?

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

It sounds like your fork is permanently patching assemblies, not just providing access to internals at compiletime while still running the original assembly at runtime?

To tell you the truth, I am not sure. It works for me and I thought I followed everything from IgnoresAccessChecksToGenerator. If you think I did something wrong, please, be specific - it could have easily happened since I do not know much about mono.cecil.

Thanks

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

It sounds like your fork is permanently patching assemblies, not just providing access to internals at compiletime while still running the original assembly at runtime?

I just realized - my attempt at virtualization did not work - the old method is still being called. I guess it is not as good as I hoped it would be.

from ignoresaccesscheckstogenerator.

weltkante avatar weltkante commented on August 22, 2024

I just realized - my attempt at virtualization did not work

Ye that was what I meant, things like that require permanent patching, since it affects runtime and not compile time.

Generally, turning private to public may not always work either, I've run into a lot of problems doing that on framework assemblies and given up on it eventually.

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

I just realized - my attempt at virtualization did not work

Ye that was what I meant, things like that require permanent patching, since it affects runtime and not compile time.

Any ideas or links on how to patch it permanently - e.g. create another dll and use it instead of the original one?

from ignoresaccesscheckstogenerator.

weltkante avatar weltkante commented on August 22, 2024

I just realized - my attempt at virtualization did not work

Ye that was what I meant, things like that require permanent patching, since it affects runtime and not compile time.

Any ideas or links on how to patch it permanently - e.g. create another dll and use it instead of the original one?

Well, you just do the same, use Mono.Cecil during build time to rewrite the assembly, but not just for the compiler input. Frameworks doing that exist but I never used them, check maybe https://stackoverflow.com/questions/189359/what-is-il-weaving for ideas on where to look.

Alternatively do it outside the buildchain and just do the occasional manual processing tool run to generate your modified version whenever your dependencies need to be updated. Can easily write a console tool to rewrite assemblies with Mono.Cecil.

Obviously need to check if licenses allow to distribute modified versions of third party code.

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

Thanks man, I work with Avalonia - which is open source under MIT license, so I do not expect any copyright problems
Eventually in order to avoid the weaving somersaults and jumping jacks, Avalonia will have to make its code a bit easier to modify it without resorting to extreme measures or completely re-writing its packages. I'll probably give them some ideas after being done with this exercise.

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

@weltkante , sorry, as I mentioned before I am pretty new to Cecil. It seems like the modified assembly is saved by the call to

assembly.Write(target);

But even if I use that saved assembly, it is not performing the override. What am I doing wrong? Perhaps you can recommend some websites where cecil is explained?

from ignoresaccesscheckstogenerator.

weltkante avatar weltkante commented on August 22, 2024

That should work, if it doesn't something went wrong with your modifications. Can't really recommend any guides since I just learned it by trial & error myself and reading code like this repo. What I'm usually doing is writing a console app that loads the assembly, modifies it, and writes it back under a different name - then use ilspy to verify my edits. If I need a reference to how something needs to look at the IL level I write a dummy c# project just doing the one thing I need to know how it looks and open the assembly in ILSpy, then replicate it in Mono.Cecil. Thats relly all there is to it as far as I'm concerned.

from ignoresaccesscheckstogenerator.

npolyak avatar npolyak commented on August 22, 2024

Thanks @weltkante !

from ignoresaccesscheckstogenerator.

Related Issues (15)

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.