未验证 提交 09788526 编写于 作者: M msftbot[bot] 提交者: GitHub

Merge pull request #43842 from dotnet/fix_encoding_in_sg_cookbook

Add encoding to SourceText.From calls
......@@ -100,7 +100,7 @@ namespace GeneratedNamespace
// generated code
}
}
}"));
}", Encoding.UTF8));
}
}
```
......@@ -131,7 +131,7 @@ public class FileTransformGenerator : ISourceGenerator
// do some transforms based on the file context
string output = MyXmlToCSharpCompiler.Compile(content);
var sourceText = SourceText.From(output);
var sourceText = SourceText.From(output, Encoding.UTF8);
context.AddSource($"{file.Name}generated.cs", sourceText);
}
......@@ -193,7 +193,7 @@ public partial class {userClass.Identifier}
{{
// generated code
}}
}");
}", Encoding.UTF8);
context.AddSource("UserClass.Generated.cs", sourceText);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册