Closed
Description
When I write a class like the one in the example on this page,
public static partial class Log
{
[LoggerMessage(
EventId = 0,
Level = LogLevel.Critical,
Message = "Could not open socket to `{hostName}`")]
public static partial void CouldNotOpenSocket(
ILogger logger, string hostName);
}
the IDE flags it with an error:
Partial method 'void CouldNotOpenSocket(ILogger, string)' must have an implementation part because it has accessibility modifiers.
However, the code compiles and executes successfully. Will you please add some guidance to this page about this error, especially if there is a way to silence it?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 6fc4ecf0-19e4-54d3-c34e-b6eadb80262b
- Version Independent ID: decc74aa-a2d5-8727-f22b-3862bacde737
- Content: Compile-time logging source generation
- Content Source: docs/core/extensions/logger-message-generator.md
- Product: dotnet-fundamentals
- GitHub Login: @maryamariyan
- Microsoft Alias: maariyan