GetGuid noexcept function throws #5275

Closed
opened 2026-01-31 00:09:20 +00:00 by claunia · 5 comments
Owner

Originally created by @mkitzan on GitHub (Nov 28, 2019).

Environment

Windows build number: 0.0.1.0 Dev Build
Windows Terminal version (if applicable): 10.0.18363

Steps to reproduce

Invoke Profile::GetGuid on a Profile object without a GUID.

Expected behavior

GetGuid is specified as noexcept, the compiler and users expect the function to never throw.

Actual behavior

Exception thrown by a noexcept function.

New function semantics need to be decided for GetGuid and functions affected by GetGuid no longer being noexcept. Could be fixed by removing the noexcept specifier from the function and all affected functions.

Originally created by @mkitzan on GitHub (Nov 28, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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: 0.0.1.0 Dev Build Windows Terminal version (if applicable): 10.0.18363 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> Invoke [`Profile::GetGuid`](https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/Profile.cpp#L141) on a `Profile` object without a GUID. # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> `GetGuid` is specified as `noexcept`, the compiler and users expect the function to never throw. # Actual behavior <!-- What's actually happening? --> Exception thrown by a `noexcept` function. New function semantics need to be decided for `GetGuid` and functions affected by `GetGuid` no longer being `noexcept`. Could be fixed by removing the `noexcept` specifier from the function and all affected functions.
Author
Owner

@zadjii-msft commented on GitHub (Nov 28, 2019):

You're not wrong. I bet it was never changed from noexcept back when Profiles just had a GUID, as opposed to an std::optional<GUID>

@zadjii-msft commented on GitHub (Nov 28, 2019): You're not wrong. I bet it was never changed from `noexcept` back when `Profile`s just had a `GUID`, as opposed to an `std::optional<GUID>`
Author
Owner

@mkitzan commented on GitHub (Nov 28, 2019):

@zadjii-msft, sounds like you're going to be working in this area soon. I can make the noexcept corrections once you're finished. Until then I'll just find all the affected functions.
Edit: alternatively, GetGuid could return a std::optional<GUID> instead of throwing. However, this will require more work validating the optional and essentially deferring the throw to functions using GetGuid.

@mkitzan commented on GitHub (Nov 28, 2019): @zadjii-msft, sounds like you're going to be [working in this area soon](https://github.com/microsoft/terminal/issues/3680#issuecomment-559298230). I can make the `noexcept` corrections once you're finished. Until then I'll just find all the affected functions. Edit: alternatively, `GetGuid` could return a `std::optional<GUID>` instead of throwing. However, this will require more work validating the optional and essentially deferring the throw to functions using `GetGuid`.
Author
Owner

@mkitzan commented on GitHub (Nov 29, 2019):

I have a branch in my fork with the changes revoking noexcept, but PR #3762 needs be merged so its code can be fixed too.

@mkitzan commented on GitHub (Nov 29, 2019): I have a branch in my fork with the changes revoking `noexcept`, but PR [#3762](https://github.com/microsoft/terminal/pull/3762) needs be merged so its code can be fixed too.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 30, 2019):

Thanks for working on this! We'll be a bit slow on account of it's the Thanksgiving holiday here in the US, but we'll try to get through your PRs. 😄

@DHowett-MSFT commented on GitHub (Nov 30, 2019): Thanks for working on this! We'll be a bit slow on account of it's the Thanksgiving holiday here in the US, but we'll try to get through your PRs. :smile:
Author
Owner

@ghost commented on GitHub (Jan 14, 2020):

:tada:This issue was addressed in #3806, which has now been successfully released as Windows Terminal Preview v0.8.10091.0.🎉

Handy links:

@ghost commented on GitHub (Jan 14, 2020): :tada:This issue was addressed in #3806, which has now been successfully released as `Windows Terminal Preview v0.8.10091.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.8.10091.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?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#5275