-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
CS0612 in generated code cannot be supressed in editorconfig #69298
Comments
Does it work to put [Mapper]
internal static partial class Mapper
{
[Obsolete]
public static partial Target MapToTarget(this Source source);
} |
Yes, the warning is gone. |
This issue is technically a duplicate of #47384 (.editorconfig does not apply to source generated files because source generated files are not considered part of the directory tree on disk). |
Also related to riok/mapperly#284 I believe the approach I would most recommend is having Riok.Mapperly emit a I couldn't find a pre-existing bug in https://github.com/riok/mapperly for this, so it would be good to file a feature request for it. |
Closing as the dupe |
@sharwell I‘m looking into the related Mapperly issue. I had in mind that compiler warnings are suppressed for generated files (with a |
Compiler warnings are not affected by an My recommendation for this issue is to suppress CS0618 only around specific property accesses, and not for the entire file. In addition, this should only occur if the user has explicitly used |
Duplicate of #47384 |
@sharwell thank you for these explanations, we'll look into it. |
An interesting approach that worked for me was to suppress all warnings in a |
Version Used: .NET 8 preview 6
Steps to Reproduce:
This code id generated by
Riok.Mapperly
Diagnostic Id: CS0612
Expected Behavior:
No CS0612 diagnostic is reported.
Actual Behavior:
A diagnostic
C:\Users\Hello\source\repos\ConsoleApp2\ConsoleApp2\Riok.Mapperly\Riok.Mapperly.MapperGenerator\Mapper.g.cs(7,21,7,30): warning CS0612: 'Source.Id' is obsolete
is reported.The text was updated successfully, but these errors were encountered: