[GAS] Creation of FGameplayEffectContextHandle crash editor in UE5

Hi, I ran into a problem with FGameplayEffectContextHandle on UE4 creation of FGameplayEffectContextHandle works fine but on UE5 same code constantly crash editor

void ATestGASonUE4Character::Test322()
{
	FGameplayEffectContext DamageEffectContext(GetController(), this);
	// HERE: issue when I try to create FGameplayEffectContextHandle
	FGameplayEffectContextHandle DamageEffectContextHandle(&DamageEffectContext);
}

So on screenshot below I created clean project to reproduce this issue, as I said on UE4 it works fine, on UE5 its crash editor.

  • Am I missing something? Probably I use GAS as its not intended to be used?
  • Is there any workaround?
  • Is it UE5 issue?

Attached both projects on UE4/UE5, function gets called when pressing “F”

P.S. Checked .cpp of GameplayEffectsTypes.h and FGameplayEffectContextHandle struct, but looks like there was no changes between UE4/UE5, looks like regression issue?

UPD forget to say that issue not related to Rider, its also reproduce with Visual Studio

Found out how to resolve this issue

  1. using new for FGameplayEffectContext creation required


  2. or probably better to use AbilitySystem.MakeEffectContext()

1 Like