WITH_EDITOR and WITH_EDITORONLY_DATA not blocking

I draw some icons on Blueprints for use by the designer in the Editor, the icons aren’t needed at run-time though, those blueprints are used.

Previously, I had blocked out the code that loaded the icons with #if WITH_EDITORONLY_DATA

My shipping build stopped working, it would crash on startup and I would get the error in the .cpp file, of a funtion inside a block.

Are these getting defined differently now in 4.17?

What is the correct way to block code out so that it is not called when running a standalone build?

I also tried using WITH_EDITOR, same issue. Game crashes on startup. Commenting out all the sections like this fixes the crash, but then we no longer have the feature of having nice icons in the Editor to drag the components around with in the Blueprint Viewport.

This previous worked.

UCoinMarker::UCoinMarker(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
#if WITH_EDITOR
	// Structure to hold one-time initialization
	struct FConstructorStatics
	{
		// A helper class object we use to find target UTexture2D object in resource package
		ConstructorHelpers::FObjectFinder<UTexture2D> Texture0;
		FConstructorStatics()
			: Texture0(TEXT("Texture2D'/Game/Lemons/Icons/CoinMarker.CoinMarker'"))
		{
		}
	};
	static FConstructorStatics ConstructorStatics;
	BillboardComponent = ObjectInitializer.CreateEditorOnlyDefaultSubobject<UBillboardComponent>(this, TEXT("Billboard"), true);
	BillboardComponent->Sprite = ConstructorStatics.Texture0.Object;
#endif
}

I think this may be an engine bug