Skip to content

Commit

Permalink
Minor fixes to SQL baseline rewriter
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Dec 15, 2024
1 parent 3d40dc3 commit ca0a58c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ void RewriteSourceWithNewBaseline(string fileName, int lineNumber)
using (var stream = File.OpenRead(fileName))
using (var bufferedStream = new BufferedStream(stream))
{
syntaxTree = CSharpSyntaxTree.ParseText(SourceText.From(bufferedStream));
syntaxTree = CSharpSyntaxTree.ParseText(
SourceText.From(bufferedStream),
new CSharpParseOptions(preprocessorSymbols: ["DEBUG"]));
}

// Read through the source file, copying contents to a temp file (with the baseline change)
Expand Down Expand Up @@ -278,14 +280,13 @@ void RewriteSourceWithNewBaseline(string fileName, int lineNumber)
writer.Write(tempBuf, 0, c);
}
}

File.Move(fileName + ".tmp", fileName, overwrite: true);
}
catch
finally
{
File.Delete(fileName + ".tmp");
throw;
}

File.Move(fileName + ".tmp", fileName, overwrite: true);
}
}
}
Expand Down

0 comments on commit ca0a58c

Please sign in to comment.