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.

Could not inject EventInvoker method on type

See original GitHub issue

Fody.PropertyChanged version: 2.2.5

My solution compiles fine from both visual studio and visual studio for mac. It fails to compile, however, from Travis CI or from Appveyor CI.

The error message:

MSBUILD : error : Fody: Could not inject EventInvoker method on type ‘AGS.Engine.AGSButton’. It is possible you are inheriting from a base class and have not correctly set ‘EventInvokerNames’ or you are using a explicit PropertyChanged event and the event field is not visible to this instance. Either correct ‘EventInvokerNames’ or implement your own EventInvoker on this class. If you want to suppress this place a [DoNotNotifyAttribute] on AGS.Engine.AGSButton. [C:\projects\monoags\Source\Engine\AGS.Engine\AGS.Engine.csproj]

Complete log: https://ci.appveyor.com/project/tzachshabtay/monoags/build/1.0.522/job/v42a3fyq5djabjyf

My solution is here: https://github.com/tzachshabtay/MonoAGS

The AGSButton class can be seen here: https://github.com/tzachshabtay/MonoAGS/blob/master/Source/Engine/AGS.Engine/ComponentsFramework/Templates/AGSButton.generated.cs

It inherits from AGSEntity which does have a DoNotNotify attribute, and can be seen here: https://github.com/tzachshabtay/MonoAGS/blob/master/Source/Engine/AGS.Engine/ComponentsFramework/AGSEntity.cs

So it shouldn’t try to inject at all (and I don’t want to decorate AGSButton with DoNotNotify, I have a lot of inheritors from AGSEntity).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
powerdudecommented, Jun 1, 2018

I get this error when I have an object that inherits from ReactiveObject from the ReactiveUI library. I had to create the following class and use it instead:

public class MyReactiveObject : ReactiveObject
   {
      protected void RaisePropertyChanged(PropertyChangedEventArgs args)
       {
           ((IReactiveObject)this).RaisePropertyChanged( args);
       }
   }
1reaction
powerdudecommented, Jun 1, 2018

@ltrzesniewski that issue helped solve my problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fody.PropertyChanged - Could not inject EventInvoker ...
when the base View Model is in the same project, then the "OnPropertyChanged" method can be injected into that class.
Read more >
Avalonia controls inherit from INotifyPropertyChanged but ...
Could not inject EventInvoker method on type 'Cyclops.UI.Main.MainView'. It is possible you are inheriting from a base class and have not ...
Read more >
Fody - INotifyPropertyChanged the easy way
Let's talk about how to set this up. There are 3 simple steps. 1.Nuget. The first step is to add the nuget package....
Read more >
Crashing on 1.20.1 "Error: java.lang.RuntimeException ...
RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'architectury'!" This is a 1.20.1 modpack, and I've tried ...
Read more >
CA2109: Review visible event handlers (code analysis)
An event handler, a delegate type, that invokes the exposed method can be added to any event as long as the handler and...
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