Skip to content

System.Text.JSon Source Generator Diagnostic in the error list doesnt link me to docs or navigate me to the file where the issue is #60314

@mikadumont

Description

@mikadumont

Description

I am using the System.Text.JSon Source Generator and am getting the following warning in my error list:

image

This analyzer doesn't follow the analyzer guidelines for it doesnt navigate me to the file where the issue is or link me to docs to understand the issue better. Also should the severity be a warning or a suggestion? Anything that will be a warning or error should go through an analyzer review but let me know your thoughts. @jeffhandley @layomia

Reproduction Steps

I am on Version 17.0.0 Preview 5.0 [31807.358.d17.0]

I am using the following code:

using System.Text.Json;
using System.Text.Json.Serialization;

namespace SolarSystem;

internal record Astronomer(string FirstName, string LastName, string? MiddleName = null);

[JsonSerializable(typeof(Astronomer))]
internal partial class AstronomerJsonContext : JsonSerializerContext
{
}

class Program
{
    static void Main(string[] args)
    {
        var astronomer = new Astronomer(FirstName: "Jane", LastName: "Doe");

        string json = JsonSerializer.Serialize(astronomer, AstronomerJsonContext.Default.Astronomer);
    }
}

And I get the following warning in my error list but clicking on the warning doesnt navigate me to where the warning is coming from. Also the analyzer ID link doenst link me to docs.

image

Expected behavior

I am using the following code:

using System.Text.Json;
using System.Text.Json.Serialization;

namespace SolarSystem;

internal record Astronomer(string FirstName, string LastName, string? MiddleName = null);

[JsonSerializable(typeof(Astronomer))]
internal partial class AstronomerJsonContext : JsonSerializerContext
{
}

class Program
{
    static void Main(string[] args)
    {
        var astronomer = new Astronomer(FirstName: "Jane", LastName: "Doe");

        string json = JsonSerializer.Serialize(astronomer, AstronomerJsonContext.Default.Astronomer);
    }
}

And I get the following warning in my error list but clicking on the warning doesnt navigate me to where the warning is coming from. Also the analyzer ID link doenst link me to docs.

image

I would expect clicking on the warning in the error list will navigate me to where the warning is and the clicking on the ID link will take me to docs to understand what the warning is.

Actual behavior

I am using the following code:

using System.Text.Json;
using System.Text.Json.Serialization;

namespace SolarSystem;

internal record Astronomer(string FirstName, string LastName, string? MiddleName = null);

[JsonSerializable(typeof(Astronomer))]
internal partial class AstronomerJsonContext : JsonSerializerContext
{
}

class Program
{
    static void Main(string[] args)
    {
        var astronomer = new Astronomer(FirstName: "Jane", LastName: "Doe");

        string json = JsonSerializer.Serialize(astronomer, AstronomerJsonContext.Default.Astronomer);
    }
}

And I get the following warning in my error list but clicking on the warning doesnt navigate me to where the warning is coming from. Also the analyzer ID link doenst link me to docs.

image

Metadata

Metadata

Assignees

Labels

area-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additions

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions