Closed gfraiteur closed 11 months ago
Hello @gfraiteur, thank you for submitting this issue. We will try to get back to you as soon as possible. Note to the PostSharp team, this ticket is being tracked in our dashboard under ID TP-33594.
Solved in 2023.3.1-preview. See IDeclaration.Sources
.
Where exactly can I see how to implement this great change?
There is no example, but in your case here is what you want:
var sourceSpan = method.Sources.SingleOrDefault ( s => s.IsImplementationPart )?.Span;
then use sourceSpan?.FilePath
, sourceSpan?.StartLine
, ...
See https://doc.metalama.net/api/metalama_framework_code_sourcereference.
In some scenarios like logging, it is useful to get the source file and line number. It could be exposed on the
IDeclaration
interface.