This project is read-only.
1

Resolved

Lambda statement simplification stuck VS

description

Hi.

I'm trying to rewrite a code and create a method that returns a lambda. Then, I want to simplify and format the code before adding it to the document.

Everything works great. However, from the minute I've added the lambda, the Simplifier makes VS not responding and I have to stop the debug session. I know that this is the simplifier since when I'm removing the Simplifier.Annotation attribute the code works perfect (in addition to breakpoint debugging).

I thought that this is part of my code, but even when returning something like
        return SyntaxFactory.MethodDeclaration(
            SyntaxFactory.ParseTypeName("bool"), "Foo"
            ).WithBody(SyntaxFactory.Block(SyntaxFactory.ReturnStatement(
                SyntaxFactory.ParenthesizedLambdaExpression(SyntaxFactory.Block())
                ))).WithAdditionalAnnotations(Formatter.Annotation, Simplifier.Annotation);
The VS stop responding.

I'm adding the method using:
        //  Update the solution
        var root = await document.GetSyntaxRootAsync(cancellationToken);

        //  Insert
        document = document.WithSyntaxRoot(root.InsertNodesBefore(methodDecl, new[] { methodDecl }));

        //  Format
        document = await Formatter.FormatAsync(document, Formatter.Annotation, cancellationToken: cancellationToken).ConfigureAwait(false);
        document = await Simplifier.ReduceAsync(document, Simplifier.Annotation, cancellationToken: cancellationToken).ConfigureAwait(false);

        return document;
Any help would be very appreciate!

comments

srivatsn wrote Jul 30, 2014 at 12:37 AM

Manish, can you please take a look?

manishv wrote Aug 7, 2014 at 6:30 PM

This issue has now been fixed.