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

InvalidOperationException during build #78

Closed
FantasyTeddy opened this issue Aug 17, 2018 · 10 comments · Fixed by #80
Closed

InvalidOperationException during build #78

FantasyTeddy opened this issue Aug 17, 2018 · 10 comments · Fixed by #80
Labels

Comments

@FantasyTeddy
Copy link

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():

var member = Members.Peek();
if (Members.IsEmpty)
{
// no op
}

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
@Meir017 Meir017 added the bug label Aug 17, 2018
@Meir017
Copy link
Member

Meir017 commented Aug 17, 2018

can you provide a minimal code sample that will reproduce this error?

@FantasyTeddy
Copy link
Author

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?

@Meir017
Copy link
Member

Meir017 commented Aug 17, 2018

@FantasyTeddy just released 0.11.4

@FantasyTeddy
Copy link
Author

Unfortunately my guess was incorrect, I still have this exception in two of my projects with the new version...

@Meir017
Copy link
Member

Meir017 commented Aug 20, 2018

Could you create a repository with your code?

@jnyrup
Copy link
Member

jnyrup commented Aug 20, 2018

Note: It seems that error message is only used for:

@FantasyTeddy
Copy link
Author

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.

@Meir017 Meir017 reopened this Aug 25, 2018
@csoltenborn
Copy link

I have the same issue, my repository is OS:

https://github.com/csoltenborn/GoogleTestAdapter

See build instructions in the Wiki...

@Meir017
Copy link
Member

Meir017 commented May 27, 2023

@csoltenborn is this still an issue?

@csoltenborn
Copy link

csoltenborn commented May 28, 2023 via email

@Meir017 Meir017 closed this as completed May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants