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 System.ObjectDisposedException when calling StopAsync() #147

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

Socolin
Copy link
Contributor

@Socolin Socolin commented Dec 27, 2020

Hello

There is a crash when stopping the webjob.

I use this in tests to start/stop some services and when it crash it prevent other services to be disposed / stopped gracefully, and the test process is stuck

            var host = builder.Build();
            using (host)
            {
                await host.StartAsync();
                await Task.Delay(2_000);
                await host.StopAsync();
            }

@JatinSanghvi
Copy link
Contributor

Letting the PR go through. A better fix might be possible but I cannot think of it right away. This one does the job, for example, Cancel closes the connection if StopAsync does not get called before it, and it skips (since there's nothing to be done) if StopAsync is already called.

@JatinSanghvi JatinSanghvi merged commit 7163dbb into Azure:dev Jan 31, 2022
@JatinSanghvi
Copy link
Contributor

Thanks @Socolin 🎉

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.

2 participants