You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.InvalidOperationException : Context: Source generator application
Context: Verifying source generated files
encoding of 'StructId.Analyzer\StructId.ParsableGenerator\UserId.parsable.cs' was expected to be '' but was 'utf-8'
This happens regardless of how the generator adds the file (as string content, as SourceText, with or without encoding).
Since the test set up cannot specify the encoding of the generated files, it seems it's impossible to have them match:
var test = new CSharpSourceGeneratorTest<ParsableGenerator, DefaultVerifier>
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net80,
TestState =
{
Sources =
{
"""
// ...
""",
},
GeneratedSources =
{
(@"StructId.Analyzer\StructId.ParsableGenerator\UserId.parsable.cs",
// 👇 how to specify encoding here??
"// expected file contents"
},
},
};
await test.RunAsync();
It's weird that two overloads that only differ in passing the generator type (or not), would default to different encodings:
File contents are indeed the same, but I get:
This happens regardless of how the generator adds the file (as string content, as SourceText, with or without encoding).
Since the test set up cannot specify the encoding of the generated files, it seems it's impossible to have them match:
It's weird that two overloads that only differ in passing the generator type (or not), would default to different encodings:
https://github.com/dotnet/roslyn-sdk/blob/main/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/SourceFileCollection.cs#L16-L25
The text was updated successfully, but these errors were encountered: