Skip to content

Commit 94fcf4b

Browse files
committed
Fix Dapper generator encoding issue on macOS
1 parent 7b2b396 commit 94fcf4b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/StructId.Analyzer/DapperGenerator.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.Immutable;
33
using System.Linq;
4+
using System.Text;
45
using Microsoft.CodeAnalysis;
56
using Microsoft.CodeAnalysis.CSharp;
67
using Microsoft.CodeAnalysis.CSharp.Syntax;
8+
using Microsoft.CodeAnalysis.Text;
79
using Scriban;
810

911
namespace StructId;
@@ -139,7 +141,7 @@ void GenerateHandlers(SourceProductionContext context, ((ImmutableArray<StructId
139141
templatizedValues.Select(x => new ValueHandlerModelCode(x.ValueTypeFullName, x.AppliedTypeName, x.AppliedCode)));
140142

141143
var output = template.Render(model, member => member.Name);
142-
context.AddSource($"DapperExtensions.cs", output.Trim());
144+
context.AddSource("DapperExtensions.cs", SourceText.From(output.Trim(), Encoding.UTF8));
143145
}
144146

145147
public static string Render(string @namespace, string tself, string tvalue)

0 commit comments

Comments
 (0)