Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net6.0-android generated sources StyleCop error #7698

Closed
mattleibow opened this issue Jan 13, 2023 · 2 comments
Closed

net6.0-android generated sources StyleCop error #7698

mattleibow opened this issue Jan 13, 2023 · 2 comments
Assignees
Labels
Area: Bindings Issues in Java Library Binding projects.
Milestone

Comments

@mattleibow
Copy link
Member


Issue moved from dotnet/maui#12638


From @dude3133 on Friday, January 13, 2023 3:25:04 PM

Description

Using StyleCop with rules Action="Error" produce unexpected compile errors from autogenerated code and used libraries
For example:
Using StyleCop.Analyzers.ruleset with:
<Rule Id="SA1505" Action="Error" />
Produces errors:

/Droid/obj/Debug/net6.0-android/generated/src/Java.Interop.__TypeRegistrations.cs(24,24): Error SA1505: An opening brace should not be followed by a blank line (SA1505)
/Droid/obj/Debug/net6.0-android/generated/src/Com.Android.Installreferrer.Commons.InstallReferrerCommons.cs(47,47): Error SA1505: An opening brace should not be followed by a blank line (SA1505)

StyleCop provide option with ignoring all errors and warnings using // <auto-generated/> comment. And I found one ticket that refers their logic to avoid generated code: DotNetAnalyzers/StyleCopAnalyzers#1430
Could we somehow add // <auto-generated/> comment for all generated code under obj/ folder?

Steps to Reproduce

  1. Create any net6-android project
  2. Add SonarCop with more rules (like SA1505, SA1507) as Error
  3. Try to build

Link to public reproduction project repository

Version with bug

6.0.312

Last version that worked well

6.0.312

Affected platforms

Android

Affected platform versions

Android Any

Did you find any workaround?

Remove SonarCop? Live without clean code? Nope

Relevant log output

No response

@ghost ghost added the needs-triage Issues that need to be assigned. label Jan 13, 2023
@jpobst jpobst self-assigned this Jan 13, 2023
@jpobst jpobst added Area: Bindings Issues in Java Library Binding projects. and removed needs-triage Issues that need to be assigned. labels Jan 13, 2023
@jpobst jpobst added this to the .NET 8 milestone Jan 13, 2023
@jpobst
Copy link
Contributor

jpobst commented Jan 13, 2023

This has been fixed for .NET 8:
dotnet/java-interop#1052

@jpobst jpobst closed this as completed Jan 13, 2023
@dude3133
Copy link

Wonderful. Now other issue, that libraries like Mvvm Cross not supporting .net 8 😄
Is there any workaround?

@ghost ghost locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Bindings Issues in Java Library Binding projects.
Projects
None yet
Development

No branches or pull requests

3 participants