-
Notifications
You must be signed in to change notification settings - Fork 5k
change win32 to derived types #53146
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
change win32 to derived types #53146
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
/cc @danmoseley |
FYI seems like NegotiateStreamPal.Windows.cs doesn't like this change which will leave only 2 files eligible for this change. Is this what was expected? Could this be the reason why derived types haven't been used as this may need too much structural change? It seems like within the System.Net files there are quite a few Win32 exceptions a very few of them fit within the context of these 4: System.Net.HttpListenerException Which are the only available derived types it seems. |
If you click through to Azure Devops and look at the raw log, it shows the project files:
Basically these are shared source files and 3 of the projects pulling them in don't have a reference to HttpListenerException, which is in System.Net.HttpListener. I think this is indicating that this is not a good choice. Would SocketException be a better choice? This should be visible to all these libraries. @wfurt is it appropriate? |
Oh, I didn't read all of your posting above. OK, I would like to hear @wfurt opinion on whether any of those are appropriate or we need to consider a new type. |
HttpListenerException is certainly not appropriate for SslStream or NegotiateStream. One way to go may be wrapping win32 exception in. AuthenticationException and do the same for low-level OpenSSL codes. With that the exception type would be consistent while preserving the platform details. |
@danmoseley does what @wfurt suggested require a proposal? |
AuthenticationException does not derive from Win32Exception, so such a change would change the type thrown to one that could break catch blocks expecting Win32Exception. |
Thanks for the PR. As noted by others, though, none of the changes in this PR as it's currently written should be merged... HttpListenerException is not acceptable in these call sites. |
No problems. I noted that only the above 4 exceptions I mentioned are derived from Win32Exception which are not suitable for any of these cases so I have closed the PR. |
Fixes #26227