-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide locations for src-gen diagnostic output #61430
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json Issue DetailsContributes to #60314.
|
fd59059
to
1ac8c8d
Compare
src/libraries/System.Text.Json/gen/Reflection/ReflectionExtensions.cs
Outdated
Show resolved
Hide resolved
...on/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs
Outdated
Show resolved
Hide resolved
...on/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs
Outdated
Show resolved
Hide resolved
public static Location? GetDiagnosticLocation(this PropertyInfo propertyInfo) | ||
{ | ||
PropertyInfoWrapper? propertyInfoWrapper = propertyInfo as PropertyInfoWrapper; | ||
Debug.Assert(propertyInfoWrapper != null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this invariant is always true, it begs the question why we need all the System.Reflection
wrappers for Roslyn symbols. Not in scope for this PR, but in 7.0.0 I would recommend mapping roslyn symbols directly to sourcegen metadata to avoid abstraction leaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a few cases, we are able to share code between source-gen and reflection serializers since the symbols are expressed as reflection wrappers, e.g. the code in https://github.com/dotnet/runtime/blob/4cf86c2abfe9b2fad5ab2a48e4b0717ff0daf27a/src/libraries/System.Text.Json/Common/ReflectionExtensions.cs
...ies/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs
Outdated
Show resolved
Hide resolved
...on/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, other than a few issues needing attention.
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1463647226 |
@layomia backporting to release/6.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Provide locations for src-gen diagnostic output
Using index info to reconstruct a base tree...
M src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs
M src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs
M src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs
Auto-merging src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs
Auto-merging src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs
CONFLICT (content): Merge conflict in src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Provide locations for src-gen diagnostic output
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
Contributes to #60314. Next PR to fix the issue will be in dotnet/docs to provide more info on the docs website.