-
Notifications
You must be signed in to change notification settings - Fork 4.2k
CS9270 'InterceptsLocationAttribute(string, int, int)' is not supported when using Microsoft.Extensions.Configuration.Binder 8.0.x #76641
Copy link
Copy link
Closed
Description
Version Used: C# Tools 4.13.0-3.24620.4+98ea496177bc8e607dbf454abd6b5a5e4678aed2
Steps to Reproduce:
- Build https://github.com/dotnet/aspire/tree/main/src/Components/Aspire.Azure.AI.OpenAI using the latest Roslyn build
- or -
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
</ItemGroup>
</Project>using Microsoft.Extensions.Configuration;
public class Class1
{
public static void Bind(IConfiguration config)
{
var option = new Options();
config.Bind(option);
}
}
public class Options
{
public string? Name { get; set; }
}Diagnostic Id:
CS9270 'InterceptsLocationAttribute(string, int, int)' is not supported.
Expected Behavior:
The current Long-Term Supported version of Microsoft.Extensions.Configuration.Binder should be able to be used without warnings/errors.
Actual Behavior:
You get a warning (turned into an error in repos with warning-as-error):
Warning (active) CS9270 'InterceptsLocationAttribute(string, int, int)' is not supported. Move to 'InterceptableLocation'-based generation of these attributes instead. (https://github.com/dotnet/roslyn/issues/72133) ConsoleApp3 D:\source\ConsoleApp3\ConsoleApp3\obj\Debug\net9.0\Microsoft.Extensions.Configuration.Binder.SourceGeneration\Microsoft.Extensions.Configuration.Binder.SourceGeneration.ConfigurationBindingGenerator\BindingExtensions.g.cs 38
Reactions are currently unavailable