Git Product home page Git Product logo

Comments (1)

Zastai avatar Zastai commented on June 3, 2024

If you specify "object" as the parameter type, there still needs to be a trace of the actual object type in the assembly.
So the value there needs to be an instance of CustomAttributeArgument, specifying the actual type (here probably Int32) plus the value.

For future reference: if you want to know what you need to create, just compile something that includes it and look at how Cecil represents them. Then you know exactly what to create.

Note: for builtin types, it's easier(*) to go via TypeSystem; so module.TypeSystem.Object and module.TypeSystem.Int32.

(*) and also safer - otherwise you might accidentally emit a reference to the wrong type; if your code is running in net6.0 and you are working on a net472 assembly, importing a reference to typeof(object) may cause it to add a reference to the System.Runtime or System.Private.CoreLib instead of to mscorlib

from cecil.

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.