-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Issue diagnostic warnings when custom JsonSerializerContext types don't indicate serializable types #58698
Comments
By the way, I want to be completely clear that I fully understand that a custom serializer context without any JsonSerializable is not a valid scenario. I am not saying that the code generator should accept this situation. However, I think that a better/more descriptive error message would be helpful and would allow developers to resolve the situation easily. |
Yes we can log a diagnostic error for this scenario.
Yes we log diagnostic errors for other scenarios, e.g. when a custom context class or one of its enclosing types is not |
How do I access this log? |
It's part of the error log shown during the build (visible both in command line & VS), just like the |
@layomia The reason I asked about a more detailed log is because So, let me rephrase my question: how can we find more detailed information when we get generic errors like CS0534? |
When you get A fix for this doesn't meet the bar to be ported to 6.0, so I'll move this issue to future. |
Up for grabs. #58768 attempted to fix this for 6.0 but we ran out of time. Note there'll be some perf testing to make sure we don't regress typing performance for large VS solutions. |
We also need to make sure this diagnostic doesn't trigger for classes that provide an explicit override for the |
Moving to future for now as we figure out a way to do this without compromising editor performance or triggering false positive diagnostics. |
When my custom serialiazer context class has zero JsonSerializable attributes, I get an error message which does not help me understand what the problem is.
I simply get the dreaded:
I do not get any additional information to help me realize that I forgot to add JsonSerializable attributes to my custom class. It would be extremely helpful to get an error message similar to
Your custom serializer context class must have at least one JsonSerializable attribute
.Repro:
As an aside: Is there a way to get more detailed information when something goes wrong with the code generator? Does it generate a log somewhere?
The text was updated successfully, but these errors were encountered: