Description
We started seeing this build error when we use dotnet publish to create our release-mode production builds:
Microsoft.Extensions.Configuration.Binder.SourceGeneration\Microsoft.Extensions.Configuration.Binder.SourceGeneration.ConfigurationBindingGenerator\BindingExtensions.g.cs(38,10): error CS9137: The 'interceptors' feature is not enabled in this namespace. Add '$(InterceptorsNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration' to your project.
Command looks like this:
dotnet publish src/PathToProject/Project.csproj `
-f net10.0-android `
-c Release `
-p:DevEnvironment=false `
-p:IsAndroidFastDeployment=false `
-p:RuntimeIdentifierOverride=android-arm64 `
-t:SignAndroidPackage `
-p:AndroidPackageFormat=apk `
-p:AndroidKeyStore=True `
-p:AndroidSigningKeyStore="$(keystoreFilePath)" `
-p:AndroidSigningStorePass="$(keystorePass)" `
-p:AndroidSigningKeyAlias="$(keystoreKeyAlias)" `
-p:AndroidSigningKeyPass="$(keystoreKeyPass)" `
-o $(Build.ArtifactStagingDirectory)/ReleaseAPK
We've added that InterceptorsNamespaces tag, but still see the error. We've been using the source generation from the MVVM in the Community Toolkit, but have not been explicitly using interceptors.
Steps to Reproduce
Not entirely sure there are easy repro steps.
Link to public reproduction project repository
Seen on private repo.
Version with bug
10.0.30
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
9.0.120 SR12
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
See comment below. Summary:
- Turn on interceptors
- Add a SourceGeneration namespace
- Turn off the configuration binding generator
Relevant log output
Description
We started seeing this build error when we use dotnet publish to create our release-mode production builds:
Microsoft.Extensions.Configuration.Binder.SourceGeneration\Microsoft.Extensions.Configuration.Binder.SourceGeneration.ConfigurationBindingGenerator\BindingExtensions.g.cs(38,10): error CS9137: The 'interceptors' feature is not enabled in this namespace. Add '$(InterceptorsNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration' to your project.
Command looks like this:
We've added that InterceptorsNamespaces tag, but still see the error. We've been using the source generation from the MVVM in the Community Toolkit, but have not been explicitly using interceptors.
Steps to Reproduce
Not entirely sure there are easy repro steps.
Link to public reproduction project repository
Seen on private repo.
Version with bug
10.0.30
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
9.0.120 SR12
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
See comment below. Summary:
Relevant log output