UE4.27 Project Crashes on Start

I just started working with a C++ Project and reached a point where the project crashes every time I try to load it.

The gist of the Error Message:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000150
UE4Editor_MyProject_4437!UOpenDoor::UOpenDoor() [D:\Unreal Projects\MyProject\Source\MyProject\OpenDoor.h:28]

My assumption is that its caused by erroneously attempting to initialize an FRotator variable with the owner’s rotation in a component’s header file (Line 28). Fair enough, but if I try to fix that mistake on VS Code, and I try to load the project up again to compile, it will still crash before I can do anything…

Any help is appreciated, thank you.

Are you using Visual Studio? If you are not already doing so, you can launch the engine and your game by pressing F5. That may help.

By chance, are you able to share OpenDoor.h/.cpp?

u probably doing something wrong in ur construction function. fix that mistake and build ur project from source

Yes, thank you! It worked.
Now it doesn’t crash anymore.
The below is the corrected code, with the variables init in BeginPlay. This is just the GameDev tut on Udemy.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "OpenDoor.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECT_API UOpenDoor : public UActorComponent

	// Sets default values for this component's properties

	// Called when the game starts
	virtual void BeginPlay() override;

	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	float InitialYaw;
	float CurrentYaw = 0.f;
	float TargetYaw;
	FRotator OpenDoor;
#include "OpenDoor.h"
#include "GameFramework/Actor.h"

// Sets default values for this component's properties
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;

	// ...

// Called when the game starts
void UOpenDoor::BeginPlay()
	InitialYaw = GetOwner()->GetActorRotation().Yaw;
	TargetYaw = GetOwner()->GetActorRotation().Yaw + 90.f;
	OpenDoor = {0.f,TargetYaw,0.f};

// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
	OpenDoor.Yaw = FMath::Lerp(InitialYaw, TargetYaw, 0.02f);
	GetOwner()-> SetActorRelativeRotation(OpenDoor);
	UE_LOG(LogTemp, Warning, TEXT("%f"), OpenDoor.Yaw);

	// ...