Using Metalama. how do you get the methods line number and include it in the stringbuilder

40 Views Asked by At

The subject says it all. Using OverrideMethodAspect.

I've been using Postsharp for many years and am trying to convert to Metalama.

1

There are 1 best solutions below

0
Gael Fraiteur On BEST ANSWER

In Metalama 2023.3 or later, you can do:

meta.Target.Declaration.Sources.SingleOrDefault( x => x.IsImplementationPart ).Span

The returned object gives you the file and line number.