You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the documentation for compile-time logging with source generation on https://docs.microsoft.com/en-us/dotnet/core/extensions/logger-message-generator yields an error if the file is using file scoped namespaces.
This will throw errors
namespace Foo;internalstaticpartialclassLog{[LoggerMessage(17, LogLevel.Debug,"Writing the requested range of bytes to the body.", EventName ="WritingRangeToBody")]publicstaticpartialvoidWritingRangeToBody(ILoggerlogger);}// error CS8795: Partial method 'Log.WritingRangeToBody(ILogger)' must have an implementation part because it has accessibility modifiers.// error CS0759: No defining declaration found for implementing declaration of partial method 'Log.WritingRangeToBody(ILogger)'
namespaceFoo{internalstaticpartialclassLog{[LoggerMessage(17, LogLevel.Debug,"Writing the requested range of bytes to the body.", EventName ="WritingRangeToBody")]publicstaticpartialvoidWritingRangeToBody(ILoggerlogger);}}// This works as expected
Issue description
Following the documentation for compile-time logging with source generation on
https://docs.microsoft.com/en-us/dotnet/core/extensions/logger-message-generator
yields an error if the file is using file scoped namespaces.This will throw errors
Target framework
dotnet --info output or About VS info
The text was updated successfully, but these errors were encountered: