Why Cast<UArrayProperty>(Property) gives linker error?

UArrayProperty works fine generaly for example this works fine:
UArrayProperty* TestProperty=nullptr;
but using it like this:
Property->IsA<UArrayProperty>();
or like this:
Cast<UArrayProperty>(Property);

would result the following linker 2019 error:

1>LandscapeLevelEditorBFL.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UArrayProperty::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UArrayProperty@@CAPEAVUClass@@XZ) referenced in function "private: static void __cdecl ULandscapeLevelEditorBFL::GetLandscapeSegmentsFromLandscapeSplineComponent(class ULandscapeSplinesComponent *,class TArray<class ULandscapeSplineSegment *,class TSizedDefaultAllocator<32> > &)" (?GetLandscapeSegmentsFromLandscapeSplineComponent@ULandscapeLevelEditorBFL@@CAXPEAVULandscapeSplinesComponent@@AEAV?$TArray@PEAVULandscapeSplineSegment@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
UnrealEditor-MyPlugin.dll : fatal error LNK1120: 1 unresolved externals

I Already tried including the following headers:

#include "UObject/UObjectGlobals.h"
#include "UObject/Class.h"
#include "UObject/UnrealType.h"

and Tried to add following modules to MyPlugin.Build.cs

		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				// ... add other public dependencies that you statically link with here ...
				"Core", "CoreUObject", "Engine", "InputCore",
			}
			);
			
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				// ... add private dependencies that you statically link with here ...	
				"Core", "CoreUObject", "Engine", "InputCore",
			}
			);

Also I should mention that this worked fine with:
DefaultBuildSettings = BuildSettingsVersion.V2;
but error come’s up with:
DefaultBuildSettings = BuildSettingsVersion.V5;
which is asked for upgrading to UE5.4

Any Idea?