Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 UE4 Code Inspection Invalid directory

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
Hoff Posted - Oct 14 2021 : 9:50:01 PM
Hi all,
I've been trying to figure out why the Code Inspection hasn't been working in Visual Studio 2019, so I checked the VaCodeInspections.log and there's a ton of lines saying '[SIP] Ignoring invalid include directory ...'
It seems that all of the directories related to the project are being ignored, for example:
'[SIP] Ignoring invalid include directory ..\..\..\AnUnrealProject\Source'
I'm running the Unreal Engine 4.26 source build. Help would be greatly appreciated.

Thank you!
8   L A T E S T    R E P L I E S    (Newest First)
Hoff Posted - Oct 19 2021 : 1:50:50 PM
Got it, that makes sense. Thanks! If there's anything else I can provide let me know, VA has been incredibly helpful.
feline Posted - Oct 19 2021 : 05:59:05 AM
I don't know all of the rules for when you can use a for range loops, but I do know that if you are only looping across part of a collection then you cannot convert it to a for range loop, since the for range loop only does the entire collection.

I assume you can have collection types that won't support for range loops but that will allow a normal for loop, so I don't want to make to many assumptions up front here. But there is certainly something odd going on here, since a std::vector loop that VA will suggest and convert outside of Unreal Engine isn't being picked up inside Unreal Engine. Now it's "just" a case of getting a small enough test case example to find out why... This may take me a little while, but I am looking into this now, thank you for the extra details
Hoff Posted - Oct 18 2021 : 12:51:33 PM
That did detect it and let me convert it! Sorry, that array is a TArray<FBPFriendInfo>. So it has a hard time with Unreal specific types? For example, this doesn't suggest anything either:

TArray<AActor*> PlayerStartActors;
TArray<APlayerStart*> PlayerStartArray;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APlayerStart::StaticClass(), OUT PlayerStartActors);

for (int32 i = 0; i < PlayerStartActors.Num(); i++)
{
	APlayerStart* PlayerStarts = Cast<APlayerStart>(PlayerStartActors[i]);
	if (PlayerStarts->PlayerStartTag == TeamText)
		PlayerStartArray.Add(PlayerStarts);
}

even though the loop could be re-written as
for (AActor* PlayerStart : PlayerStartActors)
{
	APlayerStart* PlayerStarts = Cast<APlayerStart>(PlayerStart);
	if (PlayerStarts->PlayerStartTag == TeamText)
		PlayerStartArray.Add(PlayerStarts);
}
feline Posted - Oct 18 2021 : 07:10:45 AM
Apologies, I wasn't clear enough. What type is the array? There are some restrictions on what can be a range based for loop, but I don't know all of the details. I do know that you need to loop across the entire range of the storage.

I am seeing some problems with code inspection and the for loop with a vector here, which I am going to start looking into. So the type of the array is clearly going to be a factor.

Can you instead try this simple test case please, which VA is offering to convert to a range based for loop for me inside an Unreal Engine game project:

static void forLoopToRange()
{
	int nTotal = 0;
	// loop across full vector, convert to range is offered here #CodeInspectForRange
	int nVecSmall[6] = { 1, 2, 3, 4, 5, 6 };
	for (int n = 0; n < 6; ++n)
	{
		nTotal += nVecSmall[n];
	}
}


for reference, after the conversion, I get the code:

static void forLoopToRange()
{
	int nTotal = 0;
	// loop across full vector, convert to range is offered here #CodeInspectForRange
	int nVecSmall[6] = { 1, 2, 3, 4, 5, 6 };
	for (int n : nVecSmall)
	{
		nTotal += n;
	}
}
Hoff Posted - Oct 15 2021 : 1:58:29 PM
InArray is an array of FBPFriendInfo, a struct from the AdvancedSessions plugin:

(sorry if the picture is huge)

There doesn't seem to be any suggestion for the loop you provided.
feline Posted - Oct 15 2021 : 1:43:53 PM
What is the data type for "InArray"? Can you please try the following simple loop:

std::vector<int> vecCombinedResults = { 1, 2, 3, 4 };
for(auto it = vecCombinedResults.begin(); it != vecCombinedResults.end(); ++it)
{
	nTotal += *it;
}

which code inspection does offer to convert for me. The details of the for loop matter for it being converted to a range loop.
Hoff Posted - Oct 15 2021 : 1:29:49 PM
I'm doing this in my project files. Interestingly, while I was writing up my response because it wasn't doing anything in anything except the project's .h and .cpp, it suddenly started responding after adding it in the others, even though it wasn't detecting it on the first try. It isn't detecting any code from before though, like for loops that should be converted such as:

for (int32 i = 0; i < InArray.Num(); i++)
{
	UE_LOG(LogTemp, Warning, TEXT("player name: %s"), *InArray[i].DisplayName);
}


The code inspection results window is blank, and there's no underline similar to the 0s in the function you gave.
feline Posted - Oct 15 2021 : 06:56:04 AM
Odd, and unexpected.

Are you trying to use Code Inspection inside your own project code, or inside Unreal Engine library files? This could be a factor.

As a simple sanity check I have just added the following test code to one of my code files inside a simple Unreal Engine game project, using VS2019 and VA 2420.0:

static void zeroConstant()
{
	int* pTesting = 0; // #CodeInspectNullptr
	if (0 == pTesting) // #CodeInspectNullptr
		return;
}

Code Inspection is picking up both zeros quite happily. It did take a few seconds to update, but its definitely working.

Can you please try the same simple test case in your solution and see if you get the same result?

What, if anything, are you seeing in the Code Inspection results window? Just no issues reported, or an actual error reported?

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