You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Two constructors of Microsoft.Graph.GraphServiceClient1 create instances of Microsoft.Graph.BaseGraphRequestAdapter. Microsoft.Graph.BaseGraphRequestAdapter needs to be disposed because it inherits 2 from Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter which needs to dispose its System.Net.HttpClient3.
Describe the solution you'd like Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter is disposable, therefore Microsoft.Graph.BaseGraphRequestAdapter which inherits from the former is disposable, therefore Microsoft.Graph.GraphServiceClient which instantiates the former should be disposable, following the cascading disposable pattern 4.
Describe alternatives you've considered
Alternatively, the GraphServiceClient constructor overloads that implicitly create a BaseGraphRequestAdapter could be obsoleted, forcing the user to instantiate BaseGraphRequestAdapter and dispose of it directly.
Additional context
A workaround is to use the GraphServiceClient constructor overloads that accept a BaseGraphRequestAdapter, instantiating and disposing the BaseGraphRequestAdapter yourself.
Is your feature request related to a problem? Please describe.
Two constructors of
Microsoft.Graph.GraphServiceClient
1 create instances ofMicrosoft.Graph.BaseGraphRequestAdapter
.Microsoft.Graph.BaseGraphRequestAdapter
needs to be disposed because it inherits 2 fromMicrosoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter
which needs to dispose itsSystem.Net.HttpClient
3.Describe the solution you'd like
Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter
is disposable, thereforeMicrosoft.Graph.BaseGraphRequestAdapter
which inherits from the former is disposable, thereforeMicrosoft.Graph.GraphServiceClient
which instantiates the former should be disposable, following the cascading disposable pattern 4.Describe alternatives you've considered
Alternatively, the
GraphServiceClient
constructor overloads that implicitly create aBaseGraphRequestAdapter
could be obsoleted, forcing the user to instantiateBaseGraphRequestAdapter
and dispose of it directly.Additional context
A workaround is to use the
GraphServiceClient
constructor overloads that accept aBaseGraphRequestAdapter
, instantiating and disposing theBaseGraphRequestAdapter
yourself.Footnotes
https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/82d4f5d4b7a8216e787f2b227e08019773f6cc02/src/Microsoft.Graph/GraphServiceClient.cs#L59-L78 ↩
https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/blob/3708629f91bc314a30d07e349cf6205f8ed30b52/src/Microsoft.Graph.Core/Requests/BaseGraphRequestAdapter.cs#LL16C68-L16C68 ↩
https://github.com/microsoft/kiota-http-dotnet/blob/58fb5f4ad6edbaf54dfe184fa2d3b8538bc558f2/src/HttpClientRequestAdapter.cs#L530-L538 ↩
https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose#cascade-dispose-calls ↩
The text was updated successfully, but these errors were encountered: