LoggerMessage: Partial method Xxx must have an implementation part because it has accessibility modifiers
Hi,
(using Resharper 2022.2, VS 2022, Windows 11, all with latest updates )
Ever since I started using LoggerMessage (dotnet 6.0 and later), I started getting a lot of annoying Resharper warnings.
Even after building, rebuilding, ... they do not go away.
The first time the message is created (source generator is creating the message) it does not show, but on subsequent generations (not immediately with the next generation) it starts annoying me. The only way to get rid of them is going to the Resharper error view, and click away each warning (one by one or in group, which may hide a real error) and ignore them...
VS2022 or dotnet have no problem with the code whatsoever.
Example code (simplest, and fails):
public partial class Startup
{
private ILogger _logger;
[LoggerMessage(0, LogLevel.Information, "Using Redis")]
private partial void LogUsingRedis();
}
Please sign in to leave a comment.
Hi Dirk,
thank you for the report.
As I can see, you have already found an issue about it in YouTrack: https://youtrack.jetbrains.com/issue/RSRP-487423/Partial-method-with-LoggerMessage-attribute-shows-Warning
You can subscribe to this ticket to keep an eye on the progress.
Thank you!