Skip to content

Use throw rather than abort() for guid parse failures - #992

Merged
Johan Laanstra (jlaanstra) merged 4 commits into
microsoft:masterfrom
dfields-msft:patch-3
Aug 4, 2021
Merged

Use throw rather than abort() for guid parse failures#992
Johan Laanstra (jlaanstra) merged 4 commits into
microsoft:masterfrom
dfields-msft:patch-3

Conversation

@dfields-msft

Copy link
Copy Markdown
Contributor

Make winrt::guid("...") more useful at runtime by throwing on failure instead of aborting the program. See #991

Make `winrt::guid("...")` more useful at runtime by throwing on failure instead of aborting the program.
@dfields-msft

Copy link
Copy Markdown
Contributor Author

Kenny Kerr (@kennykerr) does a successful run of "C++ for WinRT Xlang Internal Build" include the Clang validation you were asking for?

@kennykerr Kenny Kerr (kennykerr) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Please add a test that verifies this works. At a glance, this won't compile.

Comment thread strings/base_types.h
@kennykerr

Copy link
Copy Markdown
Collaborator

Yes, you can either validate it locally or run the build once a test has been added.

@kennykerr

Copy link
Copy Markdown
Collaborator

Oh and the CI build for some reason will only run branches local to this repo.

@dfields-msft

Copy link
Copy Markdown
Contributor Author

Does the test infrastructure have any existing support for compile-time negative tests (i.e. code that's expected to not compile)? I can certainly add compile-time and runtime positive tests, as well as a runtime negative test, but I'm not going to bite off setting up test infrastructure for compile-time negative tests if that's not already available...

@kennykerr

Copy link
Copy Markdown
Collaborator

No negative testing unfortunately.

Just need a test that validates it works in a constant expression (e.g. static_assert) and a runtime test that validates it works successfully (e.g. assert) and unsuccessfully (e.g. throw and catch).

Comment thread strings/base_types.h Outdated
Comment thread strings/base_types.h
Comment thread strings/base_types.h
@dfields-msft

Copy link
Copy Markdown
Contributor Author

Kenny Kerr (@kennykerr) I'm not sure how to trigger the "C++ for WinRT Xlang internal build" pipeline run that's required by policy... Is this even possible, since my changes are coming from a different fork? I don't think I have permission to create a branch in the official microsoft fork.

@kennykerr

Copy link
Copy Markdown
Collaborator

I've given you Write access so you should be able to push a branch. Then you can go here and build your branch:

https://dev.azure.com/microsoft/Dart/_build?definitionId=31784

@dfields-msft

Copy link
Copy Markdown
Contributor Author

Verified offline that Clang works with these changes too. Kenny Kerr (@kennykerr) any additional changes needed, or is this ready to merge?

@dfields-msft

Copy link
Copy Markdown
Contributor Author

Thanks for approving the changes, Kenny Kerr (@kennykerr)! Looks like I'm not authorized to merge, so you may need to complete this PR yourself...

@kennykerr

Copy link
Copy Markdown
Collaborator

Ryan Shepherd (@DefaultRyan) or Johan Laanstra (@jlaanstra) can you help? I'm on the beach. 😎

@jlaanstra
Johan Laanstra (jlaanstra) merged commit 4ba22a6 into microsoft:master Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guid parse errors can't be caught and handled at runtime

4 participants