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

[android][ios] Fix dispose problem with NativeHttpHandlers #93262

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

steveisok
Copy link
Member

#90298 made sure the MetricsHandler was the top level handler for all NativeHttpHandler requests similar to what is done with SocketsHttpHandler. After creating the MetricsHandler, the code mistakenly disposed of _nativeHandler, which resulted in Dispose being called multiple times and eventually throwing a Cannot access a disposed object exception.

Fixes #93252

dotnet#90298 made sure the MetricsHandler was the top level handler for all NativeHttpHandler requests similar to what is done with SocketsHttpHandler. After creating the MetricsHandler, the code mistakenly disposed of `_nativeHandler`, which resulted in `Dispose` being called multiple times and eventually throwing a `Cannot access a disposed object` exception.

Fixes dotnet#93252
@ghost
Copy link

ghost commented Oct 9, 2023

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

Issue Details

#90298 made sure the MetricsHandler was the top level handler for all NativeHttpHandler requests similar to what is done with SocketsHttpHandler. After creating the MetricsHandler, the code mistakenly disposed of _nativeHandler, which resulted in Dispose being called multiple times and eventually throwing a Cannot access a disposed object exception.

Fixes #93252

Author: steveisok
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@marek-safar
Copy link
Contributor

/backport to release/8.0

@github-actions
Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6467023435

@github-actions
Copy link
Contributor

@marek-safar an error occurred while backporting to release/8.0, please check the run log for details!

Error: @marek-safar is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your dotnet team membership visibility is set to Public on https://github.com/orgs/dotnet/people?query=marek-safar

@steveisok steveisok merged commit e2c319a into dotnet:main Oct 10, 2023
107 of 109 checks passed
@steveisok steveisok deleted the fix-nativehandler-dispose branch October 10, 2023 14:47
steveisok added a commit to steveisok/runtime that referenced this pull request Oct 10, 2023
)

dotnet#90298 made sure the MetricsHandler was the top level handler for all NativeHttpHandler requests similar to what is done with SocketsHttpHandler. After creating the MetricsHandler, the code mistakenly disposed of `_nativeHandler`, which resulted in `Dispose` being called multiple times and eventually throwing a `Cannot access a disposed object` exception.

Fixes dotnet#93252
@karelz karelz added this to the 9.0.0 milestone Oct 11, 2023
carlossanlop pushed a commit that referenced this pull request Oct 12, 2023
…93291)

#90298 made sure the MetricsHandler was the top level handler for all NativeHttpHandler requests similar to what is done with SocketsHttpHandler. After creating the MetricsHandler, the code mistakenly disposed of `_nativeHandler`, which resulted in `Dispose` being called multiple times and eventually throwing a `Cannot access a disposed object` exception.

Fixes #93252
@ghost ghost locked as resolved and limited conversation to collaborators Nov 10, 2023
Sign up for free to 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.

[regression/8.0.0-preview.7.8842] - AndroidMessageHandler - Cannot access a disposed object
4 participants