Skip to content

Register Attribute breaks build #10653

@ray-geberit

Description

@ray-geberit

RegisterException.zip

Android framework version

net10.0-android (Preview)

Affected platform version

VS 2026 18.1.1, .Net 10.0.1 (also 10.0.0)

Description

As soon as i set the "Register("ViewName") attribute to a View in .Net for Android, it breaks the build with an "InvalidOperationException" when i try to rebuild the project.

Image

Steps to Reproduce

  1. File -> New Android Project
  2. Create a CustomView that inherits from Android.Views.View --> building the project is fine
  3. Add the Attribute "Register("CustomView") to the class. --> building the project fails

With .net 9 this worked fine.

Did you find any workaround?

No, i didn't find a workaround

Relevant log output

System.InvalidOperationException: Missing required attribute 'package'
   at Java.Interop.Tools.JavaCallableWrappers.Extensions.XmlExtensions.GetRequiredAttribute(XElement xml, String name)
   at Java.Interop.Tools.JavaCallableWrappers.Adapters.XmlImporter.ImportType(XElement xml)
   at Java.Interop.Tools.JavaCallableWrappers.Adapters.XmlImporter.Import(XElement xml)
   at Xamarin.Android.Tasks.JavaObjectsXmlFile.Import(String filename, JavaObjectsXmlFileReadType readType)
   at Xamarin.Android.Tasks.GenerateJavaCallableWrappers.GenerateWrappers(List`1 assemblies)
   at Xamarin.Android.Tasks.GenerateJavaCallableWrappers.RunTask()
   at Microsoft.Android.Build.Tasks.AndroidTask.Execute()

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions