Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 issue with partial namespace qualifiers

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
ajburgh Posted - Apr 07 2011 : 4:53:01 PM
I'm working on code where I constantly run into the following issue. The using directive specifies "System::Collections". The code contains variable declarations that use "Generic::List<String^>" etc. None of the VAssistX completions work on the variables. If the using is changed to "System::Collections::Generic" and the variable declarations to "List<String^>" it works. If the using is left unchanged and the full qualifying name for the variable declaration is used it also works ("System::Collections::Generic::List<String^>")

I'm using VAssistX Build 1842 on VS2010. The project references the following assemblies: System, System.Data, System.Core and System.XML.

Any ideas if I have a setting wrong or if this is a bug in VAssistX?

Abel

Code example (completion works in test2() not in test()):


using namespace System;
using namespace System::Collections;

void test()
{
	Generic::List<String^>^ listTest = gcnew Generic::List<String^>;
	Generic::IEnumerator<String^>^ itTest = listTest->GetEnumerator();

	while (itTest->MoveNext())
	{
		Console::WriteLine(itTest->Current);
	}
}

void test2()
{
	System::Collections::Generic::List<String^>^ listTest = gcnew System::Collections::Generic::List<String^>;
	System::Collections::Generic::IEnumerator<String^>^ itTest = listTest->GetEnumerator();

	while (itTest->MoveNext())
	{
		Console::WriteLine(itTest->Current);
	}
}
3   L A T E S T    R E P L I E S    (Newest First)
ajburgh Posted - Apr 08 2011 : 10:25:02 AM
Thanks for putting in the bug report accord.

And thanks for the suggested workaround feline. Unfortunately, adding

"using namespace System::Collections::Generic;" and removing all the "Generic::" qualifiers

without removing

"using namespace System::Collections;"

works for the name completion of VAssistX, but gives "ambiguous symbol" compiler errors on IEnumerator (and also SortedList that is not in the example) since those are defined in both System::Collections and System::Collections::Generic.

This is probably the reason the explicit "Generic::" was originally used since most likely a header file somewhere had a "using namespace System::Collection;" in it.

feline Posted - Apr 07 2011 : 11:01:34 PM
Adding a 3rd using statement:

using namespace System::Collections::Generic;

also helps for me, so this is another possible work around:

using namespace System;
using namespace System::Collections;
using namespace System::Collections::Generic;

void test3()
{
	List<String^>^ listTest3 = gcnew List<String^>;
	IEnumerator<String^>^ itTest3 = listTest3->GetEnumerator();

	// typing "->" after these two variables produces a listbox
	listTest3;
	itTest3;
}
accord Posted - Apr 07 2011 : 7:41:43 PM
I am seeing the same effect here. I have put in a bug report for this:

case=56604

Thank you for the clear description and the code snippet.

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