Closed fossbrandon closed 1 year ago
Yeah, I ran into it too, I think it happened when I bumped the minor version on one of the analyzer dependencies. I don't really know a good way to fix it. I assume fixing the version would result in the same error later on when somebody decides to use the library with a newer compiler version 🤔 I'll ask around.
Also I think the first error you posted (CS8784) is unrelated to CliFx
Do you by chance have any CS9057 warnings there as well? That's the one I can reliably reproduce with dotnet
CLI and Rider, so I wonder if your issue is connected to that one.
Do you by chance have any CS9057 warnings there as well? That's the one I can reliably reproduce with
dotnet
CLI and Rider, so I wonder if your issue is connected to that one.
I do not get any CS9057
warnings.
Also I think the first error you posted (CS8784) is unrelated to CliFx
I agree, but I either have all CS8032
warnings and the one CS8784
warning, or none of them. It might just be a byproduct of the other warnings I'm seeing.
New findings:
I ran into the same warnings today even when using 2.3.1
which worked for me yesterday. So, I reverted it back to 2.3.0
and I can rebuild using Visual Studio as many times as I want with no warnings. When I move it to 2.3.1
, the first rebuild succeeds with no warnings, but if I rebuild again, I get all the warnings back. The same pattern happens when I bump it back up to 2.3.2
where the first rebuild is fine and a follow up rebuild gives warnings. I'm not really sure what to make of this but figured I would mention it since my initial PR description is a bit out of date now.
I'm still not able to get the warnings using the CLI.
I opened another project of mine not using CliFx
and I'm encountering similar issues with other analyzers as well, so this seems like a me issue. I'll leave this issue open for a bit and update it if I find any fixes for myself, but I wouldn't worry too much about investigating it on your end for now.
I ran into the same warnings today even when using
2.3.1
which worked for me yesterday. So, I reverted it back to2.3.0
and I can rebuild using Visual Studio as many times as I want with no warnings. When I move it to2.3.1
, the first rebuild succeeds with no warnings, but if I rebuild again, I get all the warnings back. The same pattern happens when I bump it back up to2.3.2
where the first rebuild is fine and a follow up rebuild gives warnings. I'm not really sure what to make of this but figured I would mention it since my initial PR description is a bit out of date now.
Do the warnings also appear on 2.3.0
if you rebuild it twice? The warnings showing up every other time or so is a .NET issue, I think, and is not limited to analyzers. I'm not sure why exactly it happens (maybe some build cache preventing the warnings from triggering?).
Also, what version of the .NET SDK(s) do you have installed? Try to install the very latest version (.NET 8 preview) and see if it helps, out of curiosity. You don't have to change anything about your project, but if the issue is indeed related to Roslyn, then a newer SDK (which has newer Roslyn) might be able to resolve it. It may not be a permanent solution, but would help identify the issue more accurately.
I fixed an issue related to analyzers, which I think could be causing the problem you described. If it didn't help, please reopen the issue.
Here are my currently installed .NET SDKS:
> dotnet --list-sdks
6.0.311 [C:\Program Files\dotnet\sdk]
7.0.201 [C:\Program Files\dotnet\sdk]
7.0.203 [C:\Program Files\dotnet\sdk]
I have not tried 2.3.1
or 2.3.2
with the .NET 8
preview since I'm not currently setup with the preview Visual Studio
version. If I find the time soon, I'll try to get that setup and see if the newer SDK removes the warnings.
However, the new 2.3.3
release with my current SDKs and Visual Studio v17.5.4
no longer shows all the warnings I was seeing. I hate to see downgraded analyzers, but it does fix my current problems which may or may not be Visual Studio specific errors.
Thanks for updating the package so fast!
However, the new
2.3.3
release with my current SDKs andVisual Studio v17.5.4
no longer shows all the warnings I was seeing. I hate to see downgraded analyzers, but it does fix my current problems which may or may not be Visual Studio specific errors.
The main issue was that I recently added some checks for parameters/options bound to required
properties. Because this language feature was added in C# 11 (.NET 7 SDK), I had to upgrade the analyzers to target the corresponding version of Roslyn. Then, in version 2.3.2
I bumped the version of Roslyn further by 1 minor (from 3.4.0
to 3.5.0
) and, unbeknownst to me, it pushed the target from .NET 7 SDK to .NET 8 SDK.
In the latest version, I've downgraded the targeted version of Roslyn to 3.0.0
to cover even older SDK versions, and implemented the required
keyword check myself in a slightly more elaborate way, without relying on newer Roslyn APIs. This is a bit hacky, but it's the easiest solution.
The correct way to handle this is to actually build an analyzer that multi-targets different Roslyn versions and provides checks based on available capabilities. But doing that is incredibly cumbersome right now and requires far more effort than the alternative. It's disappointing, but it seems that Microsoft doesn't see much point in investing into authoring experience of Roslyn extensions, because they consider it a scenario that's "too advanced".
Version
2.3.2
Details
Hi there, about a year ago I ran into a similar issue to this that you were able to resolve in #127 .
In version 2.3.2 of CliFx, I get hundreds of
CS8032
warnings when I build my project withinVisual Studio
. The only nonCS8032
warning I get isCS8784
.Examples of the some of the errors:
Notes:
Visual Studio
, delete the.vs
folder, reopen, and then rebuild but it results in the same warningsVisual Studio
CliFx
package to version to version2.3.1
, all the warnings go awaySteps to reproduce
Visual Studio
using version2.3.2
Visual Studio
, rebuild the solutionCS8032
warnings