-
Notifications
You must be signed in to change notification settings - Fork 135
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
Improve handling of not found exception from GetViewForHwnd() and re-add TogglePin functions #14
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this pull request. I added a few thoughts to the code.
ComObjects.ApplicationViewCollection.GetViewForHwnd(hWnd, out view); | ||
return view; | ||
} | ||
catch (System.Runtime.InteropServices.COMException ex) when (ex.Match(HResult.TYPE_E_ELEMENTNOTFOUND)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might consider not using C#6.0 specific features yet for more broad compilation support of the library itself
|
||
if (view == null) | ||
{ | ||
throw new ArgumentException(nameof(hWnd)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should message out why its an argument exception, and probably not use C#6.0 for more broad compilation possibility:
throw new ArgumentException("hWnd specified not found","hWnd");
Catch not found exception from GetViewForHwnd() to return null or throw ArgumentException