A derivation of CSharpSyntaxWalker that provides enhanced exception handling and stack overflow protection when walking syntax nodes.
Namespace: Metalama.Framework.Engine.Utilities.Roslyn
Assembly: Metalama.Framework.Sdk.dll
Syntax
public abstract class SafeSyntaxWalker : CSharpSyntaxWalkerRemarks
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.
It also includes a recursion guard to prevent InsufficientExecutionStackException when processing deeply nested syntax trees.
Use this class instead of directly inheriting from CSharpSyntaxWalker in your aspect weaver implementations. Override VisitCore(SyntaxNode?) instead of Visit(SyntaxNode?) to add custom visiting logic.
Constructors
| Name | Description |
|---|---|
| SafeSyntaxWalker(SyntaxWalkerDepth) |
Methods
| Name | Description |
|---|---|
| Visit(SyntaxNode?) | |
| VisitCore(SyntaxNode?) |