Moving Plarform Error // void moving_platform._PhysicsProcess(double):System.NullReferenceExcepiton: Objection reference not set to an instance of an object

using Godot;
using System;
using System.Runtime.InteropServices;
using System.Threading;

public partial class moving_platform : Node2D
{
// Called when the node enters the scene tree for the first time.

Double WAIT_DURATION =1.0;
public AnimatableBody2D platform;
double move_speed = 3.0;
float distance = 192;
bool move_horizontal =true;
Vector2 follow = Vector2.Zero;
double platform_center =16;
	
public override void _Ready()
{
	move_platform();
}

// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _PhysicsProcess(double delta)
{		
	platform.Position=platform.Position.Lerp(follow,(float)0.5);	//void moving_platform._PhysicsProcess(double):System.NullReferenceExcepiton: Objection reference not set to an instance of an object	
}

public void move_platform()
{
	
	Vector2 move_direction= Vector2.Right * distance;
	if (move_horizontal==false)move_direction=Vector2.Up;

	double duration = move_direction.Length() / move_speed * platform_center;

	var platform_tween =CreateTween();
	platform_tween.TweenProperty(this,"follow",move_direction,duration);


	

}

}
Disclaimer:
Hello Guys, i’m pretty new in Godot and im trying to make a moving platform 2d, i’m actually watching a tutorial video to learn about godot, but the video teach in Gdscript, but how i’m more comfortable with c# im adapting to c# (dumb decision but ye)

Question:
My code haven’t any error but when i execute in godot, this error (void moving_platform._PhysicsProcess(double):System.NullReferenceExcepiton: Objection reference not set to an instance of an object) appears, like 100 times per second.
And the platform just stay static.

this says you are trying to do something with a null variable. look at the example below:

extends Node2D
func _ready():
	var v_node : Node = Node.new()
	print(v_node.get_parent().name)

when i run my code i get the error message: Invalid get index ‘name’ (on base: ‘null instance’). why?

because v_node does not have a parent. get_parent() is null. and i am trying to access parent’s name.

now look at the updated example below:

extends Node2D
func _ready():
	var v_node : Node = Node.new()
	if(null == v_node.get_parent()):
		print("this node has no parent")
	else:
		print(v_node.get_parent().name)

above i check if get_parent() is null or not. if it is, then i display an error message. that is how i would find the error if i was stuck.