Fix EnsureLocalDisposable rule (#18498)