Author |
Topic |
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 21 2024 : 10:55:35 AM
|
This is the demo code i am using
#include <iostream>
class MyClass
{
public:
MyClass();
~MyClass();
void getInt();
private:
};
MyClass::MyClass()
{
}
MyClass::~MyClass()
{
}
void MyClass::getInt()
{
}
int main() {
auto intPtr = std::make_unique<MyClass>();
intPtr->getInt();
}
These are the suggestion settings that i am using
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 21 2024 : 1:07:19 PM
|
Odd. I am seeing the same effect here, and trying to understand why. So far it seems to be limited to std::make_unique which is something.
Does a valid listbox appear when you press CTRL-SPACE? It does for me. |
zen is the art of being at one with the two'ness |
|
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 21 2024 : 1:41:32 PM
|
quote: Originally posted by feline
Odd. I am seeing the same effect here, and trying to understand why. So far it seems to be limited to std::make_unique which is something.
Does a valid listbox appear when you press CTRL-SPACE? It does for me.
No, the only time i get a suggestion box is when i activate Default intellisense
But this again only shows the object suggestion and not the pointer functions unless i write -> myself
Apparently the issue persist even when using make_shared
Raw pointer seem to work properly and have no problems when using auto
Not using auto for smart pointers apparently solves the issue for me but this is not a long term solution.
I have also noticed that the same issue happens in unreal engine too when using their own smart pointers.
This is using TObjectPtr
This is using a raw pointer
|
- Capmare David Nicusor - MallocStar |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 22 2024 : 09:03:02 AM
|
Thank you for the details. This suggests VA isn't working out the return type of "std::make_unique" as you have probably worked out. I am aware we have run into some problems with "std::make_unique" before, but the problem with TObjectPtr is a completely new one for me.
I am looking into the make_unique and make_shared problem now.
For "TObjectPtr", using VS2022, VA 2530 and UE 5.2, I have set up the following very simple test case. In a header file I have the following struct:
struct simpleDateTypeForPointer
{
short nCharHeight;
short nCharWeight;
bool bWearingHat;
bool bCarryingSword;
};
and in the cpp file I am using it like this:
TObjectPtr<simpleDateTypeForPointer> localTPtr;
localTPtr;
typing the dot after "localTPtr", the dot is automatically converted to -> for me, and I automatically get a listbox appear.
I have just tried disabling IDE intellisense via:
IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> Disable Database = True
and restarting VS2022. No change in how VA handles this code. A quite Find in Files for TObjectPtr is showing plenty of usage like this, suggesting this is reasonable code to write. But is this what you are doing in UE? If so, which version of UE are you using? |
zen is the art of being at one with the two'ness |
|
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 22 2024 : 10:30:02 AM
|
quote: Originally posted by feline
Thank you for the details. This suggests VA isn't working out the return type of "std::make_unique" as you have probably worked out. I am aware we have run into some problems with "std::make_unique" before, but the problem with TObjectPtr is a completely new one for me.
I am looking into the make_unique and make_shared problem now.
For "TObjectPtr", using VS2022, VA 2530 and UE 5.2, I have set up the following very simple test case. In a header file I have the following struct:
struct simpleDateTypeForPointer
{
short nCharHeight;
short nCharWeight;
bool bWearingHat;
bool bCarryingSword;
};
and in the cpp file I am using it like this:
TObjectPtr<simpleDateTypeForPointer> localTPtr;
localTPtr;
typing the dot after "localTPtr", the dot is automatically converted to -> for me, and I automatically get a listbox appear.
I have just tried disabling IDE intellisense via:
IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> Disable Database = True
and restarting VS2022. No change in how VA handles this code. A quite Find in Files for TObjectPtr is showing plenty of usage like this, suggesting this is reasonable code to write. But is this what you are doing in UE? If so, which version of UE are you using?
I have tested the same code snippet as you but it seems to still not work. I m usually using Unreal 5.3, but i tested this in 5.2 to see if there is any change but it still seems to not work.
Intellisense is already disabled for me. Is there a way to reset visual assist settings?
|
- Capmare David Nicusor - MallocStar |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 23 2024 : 08:52:07 AM
|
Do you have:
VA Options -> Editor -> Convert dot to -> in C/C++
turned On?
If you use Alt-Shift-G on "localTPtr" and look at "Types of Symbol", what do you see? Testing in UE 5.3, I have 2 sub-items, which are:
TObjectPtr<simpleDateTypeForPointer> > simpleDateTypeForPointer
and if you instead select "Goto member..." in the menu, you should get a dialog showing the members of TObjectPtr<simpleDateTYpeForPointer> which holds 48 items, including an operator->
How does this compare to what you are seeing? |
zen is the art of being at one with the two'ness |
|
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 23 2024 : 10:36:25 AM
|
quote: Originally posted by feline
Do you have:
VA Options -> Editor -> Convert dot to -> in C/C++
turned On?
If you use Alt-Shift-G on "localTPtr" and look at "Types of Symbol", what do you see? Testing in UE 5.3, I have 2 sub-items, which are:
TObjectPtr<simpleDateTypeForPointer> > simpleDateTypeForPointer
and if you instead select "Goto member..." in the menu, you should get a dialog showing the members of TObjectPtr<simpleDateTYpeForPointer> which holds 48 items, including an operator->
How does this compare to what you are seeing?
I have updated the visual assist version to the latest once since i didn t notice there was a new update in the end of last month. It solved the problem with the pointers in unreal engine but the problem still persist with the smart pointers from stl. |
- Capmare David Nicusor - MallocStar |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 24 2024 : 07:47:58 AM
|
Thank you for the update, I am glad that something has been fixed, at least.
Since you are now using VA 2535 you may want to turn Off:
VA Options -> Display -> Display VA Navigation Bar:
since this version of VA contains a known bug, where the IDE quick find dialog, CTRL-F, looses focus as you are typing in a string to find. Disabling the VA navigation bar is a reliable work around for now, until we can get a fix released for this problem.
For the stl pointers though, I am wondering if this is somehow a solution specific problem.
If you have the time, can you please try making a new, default C++ solution inside Visual Studio. So nothing involving Unreal Engine. Do you still see the problem there? If this works correctly this would explain why so far I haven't been able to reproduce this here, even with the clear sample code. |
zen is the art of being at one with the two'ness |
|
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 25 2024 : 11:31:35 PM
|
quote: Originally posted by feline
Thank you for the update, I am glad that something has been fixed, at least.
Since you are now using VA 2535 you may want to turn Off:
VA Options -> Display -> Display VA Navigation Bar:
since this version of VA contains a known bug, where the IDE quick find dialog, CTRL-F, looses focus as you are typing in a string to find. Disabling the VA navigation bar is a reliable work around for now, until we can get a fix released for this problem.
Hello, i tried making a new c++ console application, and empty project, i still have the same issue smart pointers would not work. I have reinstalled and reset visual studio settings but it still didn't fix it.
For the stl pointers though, I am wondering if this is somehow a solution specific problem.
If you have the time, can you please try making a new, default C++ solution inside Visual Studio. So nothing involving Unreal Engine. Do you still see the problem there? If this works correctly this would explain why so far I haven't been able to reproduce this here, even with the clear sample code.
|
- Capmare David Nicusor - MallocStar |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 28 2024 : 08:40:48 AM
|
Strange. Thank you for running that test. At least we now know this isn't solution specific. So I am wondering about the SDK's you have installed, maybe one of those is a factor somehow.
Can you please load Visual Studio Installer. On the entry for VS2022 press the More button to open the pull down list. From this lies select "Export configuration". This will let you save out a simple text file, listing all of the components of VS2022 that you have installed.
Can you also export your VA and IDE settings:
VA Options -> Performance -> Export Settings IDE tools menu -> Import and Export Settings -> Export selected environment settings
Then finally zip up the test project you made, and send all of these files to me. I can then install the same VS2022 components here, import your settings, and open your project. At this point I really should get the same results you are getting, which will let me try to find out why this is happening.
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 Oct 28 2024 08:41:09 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 29 2024 : 12:19:36 PM
|
I have all of the files, many thanks for this. I am looking into the problem now:
case=165106 |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 29 2024 : 2:01:56 PM
|
I believe the problem is that you are using a slightly different version of the Windows SDK to me, which has a different definition of make_unique, that somehow is confusing our parser. So VA doesn't properly understand make_unique and make_shared on your system, even though it does on mine.
So, can you please navigate to the folder holding your SLN file, and in this folder create a new, empty text file called "va_stdafx.h", then edit it to have the content:
namespace std {
template <class _Ty>
unique_ptr<_Ty> make_unique(_Types&&... _Args);
template <class _Ty>
shared_ptr<_Ty> make_shared(_Types&&... _Args);
};
making sure there is a blank line at the end of the file. Now press the button:
VA Options -> Performance -> Rebuild symbol databases
and restart Visual Studio.
When rebuilding its symbol database VA looks for this file, and if found, it parses it before parsing anything else in your solution. Since we look for this file specifically, there is no need to add it to your solution, and in fact it should not be added to your solution, but it should be safe to check it into source control if you want.
This file is used to help our parser make sense of any odd code that it might encounter, especially macros that might cause us problems. In this situation I am using it to make sure that VA understands the return type of these two functions. This has fixed the problem in the test solution you sent me, and I suspect it will work well with your main solution as well.
|
zen is the art of being at one with the two'ness |
Edited by - feline on Oct 29 2024 2:03:30 PM |
|
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 30 2024 : 9:52:54 PM
|
quote: Originally posted by feline
I believe the problem is that you are using a slightly different version of the Windows SDK to me, which has a different definition of make_unique, that somehow is confusing our parser. So VA doesn't properly understand make_unique and make_shared on your system, even though it does on mine.
So, can you please navigate to the folder holding your SLN file, and in this folder create a new, empty text file called "va_stdafx.h", then edit it to have the content:
namespace std {
template <class _Ty>
unique_ptr<_Ty> make_unique(_Types&&... _Args);
template <class _Ty>
shared_ptr<_Ty> make_shared(_Types&&... _Args);
};
making sure there is a blank line at the end of the file. Now press the button:
VA Options -> Performance -> Rebuild symbol databases
and restart Visual Studio.
When rebuilding its symbol database VA looks for this file, and if found, it parses it before parsing anything else in your solution. Since we look for this file specifically, there is no need to add it to your solution, and in fact it should not be added to your solution, but it should be safe to check it into source control if you want.
This file is used to help our parser make sense of any odd code that it might encounter, especially macros that might cause us problems. In this situation I am using it to make sure that VA understands the return type of these two functions. This has fixed the problem in the test solution you sent me, and I suspect it will work well with your main solution as well.
Ok, that apparently seems to solve the issue! Thanks a lot for helping with this problem! So the solution from now would be to always add that file with the template code? |
- Capmare David Nicusor - MallocStar |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 31 2024 : 09:36:06 AM
|
If you only work with a single solution, then just making this file once will be enough. Since VA always looks for the file when rebuilding its symbol database, the file will always take effect.
If however you work with a range of different solutions, and want this to apply to all of them, which would make sense, since it looks like its the specific version of the STD header file that is confusing VA, place the "va_stdafx.h" file into the directory:
%APPDATA%\VisualAssist\Misc so you get:
%APPDATA%\VisualAssist\Misc\va_stdafx.h
but do remember that this file will be applied to ALL solutions you open on this machine, since sometimes you want solution specific edits in va_stdafx.h |
zen is the art of being at one with the two'ness |
|
|
Capmare
New Member
Belgium
7 Posts |
Posted - Oct 31 2024 : 10:55:26 AM
|
quote: Originally posted by feline
If you only work with a single solution, then just making this file once will be enough. Since VA always looks for the file when rebuilding its symbol database, the file will always take effect.
If however you work with a range of different solutions, and want this to apply to all of them, which would make sense, since it looks like its the specific version of the STD header file that is confusing VA, place the "va_stdafx.h" file into the directory:
%APPDATA%\VisualAssist\Misc so you get:
%APPDATA%\VisualAssist\Misc\va_stdafx.h
but do remember that this file will be applied to ALL solutions you open on this machine, since sometimes you want solution specific edits in va_stdafx.h
Great! Thank you a lot for assisting with this problem! |
- Capmare David Nicusor - MallocStar |
|
|
|
Topic |
|
|
|