Settings.json is not re-generated *when deleted* on 1.6 preview #12300

Closed
opened 2026-01-31 03:11:43 +00:00 by claunia · 7 comments
Owner

Originally created by @WSLUser on GitHub (Jan 29, 2021).

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] 19041
Windows Terminal version (if applicable): 1.6 Preview

Any other software?

Steps to reproduce

  1. Have Windows Terminal open
  2. Delete the existing settings.json.
  3. Open a new instance of Windows Terminal.
  4. Open Settings from the drop-down. It will offer to create one but will be blanked out.

Expected behavior

I expect all the default settings to be regenerated.

Actual behavior

While 1.5 correctly regenerates the settings.json, 1.6 does not. Verified by @carlos-zamora that it occurs on 1.5 too

I suspect it has something to do with the way it's tied to the Settings UI.

Originally created by @WSLUser on GitHub (Jan 29, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] 19041 Windows Terminal version (if applicable): 1.6 Preview Any other software? ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. Have Windows Terminal open 2. Delete the existing settings.json. 3. Open a new instance of Windows Terminal. 4. Open Settings from the drop-down. It will offer to create one but will be blanked out. # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> I expect all the default settings to be regenerated. # Actual behavior <!-- What's actually happening? --> ~While 1.5 correctly regenerates the settings.json, 1.6 does not.~ Verified by @carlos-zamora that it occurs on 1.5 too I suspect it has something to do with the way it's tied to the Settings UI.
Author
Owner

@carlos-zamora commented on GitHub (Feb 2, 2021):

Ok, did some digging. A few things:

  • To repro, there was a step missing (updated the description). WT has to be open before you delete the existing settings.json. If WT is not open, WT generates a new settings.json on launch.
  • Verified that this occurs on v1.5.3142.0 too.

The root cause of this is in TerminalPage.cpp's _LaunchSettings:
40ebe5ab54/src/cascadia/TerminalApp/TerminalPage.cpp (L2148-L2154)

When we attempt to open the settings.json, we just call a ShellExecute on the filepath. Apparently, if the file doesn't exist, notepad opens up and gives you this prompt:
notepad prompt

As for how to get around this, I guess we could check if the file is here first, then populate it there and then?

@DHowett @zadjii-msft Thoughts? Should this even be scheduled for v1.7 since it's always been around? The workaround is pretty straight-forward: re-launch WT.

@carlos-zamora commented on GitHub (Feb 2, 2021): Ok, did some digging. A few things: - To repro, there was a step missing (updated the description). WT has to be open _before_ you delete the existing settings.json. If WT is not open, WT generates a new settings.json on launch. - Verified that this occurs on v1.5.3142.0 too. The root cause of this is in TerminalPage.cpp's `_LaunchSettings`: https://github.com/microsoft/terminal/blob/40ebe5ab546dbfae65a57505954b062edbcd06f6/src/cascadia/TerminalApp/TerminalPage.cpp#L2148-L2154 When we attempt to open the settings.json, we just call a `ShellExecute` on the filepath. Apparently, if the file doesn't exist, notepad opens up and gives you this prompt: ![notepad prompt](https://user-images.githubusercontent.com/11050425/106537505-50a55900-64af-11eb-90c3-e414e935d4fc.png) As for how to get around this, I guess we could check if the file is here first, then populate it there and then? @DHowett @zadjii-msft Thoughts? Should this even be scheduled for v1.7 since it's always been around? The workaround is pretty straight-forward: re-launch WT.
Author
Owner

@zadjii-msft commented on GitHub (Feb 2, 2021):

Yea I'm cool with this being a 1.7 fix.

@zadjii-msft commented on GitHub (Feb 2, 2021): Yea I'm cool with this being a 1.7 fix.
Author
Owner

@WSLUser commented on GitHub (Feb 2, 2021):

Sorry for missing a step. I guess 1.5 preview and 1.5 stable are different enough as I was not able to reproduce on 1.5 preview. Thanks for looking into this @carlos-zamora .

@WSLUser commented on GitHub (Feb 2, 2021): Sorry for missing a step. I guess 1.5 preview and 1.5 stable are different enough as I was not able to reproduce on 1.5 preview. Thanks for looking into this @carlos-zamora .
Author
Owner

@DHowett commented on GitHub (Feb 2, 2021):

If you don't want the settings file deleted, don't delete it. I dunno. We could add the deletion event to our filesystem change notifier, but why?

@DHowett commented on GitHub (Feb 2, 2021): If you don't want the settings file deleted, don't delete it. I dunno. We could add the deletion event to our filesystem change notifier, but _why_?
Author
Owner

@WSLUser commented on GitHub (Feb 2, 2021):

It should continue to be regenerated if deleted. In my case, I had deleted it in hopes of getting a properly formatted settings.json back that hasn't been touched by the Settings UI. This obviously didn't work. Anytime someone wants/needs to start from scratch with it again should be able to do so easily.

@WSLUser commented on GitHub (Feb 2, 2021): It should continue to be regenerated if deleted. In my case, I had deleted it in hopes of getting a properly formatted settings.json back that hasn't been touched by the Settings UI. This obviously didn't work. Anytime someone wants/needs to start from scratch with it again should be able to do so easily.
Author
Owner

@ghost commented on GitHub (Feb 11, 2021):

:tada:This issue was addressed in #9012, which has now been successfully released as Windows Terminal v1.5.10411.0.🎉

Handy links:

@ghost commented on GitHub (Feb 11, 2021): :tada:This issue was addressed in #9012, which has now been successfully released as `Windows Terminal v1.5.10411.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.5.10411.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Feb 11, 2021):

:tada:This issue was addressed in #9012, which has now been successfully released as Windows Terminal Preview v1.6.10412.0.🎉

Handy links:

@ghost commented on GitHub (Feb 11, 2021): :tada:This issue was addressed in #9012, which has now been successfully released as `Windows Terminal Preview v1.6.10412.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10412.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12300