A derivation of CSharpSyntaxRewriter that provides enhanced exception handling and stack overflow protection when processing syntax nodes.
Namespace: Metalama.Framework.Engine.Utilities.Roslyn
Assembly: Metalama.Framework.Sdk.dll
Syntax
public abstract class SafeSyntaxRewriter : CSharpSyntaxRewriterRemarks
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 CSharpSyntaxRewriter in your aspect weaver implementations. Override VisitCore(SyntaxNode?) instead of Visit(SyntaxNode?) to add custom visiting logic.
Constructors
| Name | Description |
|---|---|
| SafeSyntaxRewriter(bool) |
Methods
| Name | Description |
|---|---|
| Visit(SyntaxNode?) | |
| VisitCore(SyntaxNode?) |