我有一个继承自 BaseViewModel 的 ConfigurationViewModel。BaseViewModel 放置在单独的项目中,并实现了 INotifyPropertyChanged 接口。这个单独的项目没有安装 Fody.PropertyChanged。
当我尝试构建解决方案时,我遇到了异常:
Failed to execute weaver C:\Users\Rafal\.nuget\packages\propertychanged.fody\2.6.0\build\..\netclassicweaver\PropertyChanged.Fody.dll
Type:
System.Exception
StackTrace:
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 186
at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 109
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Could not inject EventInvoker method on type 'Designer.VVM.ConfigurationViewModel'. 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 Designer.VVM.ConfigurationViewModel.
Type:
Fody.WeavingException
StackTrace:
at ModuleWeaver.InjectMethod(TypeDefinition targetType, InvokerTypes& invokerType)
at ModuleWeaver.AddOnPropertyChangedMethod(TypeDefinition targetType)
at ModuleWeaver.FindMethodsForNodes()
at ModuleWeaver.Execute()
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 182
Source:
PropertyChanged.Fody
TargetSite:
Mono.Cecil.MethodDefinition InjectMethod(Mono.Cecil.TypeDefinition, InvokerTypes ByRef)
当我将 BaseViewModel 移动到与 ConfigurationViewModel 相同的项目时,一切正常。
这是标准行为吗?它是一个错误吗?难道我做错了什么?如何在单独的项目中使用具有 BaseViewModel 的 Fody.PropertyChanged?