Skip to content

Bindings from $(AndroidJavaSource) don't work with Intellisense #7692

@jpobst

Description

@jpobst

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

.NET 7, VS 2022 17.4. 17.5 P2

Description

.NET 7's $(AndroidJavaSource) is great for simplifying several binding tasks. However, while it compiles on a build, the .cs files it generates do not get added to the files used by IntelliSense, and thus trying to consume the bindings is difficult because they do not show up in IntelliSense dropdowns and show as errors in the editor.

image

Looking at a design time build, this appears to be because they are never added to @(Compile) which is used by <Csc>:
image

For comparison, it appears we add Resources.designer.cs to @(Compile) when $(ManagedDesignTimeBuild)' == 'True'.

https://github.com/xamarin/xamarin-android/blob/8c24b8ff0b32e198311b75e3bbce904989504f7c/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L1076

Steps to Reproduce

  1. dotnet new android
  2. Add a .java file to the project
  3. Attempt to consume the generated binding in the project

Minimal test case:
AndroidApp2.zip

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions