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

Intellisense doesn't work correctly with Faker #54

Closed
levipage opened this issue Jan 19, 2017 · 5 comments
Closed

Intellisense doesn't work correctly with Faker #54

levipage opened this issue Jan 19, 2017 · 5 comments

Comments

@levipage
Copy link

levipage commented Jan 19, 2017

Not sure if this a bug with Visual Studio or just something odd about how the library was setup. I have actually worked with Fluent Validation before and wrote something similar to it but have never seen this issue. It uses the same mechanics of multiple expressions.

If I start typing this...
.RuleFor(o => o.
It won't provide any intellisense for the member properties

Yet, if I type a comma after the 'o.' it will start showing member properties. The comma has to be there for it to work.
So... .RuleFor(o => o.,

After typing the comma, I can go back and hit the dot again to start seeing intellisense. My intellisense works fine with everything else. I have tried exiting Visual Studio, etc. It seems to not like something specific about this library.

@bchavez
Copy link
Owner

bchavez commented Jan 19, 2017

Hi @levipage,

Well, that's hella-annoying. Can you please file a connect bug with the people at Microsoft? Be sure to have them checkout Bogus v9.0.1. This indeed seems like an issue with Visual Studio's IntelliSense.

I suspect what's happening is Visual Studio can't figure out the type information yet when it's confronted with:

.RuleFor<TProperty>(Expression<Func<T, TProperty>> property, Func<Faker, T, TProperty> setter)
.RuleFor<TProperty>(Expression<Func<T, TProperty>> property, Func<Faker, TProperty> setter )
.RuleFor<TProperty>(Expression<Func<T, TProperty>> property, Func<TProperty> valueFunction)

Sooo, soon as you type , VS probably finally narrows down enough type information once the first argument to RuleFor is closed off with ,.

Who knows. I'm using Resharper's IntelliSense and Resharper does not have this problem. So it's most definitely Visual Studio.

I seem to have an API work around: Simply defining a dummy API call with only one Expression<Func<T,TProp>> seems kick Visual Studio IntelliSense into gear:

/// <summary>
/// Visual Studio IntelliSense Work Around. See Issue 54: https://github.com/bchavez/Bogus/issues/54
/// </summary>
[Obsolete("Visual Studio IntelliSense Work Around", true)]
public void RuleFor<TProperty>(Expression<Func<T, TProperty>> property)
{
    throw new NotImplementedException();
}

Releasing shortly. Thanks for bringing this to my attention and please don't forget to file this on Microsoft Connect. https://connect.microsoft.com/visualstudio

Thanks,
Brian


💨 🚶 "Bubbles of gas in my brain... Send me off balance, it's not enough"

@bchavez
Copy link
Owner

bchavez commented Jan 19, 2017

@levipage , can you please give Bogus v9.0.2 a try and see if it resolves your issue?

Please feel free to re-open the issue if the problem persists.

Thanks,
Brian

@levipage
Copy link
Author

Awesome support man. Impressive also that you were even able to make a workaround for the issue. It is working now!

@pr185193
Copy link

pr185193 commented Feb 9, 2023

why is this still not working? 2017? Why do I have to install some extra for VS Code to work?

@pr185193
Copy link

pr185193 commented Feb 9, 2023

Bogus is on version thirty something, do i just download the latest and restart VS Code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants