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
 UE4 Code Inspection Invalid directory
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Hoff
New Member

USA
5 Posts

Posted - Oct 14 2021 :  9:50:01 PM  Show Profile  Reply with Quote
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!

feline
Whole Tomato Software

United Kingdom
19054 Posts

Posted - Oct 15 2021 :  06:56:04 AM  Show Profile  Reply with Quote
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?

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

Hoff
New Member

USA
5 Posts

Posted - Oct 15 2021 :  1:29:49 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19054 Posts

Posted - Oct 15 2021 :  1:43:53 PM  Show Profile  Reply with Quote
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.

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

Hoff
New Member

USA
5 Posts

Posted - Oct 15 2021 :  1:58:29 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19054 Posts

Posted - Oct 18 2021 :  07:10:45 AM  Show Profile  Reply with Quote
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;
	}
}

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

Hoff
New Member

USA
5 Posts

Posted - Oct 18 2021 :  12:51:33 PM  Show Profile  Reply with Quote
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);
}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19054 Posts

Posted - Oct 19 2021 :  05:59:05 AM  Show Profile  Reply with Quote
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

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

Hoff
New Member

USA
5 Posts

Posted - Oct 19 2021 :  1:50:50 PM  Show Profile  Reply with Quote
Got it, that makes sense. Thanks! If there's anything else I can provide let me know, VA has been incredibly helpful.
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