Skip to content

CS9137 on net10.0-android release publish #34000

@jeremy-bridges

Description

@jeremy-bridges

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:

  1. Turn on interceptors
  2. Add a SourceGeneration namespace
  3. Turn off the configuration binding generator

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    t/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions