fluentassertions.analyzers
fluentassertions.analyzers copied to clipboard
InvalidOperationException during build
Description
In some of my projects I get the following error when building:
CSC : warning AD0001: Analyzer 'FluentAssertions.Analyzers.CollectionShouldHaveCountAnalyzer' threw an exception of type 'System.InvalidOperationException' with message 'This operation does not apply to an empty instance.'.
My guess is that the following IsEmpty
check should happen before Peek()
:
https://github.com/fluentassertions/fluentassertions.analyzers/blob/686a33bb1cd40ea01fffeea8d4ef85e481271d32/src/FluentAssertions.Analyzers/Utilities/FluentAssertionsCSharpSyntaxVisitor.cs#L74-L78
If you need me to provide more information, let me know how and I will see what I can do.
Versions
- FluentAssertions.Analyzers 0.11.3
- .NET Framework 4.6.1
can you provide a minimal code sample that will reproduce this error?
Unfortunately not, because I don't know what's causing this to happen. The Debug output is not very informative and only tells me what I copied above. How could I trace this down to see where the exception actually happens?
@FantasyTeddy just released 0.11.4
Unfortunately my guess was incorrect, I still have this exception in two of my projects with the new version...
Could you create a repository with your code?
Note: It seems that error message is only used for:
-
ImmutableQueue.Peek()
-
ImmutableQueue.PeekRef()
-
ImmutableStack.Peek()
-
ImmutableStack.PeekRef()
https://github.com/dotnet/corefx/search?q=InvalidEmptyOperation&unscoped_q=InvalidEmptyOperation
The code base I am working with is business code from our company which unfortunately cannot be made public. I can do some digging if you give me some hints how I can get more information about this exception.
I have the same issue, my repository is OS:
https://github.com/csoltenborn/GoogleTestAdapter
See build instructions in the Wiki...
@csoltenborn is this still an issue?
Sorry, can't comment on that - I moved on to different things...
Meir Blachman @.***> schrieb am So., 28. Mai 2023, 04:18:
@csoltenborn https://github.com/csoltenborn is this still an issue?
— Reply to this email directly, view it on GitHub https://github.com/fluentassertions/fluentassertions.analyzers/issues/78#issuecomment-1565686856, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACWCQDYMQDV6LZOIYAKJFTXIJVUDANCNFSM4FQGJHEQ . You are receiving this because you were mentioned.Message ID: @.*** com>