question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"PM> Install-Package MethodDecorator.Fody" doesn´t work but "PM> Install-Package MethodDecoratorEx.Fody" does.

See original GitHub issue

The nuget package MethodDecorator.Fody doesn´t work on compile, keeps complaining about the IMethodDecorator interface not being correct even after trying the folllowing:

public interface IMethodDecorator
{
    void Init(object instance, MethodBase method, object[] args);
    void OnEntry();
    void OnExit();
    void OnException(Exception exception);
}

and the older syntax

public interface IMethodDecorator
{
    void Init(object instance, MethodBase method, object[] args);
    void OnEntry(MethodBase method);
    void OnExit(MethodBase method);
    void OnException(MethodBase method, Exception exception);
}

I´ve tried defining the classes on root namespace and module register the attribute.

But got it working when i used the MethodDecoratorEx.Fody package instead:

[assembly: MethodDecorator]

public interface IMethodDecorator
{
    void Init(object instance, MethodBase method, object[] args);
    void OnEntry();
    void OnExit();
    void OnException(Exception exception);
}

I guess the MethodDecoratorEx.Fody package has to be updated

Now the real problem I would like to open an issue/contribute on it´s fork @alexeysuvorov fork ( i.e MethodDecoratorEx.Fody) but it seems not to allow this.

I know post sharp(and it´s price), but being a big Python(decorators) fan but a .NET developer i´ve always wanted C# to have such capabilities without the overly complex CQRS ICommandHandler pattern well explained by “Famous” Steven

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
benbenbenbenbenbencommented, Jan 17, 2016

Thanks for the info @ahmedalejo, I’ll keep an eye out for something easier. I don’t have a lot of time see. I did use postsharp when I wanted to do this sort of thing before but I’m trying to find an open source alternative.

0reactions
SimonCroppcommented, Aug 30, 2018

closing this as stale. please raise a new issue if this is still a problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use MethodDecorator.Fody Decorator in another ...
This works fine within the same project but when I use the decorator [LogMethod] in another method in another project, this OnEntry() ,...
Read more >
Recently Active 'fody' Questions
I'm trying to use fody with MethodDecorator on assembly level. ... package as follows Install package PM> Install-Package MethodDecorator.
Read more >
MethodDecorator.Fody 1.1.1
Fody add-in to decorate arbitrary methods to run code before and after invocation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found