Skip to content

Conversation

@SteveDunn
Copy link
Contributor

Fix for #103515

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 17, 2024
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should

writer.WriteLine($"if ({propValueExpr} != null)");
change to is not as well?

@eiriktsarpalis
Copy link
Member

Thanks. Would it be possible to a couple of regression tests for the change as well? The relevant test suite can be found here:

[Fact]
public static void NoErrorsWhenUsingIgnoredReservedCSharpKeywords()
{
string source = """
using System.Text.Json.Serialization;
namespace Test
{
[JsonSerializable(typeof(ClassWithPropertyNameThatIsAReservedKeyword))]
public partial class JsonContext : JsonSerializerContext { }
public class ClassWithPropertyNameThatIsAReservedKeyword
{
[JsonIgnore]
public string @event { get; set; }
}
}
""";
Compilation compilation = CompilationHelper.CreateCompilation(source);
CompilationHelper.RunJsonSourceGenerator(compilation);
}

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Text.Json community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants