Open sandboxFocus

Class SafeSyntaxVisitor<T>

A derivation of CSharpSyntaxVisitor<TResult> that provides enhanced exception handling when visiting syntax nodes with a result value.

Inheritance
SafeSyntaxVisitor<T>
Namespace: Metalama.Framework.Engine.Utilities.Roslyn
Assembly: Metalama.Framework.Sdk.dll
Syntax
public abstract class SafeSyntaxVisitor<T> : CSharpSyntaxVisitor<T>
Type Parameters
Name Description
T

The type of value returned by the visitor methods.

Remarks

This class wraps exceptions thrown during node visitation with Metalama.Framework.Engine.Utilities.Roslyn.SyntaxProcessingException, which includes detailed information about the syntax node being processed when the exception occurred. This makes debugging weaver issues significantly easier.

Use this class instead of directly inheriting from CSharpSyntaxVisitor<TResult> in your aspect weaver implementations. Override VisitCore(SyntaxNode?) instead of Visit(SyntaxNode?) to add custom visiting logic.

Constructors

Name Description
SafeSyntaxVisitor()

Methods

Name Description
Visit(SyntaxNode?)
VisitCore(SyntaxNode?)

Extension Methods

See Also