Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 (C++) ToString() implementation not generated
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

amoldeshpande
Senior Member

USA
33 Posts

Posted - Oct 05 2020 :  2:23:37 PM  Show Profile  Reply with Quote
If I have a method named ToString() in my header file, I do not get an option to "Create Implementation" when I right click on the function name.


-versions--

Microsoft Visual Studio Community 2019
Version 16.7.5

Visual Assist 10.9.2382.0
For more information about Visual Assist, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c)1997-2020 Whole Tomato Software, LLC

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Oct 07 2020 :  07:37:10 AM  Show Profile  Reply with Quote
What is the return type of this function?

Does Create Implementation get offered, and work, on other members of this class?

Can you please copy and paste the following simple test class into your solution, placing the class into a .h file with a matching .cpp file, and see if Create Implementation is offered here for you? It is being offered, and works correctly for me here, so I am wondering if the problem is somehow related to your class or file, rather than the function name its self.

class simpleFelineTestClass
{
private:
	int m_nSimpleHeight;
	int m_nSimpleWidth;
public:
	std::string ToString();
};

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Oct 09 2020 :  12:06:46 PM  Show Profile  Reply with Quote
Ugh, sorry about not specifying that it's a UE4 project, so the type is FString. Other methods do work fine for generating implmentations.

Edited by - amoldeshpande on Oct 09 2020 12:07:06 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Oct 09 2020 :  2:50:20 PM  Show Profile  Reply with Quote
Which version of UE are you using?

What is the full signature of the ToString function? Does it have a UFUNCTION line, or any other macros attached to it?

If you place the caret into the function name "ToString" and press Alt-G what, if anything, happens? If VA believes that an implementation already exists for this function then it won't offer Create Implementation. In this case Alt-G should take you to what VA believes the implementation to be, if this is why the command is not being offered.

If you try copying this ToString declaration into a different class does this make any difference?

I have tried adding just the simple declaration:

FString ToString();

into a simple class:

UCLASS()
class CPPFIRSTPERSON_API AFelineCharacter : public ACharacter
{
    // ...
};

and Create Implementation is working correctly for me. So I am wondering if macros on the function, the class, or perhaps what is above, or even below the ToString declaration in the class could be a factor here.

They shouldn't be, but something is clearly different between your system and mine, but I am not quite sure where to look.

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Oct 11 2020 :  1:36:58 PM  Show Profile  Reply with Quote
I'm using 4.24. I'll keep an eye on this bug and repost with more information if it happens again.

There were no preexisting implementations or macros. It just stopped working.

I mis-stated a bit when I said right-clicking to Create Implementation. I usually hover over the function name to get the annoying menu that fights with Visual Studio's matching feature (The VS menu is the one with the brush). I prefer VaX's way of taking me to the cpp instead of the peek way in VS, but I wish there was a way to turn the VS version off.

Anyway, like I said, I will post with more info if it recurs.
thanks.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Oct 12 2020 :  05:08:10 AM  Show Profile  Reply with Quote
Have you had a look in the IDE settings? There are a lot of settings, so you may well be able to turn off the IDE feature that is getting in the way.

Another approach is to map the middle mouse button to VA's context menu:

https://support.wholetomato.com/default.asp?W643

For this bug, does this mean it seems a bit random?

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 26 2020 :  12:58:14 AM  Show Profile  Reply with Quote
Got this bug in a non-UE4 project. At the bottom of below header file, the ClearSlot function does not give me the option to create implementation.

Note that this is the entire extent of code in this project.


#pragma once
#include <string>
#include <unordered_map>
#include <memory>
#include <queue>


namespace FluidHTN
{

class TaskRoot;
class ICompoundTask;
class ITask;
class Slot;

//=====================================================================================
// Interface
class IDomain
{
protected:
    TaskRoot* Root;

public:
    const TaskRoot& GetRoot() { return *Root; }
    virtual bool    Add(const ICompoundTask& parent, const ITask& subtask) = 0;
    virtual bool    Add(const ICompoundTask& parent, const Slot& slot) = 0;
};
//=====================================================================================

//=====================================================================================
// Base class
using namespace FluidHTN::Compounds;
class IContext;
class Domain : public IDomain
{
protected:
    std::unordered_map<int, std::shared_ptr<Slot>> _slots;

public:
    Domain(const IContext& ctx, const std::string& name);

    virtual bool Add(const ICompoundTask& parent, const ITask& subtask) override;
    virtual bool Add(const ICompoundTask& parent, const Slot& slot) override;

    bool FindPlan(const IContext& ctx, std::queue<ITask>& plan);

    // ========================================================= SLOTS

    /// <summary>
    ///     At runtime, set a sub-domain to the slot with the given id.
    ///     This can be used with Smart Objects, to extend the behavior
    ///     of an agent at runtime.
    /// </summary>
    bool TrySetSlotDomain(int slotId, const Domain& subDomain);

    /// <summary>
    ///     At runtime, clear the sub-domain from the slot with the given id.
    ///     This can be used with Smart Objects, to extend the behavior
    ///     of an agent at runtime.
    /// </summary>
    void ClearSlot(int slotId);
};
//=====================================================================================

} // namespace FluidHTN










Had to reset my Visual Studio 2019 install and reinstall VaX due to unrelated VS frustrations. Not sure if that had any relevance.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Nov 26 2020 :  12:44:33 PM  Show Profile  Reply with Quote
Simply adding this code to a .h file here, with a matching .cpp file, Create Implementation is offered quite happily for me.

If you press Alt-O in this header file, I am assuming it is a header file due to the "#pragma once" at the top, what happens? Even if there is no matching cpp file, Create Implementation should still be offered, the implementation is simply placed into the header file.

The only reason for Create Implementation to be missing from this menu is that VA thinks that an implementation already exists. What happens if you place the caret into "ClearShot" and press Alt-G?

If you rebuild your VA symbol database, does this have any effect on this problem?

VA Options -> Performance -> Rebuild symbol databases

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 26 2020 :  1:15:20 PM  Show Profile  Reply with Quote
Yes, this is a header.

Alt-G does nothing. Rebuild Db does nothing.

Interestingly, I can see the VS "Create definition" dropdown on the side (not under the function when hovering)





Edit: I did add a cpp file after I posted this thread, so Alt-O takes me to the cpp.

Edited by - amoldeshpande on Nov 26 2020 1:16:43 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Nov 26 2020 :  1:40:57 PM  Show Profile  Reply with Quote
Would you be able to send me the solution where you are seeing this problem, along with your VA and IDE settings:

VA Options -> Performance -> Export Settings
IDE tools menu -> Import and Export Settings -> Export selected environment settings

I can then check the same code and solution you are using, and if that doesn't reproduce the problem, I can then import your settings and see if I can reproduce the problem then.

I really don't see what would be confusing VA with such a simple situation. So its possible I still won't be able to reproduce here, but if so, we know it is probably something machine specific, so we can then test that.

Please send me the files via email:

[email protected]

including this thread ID or URL in the description, so we can match it up.

zen is the art of being at one with the two'ness

Edited by - feline on Nov 26 2020 1:41:13 PM
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 26 2020 :  2:58:10 PM  Show Profile  Reply with Quote
sent. I've added some code since, but you can delete the new code and remove the implementation in the cpp to reproduce.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Nov 27 2020 :  11:45:23 AM  Show Profile  Reply with Quote
I have the solution and the settings, many thanks for this.

Unfortunately still no sign of the problem here. The code is simple, VA is not showing any signs of being confused, and once the implementation in the cpp file has been removed, VA is always happy to offer Create Implementation to me.

Since this problem happens on demand for you, this suggests the trigger lies in something about your system. You have changed the default location of your VA roaming data with the registry key "UserRoamingDataDir", but this should not matter.

It's also possible something is going on in your IDE profile that is a factor. If so, interaction with another extension would be my first guess.

To test this, Can you please close all instances of the IDE and then run the command:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe" /RootSuffix VATest

this will create and load a new, default profile for Visual Studio, so you will be asked which basic settings you want to use, and you should only have the standard, default IDE extensions installed. Visual Assist will not be installed into this profile, so you will need to go into the dialog:

IDE Extensions menu -> Manage Extensions

and install Visual Assist from the online extension store, to install VA for this test profile.

To load your normal, default profile just load the IDE normally. To return to this test profile again, pass the /RootSuffix command line switch when loading the IDE. You can run both profiles at the same time, next to each other, but this tends to get confusing, so is normally best avoided. If you export your IDE settings from your main profile you can them import them into the test profile.

If you load the small test solution you sent me inside this test profile, do you still see the problem?

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 27 2020 :  1:06:32 PM  Show Profile  Reply with Quote
no difference with new profile

Edit: I have no recollection of changing the roaming dir and it's not something I would normally do for any application. Is it exposed by VaX in settings ?





Edited by - amoldeshpande on Nov 27 2020 1:08:29 PM
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 27 2020 :  1:11:16 PM  Show Profile  Reply with Quote
just in case, here are my extensions in that profile





Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Nov 27 2020 :  1:18:37 PM  Show Profile  Reply with Quote
Sorry, yes, the setting is in the options dialog now:

VA Options -> Performance -> Use alternative directory for symbol database (requires restart)

since I imported your VA settings, I was thinking in terms of the registry, unnecessarily. Can you try turning this setting off to see if it makes any difference?

Did you realise the caret in your last screen shot is over "void" not the function name "ClearShot"?

I think showing the profile name like that must be a recent change in VS2019, I have not noticed that before, but it's rather helpful! That's definitely going to make things a bit easier going forward.

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 27 2020 :  1:23:08 PM  Show Profile  Reply with Quote
no difference.








Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Nov 28 2020 :  07:31:49 AM  Show Profile  Reply with Quote
There has to be a key difference at work here...

Can you post the full path of the SLN file and VCXPROJ you are using, in the small simple solution, along with your VA about information:

VA Options -> System Info -> Copy Info

I am wondering if somehow there is overlap between your stable include directories and the location of your solution.

If there is no overlap, is there anything "odd" about the location of your solution? Is it on a mapped network drive? A folder accessed via a file system junction or symbolic link?

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 28 2020 :  1:01:38 PM  Show Profile  Reply with Quote
path to the solution is H:\github\fluid-hierarchical-task-network


License: Non-renewable Personal () Support ends 2020.07.01
VA_X.dll file version 10.9.2382.0 built 2020.06.25
DevEnv.exe version 16.8.30717.126 Community
msenv.dll version 16.0.30717.112
Comctl32.dll version 6.10.19041.488
Windows 10 10.0 2004 Build 19041.572 
4 processors (x86-64, WOW64)
Language info: 1252, 0x409

Platform: Project defined
Stable Includes:
H:\github\vcpkg\installed\x64-windows-static\include;
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\Include\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\include;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\atlmfc\include;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include;

Other Includes:

Stable Source Directories:
C:\Program Files (x86)\Windows Kits\10\Source\10.0.19041.0\ucrt;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\src;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\crt\src;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\atlmfc\src\atl;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\atlmfc\src\mfcm;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\atlmfc\src\mfc;

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Nov 30 2020 :  07:14:34 AM  Show Profile  Reply with Quote
Can you try creating a test solution in a separate directory tree on H drive, maybe "H:\va_test\", just to make sure we don't have any overlap with the stable include directory:

H:\github\vcpkg\installed\x64-windows-static\include;

is H drive a local hard drive? A mapped network drive? Something else?

zen is the art of being at one with the two'ness
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Nov 30 2020 :  1:15:33 PM  Show Profile  Reply with Quote
I copied the folder to h:\ as well as another drive and it made no difference.

They're just local drives.
Go to Top of Page

amoldeshpande
Senior Member

USA
33 Posts

Posted - Dec 01 2020 :  12:12:55 PM  Show Profile  Reply with Quote
Don't know if should start a separate thread for this, but with the mixed C#/C++ solution I sent you Alt-G has a 90% chance of jumping to an implementation of a same-named method in the wrong language. Super annoying.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18702 Posts

Posted - Dec 01 2020 :  12:41:05 PM  Show Profile  Reply with Quote
Something odd is going on here. I have just emailed you a very simple solution, with a simple set of randomly named test cases in the file�"zshlxkhfdshfsfhswe.h"

I have added comments explaining what VA is offering and doing in this file.� Can you please try this solution on your system and see what results you get?

I have used random names for everything to try and make sure there is no overlap with any symbol names VA might have in its symbol database.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000