-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Compile-time logging source generation example triggers analyzer error "partial method must have an implementation part because it has accessibility modifiers" #27471
Comments
@maryamariyan can you help with this question? |
thanks will take a look |
You could use a pragma warning suppress to do this: https://docs.microsoft.com/dotnet/fundamentals/code-analysis/suppress-warnings#use-a-preprocessor-directive |
I did try the following but the error still came up #pragma warning disable CS8795 // Rethrow to preserve stack details Also the link to this doc produces an 404 |
FYI, this issue is tracked by #23900 |
I also get the CS8795 error for all methods. The project successfully compiles and works as expected but VS 2022 shows an error for every method. I'm not sure this is actually a doc error and not a VS 2022 issue? |
I experience this same issue. I've noticed this same issue with other source generator related code/libraries and it was solved in the same way. Note: I am using Visual Studio 17.1.1 |
I can too confirm that closing and opening the Visual Studio solved this issue for me. |
For what it's worth, I see this issue with Rider as well. I suspect it's not a Visual Studio issue specifically, but perhaps a Roslyn issue. (The same close and re-open workaround works with Rider) |
I have the same issue, but only when the solution builds on Linux. |
@maryamariyan I can't repro this in VS 2022 17.5, so it seems to have been at least partially addressed, just not in Linux per @RealDotNetDave. That being the case it seems not to be a docs issue -- should I transfer this issue to the runtime repo? |
ping @maryamariyan |
Seems fixed atm in 17.5.2 for me but was happening in 17.5.1 using dotnet 6. |
cc @dotnet/area-extensions-logging |
Thanks @maryamariyan. @RealDotNetDave are you still seeing this issue on Linux with the latest VS version? |
I can't reproduce the error in VS 17.5.2, either. I notice that the generated source (visible in Solution Explorer under Dependencies > Analyzers) updates almost immediately after editing the |
I'm still seeing this issue in 17.5.4. No amount of suppression makes it go away. I have NoWarn in my project. .serverity = none in .editorconfig. Like others, it'll go away for a little while then crop back up. I'm seeing it using the https://mapperly.riok.app/ library which uses heavy source generation. Edit: I'm not using Linux |
@layomia Given that it looks like this may still be an issue, is the runtime repo the right place to transfer this issue to? |
This looks the same issue dotnet/roslyn#58913 and supposes to be fixed a while ago by dotnet/roslyn#58990. @jasonmalinowski do you know why this still repro for the users? CC @Youssef1313 |
I'm happy to provide more details. Again, this is being triggered from a 3rd party library, which certainly is the underlying cause. However, I would expect to be able to suppress it in some way. |
This is roslyn-related issue. I see dotnet/roslyn#67123 which mentions:
So this seems very similar. |
Also there is dotnet/roslyn#65044 |
@tarekgh Can we close this as a duplicate of dotnet/roslyn#58913? It doesn't appear to be a doc issue. |
Yeah, this is a product bug, so I'm not sure why we'd document workarounds rather than, well, fixing it. |
@MrBildo was claiming the issue is still reported from a third-party library #27471 (comment). If this is not the case anymore then we can close. Otherwise, it will be good if @MrBildo provide a repo if the issue is still showing up. |
In the case of Mapperly, the library I was using, it is no longer an issue, nor have I seen it recently with other source generators. Something fixed it along the way. I no longer have an issue. Regardless it doesn't seem like a doc problem. |
Yep: if there's an issue here, the issue should be in the Roslyn repo as a bug, not a doc issue asking for a workaround. This can just be closed. |
When I write a class like the one in the example on this page,
the IDE flags it with an error:
However, the code compiles and executes successfully. Will you please add some guidance to this page about this error, especially if there is a way to silence it?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Associated WorkItem - 68965
The text was updated successfully, but these errors were encountered: