-
-
Notifications
You must be signed in to change notification settings - Fork 457
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
Set CA1001 to "Error" and resolved issues #1826
Conversation
…ins a using statement. There are some cases where the example code is pulling a previous version of the NuGet package, which means BrowserFetcher won't be disposable for that project.
@@ -3,7 +3,7 @@ | |||
<PropertyGroup> | |||
<OutputType>Exe</OutputType> | |||
<TargetFrameworks>netcoreapp3.1;net471</TargetFrameworks> | |||
<LangVersion>7.3</LangVersion> | |||
<LangVersion>8.0</LangVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those using
statements are the spice of life
@@ -30,7 +30,7 @@ namespace PuppeteerSharp | |||
/// var browser = await await Puppeteer.LaunchAsync(new LaunchOptions { ExecutablePath = revisionInfo.ExecutablePath}); | |||
/// </code> | |||
/// </example> | |||
public class BrowserFetcher | |||
public class BrowserFetcher : IDisposable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will mean a breaking change and a major version change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting nervous, the more files that changed 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Quite painful, but needed.
It seems the build broke badly https://ci.appveyor.com/project/kblok/puppeteer-sharp/builds/40962024 |
I see the problem. I'm checking a few things over on MSDN, but I should have the tests passing again. |
The issue was I disposed of the timeout task before cancellation had put the task into a finalized state. I think we're ok not to dispose of the timeout task, as the cancellation token source will ensure that the task gets sorted out. |
…ction.cs to resolve issues of transport events firing against the _callbackQueue's disposed semaphore. Added ScreenshotTaskQueue disposal to Browser.cs after the async disposals occur.
It seems netcore builds are getting stuck on |
I'm looking forward to figuring this one out 👀 |
…g queued calls to finish before it disposes of the semaphore. Updated TaskQueue to implement IAsyncDisposable and delegated the Dispose method to use DisposeAsync, in a discard task. Set Browser to call TaskQueue.DisposeAsync() rather than .Dispose(). Set Page to call TaskQueue.DisposeAsync() instead of .Dispose(). Also delegated Dispose's discard task to DisposeAsync(), as they were logically equivalent.
closes #1423
For classes with disposable members, made those classes implement IDisposable, using the recommended Dispose() methods.
This created a ripple effect where the newly disposable classes needed to be disposed of wherever used.
Updated documentation, examples, sample code, and demos where
BrowserFetcher
is used and could be disposed.@kblok sorry, this one has got a lot of changes. Documentation aside, the rest was necessary to satisfy the analyzer.