[LogProperties(Transitive = true)] will result in generating uncompilable code, if object's property is of List<T> type.
Reproduction Steps
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace LoggerMessageCodeGen;
#pragma warning disable EXTEXP0003 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
internal partial class Program
{
static void Main(string[] args)
{
}
internal partial class Log
{
[LoggerMessage(EventId = 1, EventName = "Test", Level = LogLevel.Information)]
public static partial void Test(ILogger logger, [LogProperties(Transitive = true)] Test obj);
}
}
public sealed class Test
{
// This property will generate bad code when LogProperties.Transitive = true.
public List<string> Blah { get; set; }
}
Description
[LogProperties(Transitive = true)]
will result in generating uncompilable code, if object's property is ofList<T>
type.Reproduction Steps
Expected behavior
Generated code should be compilable.
Actual behavior
Generated code doesn't compile.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response