0.6.9.0

On Sun, Aug 9, 2009 at 12:09 PM, Jb Evain <[email protected]> wrote:

>
> Hey,
>
> What version of Cecil are you using?
>
> On 8/9/09, Jorge Freitas Branco <[email protected]> wrote:
> > Hello again. From what I've seen here
> > http://evain.net/conf/Cecil-MonoMeeting07.pdf, there seems
> > to really exist a bug in cecil with attributes, as the following code
> does
> > not work:
> >
> > // asm is an AssemblyDefinition ...
> > foreach (CustomAttribute attribute in asm.CustomAttributes) {
> > Console.WriteLine (
> > attribute.Constructor.DeclaringType.Name);
> >  foreach (object p in attribute.ConstructorParameters) {
> > Console.WriteLine (“param: {0}”, p);
> > }
> > }
> > // AssemblyTitleAttribute
> > // param: Mono.Cecil
> > // AssemblyDescriptionAttribute
> > // param: Library for reading and writing CIL images
> >  // ...
> >
> > attribute.ConstructorParameters.Count seems to be always =
> > 0.
> >
> > Any help or comment?
> >
> >
> > On Fri, Aug 7, 2009 at 6:17 PM, Jorge Branco
> > <[email protected]> wrote:
> >
> > >
> > > Hello. I am using Cecil to try to read my attributes properties:
> > >
> > > [AttributeUsage(AttributeTargets.Method, AllowMultiple =
> > false,
> > > Inherited = false)]
> > > public sealed class TraceMethodAttribute : Attribute {
> > >    public TraceMethodAttribute() {
> > >        MethodStart = true;
> > >        MethodReturn = true;
> > >        MethodMessages = true;
> > >    }
> > >
> > >    public bool MethodStart { get; set; }
> > >    public bool MethodReturn { get; set; }
> > >    public bool MethodMessages { get; set; }
> > > }
> > >
> > > [TraceMethod(MethodMessages = false)]
> > > static void Main(string[] args) {
> > > }
> > >
> > > ...
> > >
> > > if (attribute.Constructor.DeclaringType.FullName ==
> > typeof
> > > (TraceMethodAttribute).FullName) {
> > >  if ((bool)attribute.Fields["MethodMessages"] == true) {
> > >        EditMethodStart(assembly, method);
> > >  }
> > >
> > > This is, I'd like this last block of code to check whenever the
> > > attribute applied to Main, for example, has MethodMessages set to true
> > > or false. From what I've seen, it seems like both
> > > attributes.Fields.Count and attributes.Properties.Count is set to 0.
> > > Why is it?
> > >
> > > Thanks
> > >
> > >
> >
> >
> >  >
> >
>
>
> --
> Jb Evain  <[email protected]>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to