-
Notifications
You must be signed in to change notification settings - Fork 9
Description
I made just made a mistake in my PXGraphExtension hierarchy that led to me getting the new diagnostic error about a PXOverride signature mismatch. (Although I don't remember updating Acuminator recently, as I install it by building it locally ever since I first starting contributing, and I'm rather embarrassingly out of date)
To put it simply, my implementation was something like this :
// Acumatica's graph
public class APPaymentEntry : PXGraph<APPaymentEntry>
{
}
// Arbitrary extension 1 that adds a virtual method.
public class APPaymentEntryExtension1 : PXGraphExtension<APPaymentEntry>
{
public virtual void DoSomething()
{
}
}
// 2nd extension that I accidentally made extend itself due to lazily relying on VS autocomplete
public class APPaymentEntryExtension2 : PXGraphExtension<APPaymentEntryExtension2, APPaymentEntry>
{
public delegate void DoSomethingDel();
[PXOverride]
public virtual void DoSomething(DoSomethingDel del)
{
del();
// Arbitrary work
}
}In this case I got the error The signature of a method with the PXOverride attribute must match the overridden method
While it is a problem that I made my 2nd extension extend itself, which would've likely led to errors when loading Acumatica, and might be an idea for a new diagnostic in itself, it took me a few minutes of staring at all my code to realize what I did wrong.
I think it'd be a little more helpful if the analyzer in this case would say something like A method with this name was not found in the base graph or referenced graph extensions "APPaymentEntryExtension2". This would be a separate case from a signature mismatch.
The original error would still show if a method with that name was found, but like the error states, it'd show when there is a signature mismatch, just not when the signature is missing entirely.
However, I'm not sure how easy this would be, as I'm not sure if Acumatica supports PXOverriding methods from other extensions that aren't directly referenced in the extension list PXGraphExtension<...>.
I'm also not sure how this would pan out for generic classes, as I haven't looked into whether or not analyzers can (or do) resolve generic parameters.
For example :
public abstract class SomeGraphExtension<TGraph> : PXGraphExtension<TGraph>
where TGraph : PXGraph, new()
{
public virtual void SomeMethod()
{
}
}
public abstract class SomeGenericExtension1<TExtension1, TGraph> : PXGraphExtension<TExtension1, TGraph>
where TGraph : PXGraph, new()
where TExtension1 : SomeGraphExtension<TGraph>
{
}If this is not possible, feel free to close this issue, I was just hoping there'd be some way to help others more quickly resolve the mistake I made.