Create a new Content View from the Views UI wizard, with a Page display.
Go to the Advanced section, and change the Machine Name of the display from its default value of "page_1" to "page_test".
Save the view.
You will see a message (green!!?!) saying:
The view test has been saved.
Debug:'setDisplay() called with invalid display ID "page_test".'
in Drupal\views\ViewExecutable->setDisplay() (line 697 of core/modules/views/lib/Drupal/views/ViewExecutable.php).
And below that you will get:
Invalid display id page_test
and an empty Preview. (Screen shot below)
If you go back to Edit on the view you will see that you have just the Master display and the page has gone away.

| Comment | File | Size | Author |
|---|---|---|---|
| #6 | interdiff-2169835-6.txt | 5.42 KB | damiankloip |
| #6 | 2169835-6-PASS.patch | 5.44 KB | damiankloip |
| #6 | 2169835-6-tests-only-FAIL.patch | 2.46 KB | damiankloip |
| bad-display-id.png | 43.83 KB | jhodgdon |
Comments
Comment #1
dawehnerThis fixes the problem for me. I am happy that damian kind of wanted to write tests for this tomorrow.
Comment #2
jhodgdonIt also fixes the problem for me.
Comment #4
jhodgdon1: vdc-2169835.patch queued for re-testing.
Comment #5
jhodgdonthat was a random bot failure.
Comment #6
damiankloip commentedOK, here are some tests for this. It also covers some validation of the form (see fix in validation in patch/diff) we were calling $this->view->display still, when we need to call $this->view->displayHandlers, and iterate over those instead. Also refactored the actual fix in ViewEditFormController too, as I think we can clean that up a bit and call less things.
Comment #8
dawehnerMy original patch was just a pointer where to change things. This is way more readable than before.
Comment #9
jhodgdonThe test-only patch failed with similar errors to what I see without the patch, and reading over the test, it seems very thorough and it definitely tests the bug that is reported here. The patch-with-test patch passes.
I also tested this new patch manually on a clean D8 and it definitely fixes the problem. I also verified that I am not allowed to change the display ID to the same as another display or an illegal name with spaces. Everything seems to be working fine.
The code looks clear to me.
I was going to mark this RTBC but dawehner beat me to it. :)
Comment #10
dries commentedPatch looks good, but does not appear to apply. Needs reroll, please.
Comment #11
dries commented6: 2169835-6-PASS.patch queued for re-testing.
Comment #12
dries commentedLooks like the patch was already committed by catch. Marking it 'fixed' instead.