efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Baseline rewriter doesn't handle multiple baseline changes in a single file affecting the number of lines.

Open AndriySvyryd opened this issue 8 months ago • 8 comments

To repro delete all (multiline) baselines in a file and run the rewriter.

AndriySvyryd avatar Mar 20 '25 23:03 AndriySvyryd

@AndriySvyryd do you mean replace AssertSql("...") with empty ones? Or remove AssertSql altogether? Can you paste a quick example of what you mean?

roji avatar Mar 21 '25 07:03 roji

in my experience it was something like this which broke the rewriter.

    public override async Task Test1(bool async)
    {
        await base.Test1(async);

        AssertSql(
            """
TODO
""");
    }

    public override async Task Test2(bool async)
    {
        await base.Test2(async);

        AssertSql(
            """
TODO
""");
    }

    public override async Task Test3(bool async)
    {
        await base.Test3(async);

        AssertSql(
            """
TODO
""");
    }

(...)

maumar avatar Mar 21 '25 09:03 maumar

Ahahaha nobody from the team wants to submit a minimal repro 😂

roji avatar Mar 21 '25 11:03 roji

Had some troubles with the baseline rewriter myself. Has had a tendency to leave part of the last line (including the semi colon) of the original, on the line or the line after the new baseline

ChrisJollyAU avatar Mar 21 '25 12:03 ChrisJollyAU

Yeah, I've seen issues too - we should get rid of these as they reduce productivity... The best way forward here is to provide a repro; also, if anyone else is willing to take a look, I'm quite underwater at the moment.

roji avatar Mar 21 '25 16:03 roji

I did a couple quick attempts and couldn't reproduce this. Am putting in the backlog as we know there's a bug here - the moment someone runs into it, please make a commit with the code state that triggers the bug and share (or take a look at it if you can).

roji avatar Mar 24 '25 08:03 roji

From @cincuranet: apparently this commit causes a failure.

roji avatar May 19 '25 11:05 roji

From @cincuranet: apparently this commit causes a failure.

Still not able to repro... Maybe I'm running tests differently, or there's some environmental thing? Next time someone runs into this, please let's work together to repro it so I can fix it.

roji avatar May 23 '25 14:05 roji