Skip to content

LayoutBindings: 'PreserveAttribute' is obsolete warnings #7480

Description

@rgroenewoudt

Android application type

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

Affected platform version

VS2022 17.3.6

Description

We are using a lot of AndroidBoundLayout in our app but this results in 2 warnings per layout file:

warning CS0618: 'PreserveAttribute' is obsolete: 'Please use [System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute]'
[global::Android.Runtime.PreserveAttribute (Conditional=true)]
public AboutSequriX (
	global::Android.App.Activity client,
	global::Xamarin.Android.Design.OnLayoutItemNotFoundHandler itemNotFoundHandler = null)
		: base (client, itemNotFoundHandler)
{}

[global::Android.Runtime.PreserveAttribute (Conditional=true)]
public AboutSequriX (
	global::Android.Views.View client,
	global::Xamarin.Android.Design.OnLayoutItemNotFoundHandler itemNotFoundHandler = null)
		: base (client, itemNotFoundHandler)
{}

We would like to get to 0 build warnings :)

Steps to Reproduce

Did you find any workaround?

No response

Relevant log output

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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