dotnet/android

Android `Resource` class triggers IDE002

bzd3y opened this issue · 2 comments

Description

This might not really be considered a bug and it also might not be the correct repository.

On the Android platform when using a constant on Resource the analyzer for IDE002 suggests a simplification to _Microsoft.Android.Resource.Designer.ResourceConstant, which seems like an internal name.

I understand I can just suppress the suggestion, but it seems off that suppressing or ignoring it would be necessary to access a built-in/supported API. IDE002 is actually suppressed on Resource where it inherits from _Microsoft.Android.Resource.Designer.ResourceConstant. That being generated code seems fine. But now we need to suppress that everywhere we use it?

But as I said, maybe this isn't the correct repository and the issue is more general, like that the IDE002 analyzer should ignore generated code or something like that?

As far as this being a regression, I did not see this before, but I think that is because this code was in a shared project, which might be another issues with the analyzer not reaching it while it was in that shared project.

Steps to Reproduce

Create a new MAUI .NET project and in Android platform code reference Resource.

Link to public reproduction project repository

No response

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Duplicate of #8381