MC
Metalama CommunityXaniff
Set eligibility to not run against (built-in) methods of record classes or structs
I've figured out how to set up an
If
statement for the record types, but I cannot figure out how to end it - how can I ensure my OverrideMethodAspect doesn't actually apply to any methods that are attached to a record? Even better though - is there any way to have it not apply to any methods that aren't automatically a part of a record (e.g. don't apply to ToString or Equals, but do apply to MyCustomMethod without specifically calling such custom methods out)?
Thanks!Petr Onderka•298d ago
builder.If
is useful when you have a rule that you want to check only if some condition is true. E.g. something like:
Except this does not work correctly right now: https://github.com/postsharp/Metalama/issues/188.
But if you just want to exclude all methods on a record, you don't need If
:
If you only want to apply an aspect to methods that are declared in source code, you can use build.MustBeExplicitlyDeclared()
for that. Though that is already included for OverrideMethodAspect
(assuming you call base.BuildEligibility(builder);
).Want results from more Discord servers?
More PostsHow to specify an IMethod as the callback for an event?I'd like to specify an introduced method on a TypeAspect as the callback for an event handler.
1) WCreate NuGet with MetalamaWith source generators I have to add some MSBuild configuration, but with Metalama it seems I don't Override property with BuildAspectI create exceptions inheriting from Exception and putting the `[BusinessException]` attribute.
I waView diff in RiderI don't use Visual Studio, and overall, I don't have Windows. Is there any way to see the source gen