Skip to content

Add support for a generation of a finalizer in the SyntaxGenerator #11938

@andriipatsula

Description

@andriipatsula

Methods with MethodKind.Destructor is not supported by the SyntaxGenerator.
Example:

class Object
{
    ~Object {}
}

Entry point: SyntaxGenerator.cs#L551

var method = (IMethodSymbol)symbol;
+if (method.MethodKind == MethodKind.Destructor)
+{
+    return DestructorDeclaration(method, method.Name);
+}

//...

+ private static SyntaxNode DestructorDeclaration(IMethodSymbol method, string name) {}

as a result, exception is thrown "Symbol cannot be converted to a declaration"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions