Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VA 2375: doesnt recognize Shouldly extensions

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Uniwares Posted - May 29 2020 : 11:36:27 AM
VA usually recognizes when a "using" is missing and suggests it, yet it doesnt seem to be able to recognize that Shouldly extension methods need a using too. Works fine though with Intellisense.

https://github.com/shouldly/shouldly
9   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 09 2020 : 09:20:26 AM
That's fair, I just wanted to make sure I understood enough of what was going on here to properly update the case. I have added this example, it is nice having an example that doesn't require a NuGet package, it just makes things that tiny bit more straight forward.
Uniwares Posted - Jun 08 2020 : 09:40:51 AM
VS "sometimes" does it automatically and sometimes only when invoking the intellisense (Ctrl+.) in either case, it "knows" that the using is missing.
feline Posted - Jun 08 2020 : 08:43:59 AM
On two different machines I am getting two different behaviours here. On one machine, when I type "ar." the listbox contains "Last", and when I accept this, the line:

using System.Linq;

is being added automatically to the top of the cs file. This is testing with VA completely disabled in the Extensions dialog, and VS2019 restarted to make sure this took effect.

On the second machine when I type "ar." the listbox does not contain "Last" at all.

Is the namespace actually being inserted automatically for you when accepting "Last" from the listbox, or are you seeing a different behaviour yet again?
Uniwares Posted - Jun 05 2020 : 11:37:17 AM
On .Last() VA should suggest "using System.Linq;" (as VS intelisense does) if its not yet included.
feline Posted - Jun 05 2020 : 11:19:57 AM
What should I be looking for? This is what I have just tested and seen:

void MethodCalledOnList()
{
    byte[] ar = { 0, 1, 2, 3 };
    // VS2019, trigger Alt-Shift-G on "Last" and Goto Member
    // lists 51 members of the class Enumerable
    byte n = ar.Last();
}
Uniwares Posted - Jun 05 2020 : 10:23:44 AM
Talking about something simpler like .ToArray() or .ToList() which apply to all sorts of collections.

like
new byte[] { 0,0,0,0}.ToList<byte>(); // ok, odd thing to do

or
byte[] ar = {0,1,2,3}; byte n = ar.Last();
feline Posted - Jun 05 2020 : 09:58:49 AM
What do you mean by .NET LINQ extensions? Trying to look this up left me at this page:

https://dotnettutorials.net/lesson/linq-extension-methods/

which left me with the sample code:

void LinqExtensionMethodOnList()
{
    List<int> intList = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    IEnumerable<int> EvenNumbers = Enumerable.Where(intList, n => n % 2 == 0);
}

which is a bit odd, but I can mostly see what is going on here. What I don't see is an obvious problem with VA not understanding this, so I assume you mean something else.
Uniwares Posted - Jun 05 2020 : 05:37:36 AM
As its now, VA doesnt even recognize .NET LINQ extensions.
feline Posted - Jun 04 2020 : 11:01:09 AM
Normally VA is working with a suggestion listbox when it notices and suggests that a using statement is required. Normally, after typing a dot, you are using a member listbox, not a suggestion listbox. I don't know if this is the full cause, but its probably a factor.

I have put in a feature request for this:

case=142328

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000