A local variable or function named 'ghostComponent' is already defined in this scope

There is a bug with the ghost component code gen that has appeared after updating from Netcode for Entities 1.9.0 → 1.9.1. If any component/buffer/rpc includes two Entity fields that have the [GhostField] attribute it will produce this error in the temp netcode generated file for it:

A local variable or function named 'ghostComponent' is already defined in this scope

It can be easily reproduced in any project with Netcode for Entities 1.9.1 by adding a simple component like this:

public struct MyEntitiesComponent : IComponentData
{
    [GhostField]
    public Entity Entity;
    [GhostField]
    public Entity AnotherEntity;
}

This bug fix is currently in progress.

This has been fixed in the released released 1.9.3 patch.