Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace implicit conversions in UiaOperationAbstraction with explicit ones #88

Open
beweedon opened this issue Feb 10, 2022 · 2 comments
Labels
enhancement New feature or request UiaOperationAbstraction Issues that are related to the UiaOperationAbstraction C++ static library

Comments

@beweedon
Copy link
Contributor

Types in UiaOperationAbstraction can often be converted to their local and remote variants implicitly. For example, passing a UiaString to a function that takes a wil::shared_bstr will perform the conversion automatically due to the UiaString method operator wil::shared_bstr() const;. These conversions throw if you try to convert a remote abstraction instance into its local variant, or a local abstraction instance into its remote variant. This can result in accidental and often confusing bugs.

It's worth having discussion on whether we want to move towards more explicit conversions to avoid these subtle bugs. This would be a breaking change for UiaOperationAbstraction consumers.

@beweedon beweedon added enhancement New feature or request UiaOperationAbstraction Issues that are related to the UiaOperationAbstraction C++ static library labels Feb 10, 2022
@beweedon
Copy link
Contributor Author

@michaelDCurran @zhayuli

@ggordon-vispero
Copy link

I actually like the implicit conversions but understand the counter arguments. Could the conversions all be placed in one of the headers, if they aren't already, and surrounded with ifdefs? I've not looked at the code recently enough to know if this could also be dealt with by putting the conversions in their own namespace which the client could "use" if they're wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request UiaOperationAbstraction Issues that are related to the UiaOperationAbstraction C++ static library
Projects
None yet
Development

No branches or pull requests

2 participants