C#: Ensure that always use the same newline symbol for stub generation.

This commit is contained in:
Michael Nebel
2023-09-29 09:28:26 +02:00
parent e42741e8ed
commit 086588982e
2 changed files with 2 additions and 2 deletions

View File

@@ -68,7 +68,7 @@ public static class StubGenerator
var stubPath = FileUtils.NestPaths(logger, outputPath, path.Replace(".dll", ".cs"));
stubPaths.Add(stubPath);
using var fileStream = new FileStream(stubPath, FileMode.Create, FileAccess.Write);
using var writer = new StreamWriter(fileStream, new UTF8Encoding(false));
using var writer = new StreamWriter(fileStream, new UTF8Encoding(false)) { NewLine = "\n" };
var visitor = new StubVisitor(writer, relevantSymbol);

View File

@@ -61,7 +61,7 @@ public int M1(string arg1) => throw null;
var st = CSharpSyntaxTree.ParseText(source);
var compilation = CSharpCompilation.Create(null, new[] { st });
var sb = new StringBuilder();
var visitor = new StubVisitor(new StringWriter(sb), new RelevantSymbolStub());
var visitor = new StubVisitor(new StringWriter(sb) { NewLine = "\n" }, new RelevantSymbolStub());
compilation.GlobalNamespace.Accept(visitor);
return sb.ToString();
}