If an entity is added to a HasMany relationship collection, it should be added to the Ids in HasManyIds. That is currently not the case within the same session.
[Model]
public class Person
{
[HasManyIds("pizzas")]
public IEnumerable<Guid> PizzaIds { get; set; }
[HasMany]
public ICollection<Pizza> Pizzas { get; set; }
}
var moarPizza = session.Get<Pizza>(moarPizzaId);
person.Pizzas.Add(moarPizza);
await session.Update(person);
// FAILS in same session. Succeeds in new session
Assert.True(person.PizzaIds.Contains(moarPizzaId));