-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Same issue as #83392, but for the logging source generator rather than for the JSON source generator.
Repro:
- Create a new .NET Framework 4.8 console app.
- Add a nuget reference to the latest stable Microsoft.Extensions.Logging.Abstractions nuget package.
- Paste this code into your Program.cs, which is based on the docs for [LoggerMessage]:
using Microsoft.Extensions.Logging;
internal partial class Program
{
static void Main() { }
[LoggerMessage(
EventId = 0,
Level = LogLevel.Critical,
Message = "Could not open socket to `{hostName}`")]
static partial void CouldNotOpenSocket(ILogger logger, string hostName);
}- Compile. You'll get errors like this:
1>ConsoleApp7\Microsoft.Extensions.Logging.Generators\Microsoft.Extensions.Logging.Generators.LoggerMessageGenerator\LoggerMessage.g.cs(7,148,7,149): error CS8370: Feature 'nullable reference types' is not available in C# 7.3. Please use language version 8.0 or greater.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
To my knowledge, the only fix is to change your project's language version to something >= 8.0, which is officially an unsupported configuration.
Reactions are currently unavailable