Skip to content

Improve diagnostics when allocating MsQuicApi - #74985

Closed
rzikm wants to merge 1 commit into
dotnet:mainfrom
rzikm:msquic-api-improve-diagnostics
Closed

Improve diagnostics when allocating MsQuicApi#74985
rzikm wants to merge 1 commit into
dotnet:mainfrom
rzikm:msquic-api-improve-diagnostics

Conversation

@rzikm

@rzikmrzikm commented Sep 2, 2022

Copy link
Copy Markdown
Member

This PR improves diagnostics when allocating MsQuicApi instance, this was useful when investigating #74952 and would be nice to get into .NET 7 as part of #74931.

@ghostghost assigned rzikmSep 2, 2022
@ghost

ghost commented Sep 2, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR improves diagnostics when allocating MsQuicApi instance, this was useful when investigating #74952 and would be nice to get into .NET 7 as part of #74931.

Author:rzikm
Assignees:rzikm
Labels:

area-System.Net.Http

Milestone:-

@rzikmrzikm changed the title Msquic-api-improve-diagnosticsImprove diagnostics when allocating MsQuicApiSep 2, 2022
@rzikm
rzikm requested a review from a teamSeptember 2, 2022 09:00
Comment threadsrc/libraries/System.Net.Http/src/System/Net/Http/HttpMethod.cs Outdated
@rzikm
rzikmforce-pushed the msquic-api-improve-diagnostics branch from a00ca20 to 7cf6ebaCompareSeptember 2, 2022 10:07
ThrowHelper.ThrowIfMsQuicError(openStatus);

// this should unreachable as TryOpenMsQuic returns non-success status on failure
throw new Exception("Failed to create MsQuicApi instance");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you were to invert this condition, you wouldn't need the unreachable throw:

if(!TryLoadMsQuic(outIntPtrmsQuicHandle)||!TryOpenMsQuic(msQuicHandle,outQUIC_API_TABLE*apiTable,outopenStatus)){ThrowHelper.ThrowIfMsQuicError(openStatus);}returnnewMsQuicApi(apiTable);

You could also have a ThrowMsQuicError that was unconditional. Or just use throw GetExceptionForMsQuicStatus(openStatus);.

@rzikm

rzikm commented Sep 7, 2022

Copy link
Copy Markdown
MemberAuthor

Since the change this follows up on was reverted, I am closing this issue, we can pick these changes in #75163 and have them in 1 commit for eventual porting

@ghostghost locked as resolved and limited conversation to collaborators Oct 7, 2022
@karelzkarelz added this to the 8.0.0 milestone Mar 22, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rzikm@stephentoub@liveans@karelz