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

(fix): Build error due to missing dispose #1768

Merged
merged 2 commits into from
Feb 4, 2021
Merged

Conversation

vinagesh
Copy link
Member

@vinagesh vinagesh commented Feb 2, 2021

Checklist

  • I have read the contribution guidelines.
  • I added or modified the existing tests to cover the change (we do not allow our test coverage to go down).
  • This pull-request is submitted against the master branch.

Description of the changes

Some implementations of IAuthenticationMethod have objects that need to be disposed. And we were not disposing because the interface did not have IDisposable and the implementations did not dispose anything.
This change makes the interface disposable and hence any implementation that has disposable objects, dispose them. It is a no-op for the rest.

This also means, the public IotHubConnectionStringBuilder is now IDisposable. This could be a breaking change but something necessary.

@abhipsaMisra
Copy link
Member

We'll also need to update AuthenticationWithTokenRefresh to have it not implement IDisposable again

@vinagesh
Copy link
Member Author

vinagesh commented Feb 3, 2021

AuthenticationWithTokenRefresh

Will remove

azureiot.sln Outdated Show resolved Hide resolved
azureiot.sln Outdated Show resolved Hide resolved
@vinagesh vinagesh force-pushed the vinagesh/dispose branch 2 times, most recently from 0ce38d5 to 40e4a45 Compare February 3, 2021 00:23
@vinagesh
Copy link
Member Author

vinagesh commented Feb 3, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vinagesh vinagesh force-pushed the vinagesh/dispose branch 2 times, most recently from d852b38 to f2979e1 Compare February 3, 2021 21:00
@vinagesh vinagesh force-pushed the vinagesh/dispose branch 4 times, most recently from df5e871 to cd17f05 Compare February 3, 2021 22:57
@vinagesh
Copy link
Member Author

vinagesh commented Feb 4, 2021

Tested on the main pipeline and everything works well now.

@vinagesh
Copy link
Member Author

vinagesh commented Feb 4, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Certificate?.Dispose();
Certificate = null;
#endif
IotHubConnectionString?.TokenRefresher?.Dispose();
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to dispose whatever is needed here. Making the IotHubConnectionString class did not seem right as we really do not want that dispose to be called anywhere else.

@vinagesh vinagesh merged commit 529c504 into master Feb 4, 2021
@vinagesh vinagesh deleted the vinagesh/dispose branch February 4, 2021 01:55
timstewartm pushed a commit to timstewartm/azure-iot-sdk-csharp that referenced this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants