Xamarin.Forms
Xamarin.Forms copied to clipboard
SuppressLintAttribute not correct Error error: '.class' expected value = Mono.Cecil.CustomAttributeArgument[])
Description
Can't find info how properly use SuppressLint in Xamarin. There is just basic info on Microsoft sites. Official android documentation shows code for Java/Kotlin.
Steps to Reproduce
Add [SuppressLint(Value = new string[] {"Something"})]
attribute above some method.
Expected Behavior
Correctly adds @SuppressLint("Something") above a method.
Actual Behavior
Shows the error: Error error: '.class' expected value = Mono.Cecil.CustomAttributeArgument[])
And generated bundle looks lie this:
@android.annotation.SuppressLint(
value = Mono.Cecil.CustomAttributeArgument[]) // Error here
public int onStartCommand (android.content.Intent p0, int p1, int p2)
{
return n_onStartCommand (p0, p1, p2);
}
I tried to override the SuppressLintAttribute class and create a string property not an array, but it didn't add anything above my method in generated code. So it's useless.
Environment
VS 2022