public static void SetDisconnectedCause(this LoadBalancingClient client, DisconnectCause cause) { // ReSharper disable once PossibleNullReferenceException client.GetType() .GetProperty("DisconnectedCause", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty) .GetSetMethod(true) .Invoke(client, new object[] { cause }); }