Description
Configuration Binding Source Generator is introduced by .NET8.0, and it works well in my web projects. I attempt to use this generator in my MAUI Blazor App by modifying the .csproj file like:
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
...
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
...
</PropertyGroup>
...
</Project>
It does function when targetting to net8.0-android, net8.0-ios, and net8.0-maccatalyst . However, a cs9137 error occurrs when set targetting to net8.0-windows10.0.19041.0. I followed the message and added <InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces> to project file, that error still occurrs.
Reproduction Steps
Add codes below in PropertyGroup:
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>
Here is my test project TestMauiBlazor.zip.
Expected behavior
The Configuration Binding Source Generator will generate codes, and the compiler will compile the codes successfully.
Actual behavior
The Configuration Binding Source Generator does generate codes. But the compiler throws a CS9137 error and messages " The 'interceptors' experimental feature is not enabled. Add <InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces> to your project. "
Regression?
No response
Known Workarounds
No response
Configuration
.NET SDK Version: 8.0.201
Operating System: Windows 10.0.22631 x64
maui-windows Version: 8.0.6/8.0.100
Other information
No response
Description
Configuration Binding Source Generator is introduced by .NET8.0, and it works well in my web projects. I attempt to use this generator in my MAUI Blazor App by modifying the .csproj file like:
It does function when targetting to net8.0-android, net8.0-ios, and net8.0-maccatalyst . However, a cs9137 error occurrs when set targetting to net8.0-windows10.0.19041.0. I followed the message and added
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>to project file, that error still occurrs.Reproduction Steps
Add codes below in PropertyGroup:
Here is my test project TestMauiBlazor.zip.
Expected behavior
The Configuration Binding Source Generator will generate codes, and the compiler will compile the codes successfully.
Actual behavior
The Configuration Binding Source Generator does generate codes. But the compiler throws a CS9137 error and messages " The 'interceptors' experimental feature is not enabled. Add
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>to your project. "Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response