We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
CAP subscribe currently does not work if I use scoped service that implements IAsyncDisposable but does not implement IDisposable. For example:
IAsyncDisposable
IDisposable
public interface IMyScopedServiceExample : IAsyncDisposable // does not implement IDisposable { } [CapSubscribe("customers")] public class CustomersSubscriberService : ICapSubscribe { private readonly IMyScopedServiceExample _scopedService; public CustomerSubscriberService(IMyScopedServiceExample scopedService) { this.scopedService = scopedService } [CapSubscribe("create", isPartial: true)] public void Create(Customer customer) { } }
Exception is thrown while handling event:
MyScopedServiceExample type only implements IAsyncDisposable. Use DisposeAsync to dispose the container
This happens because CAP does use IServiceScope which does not support IAsyncDisposable services.
Proposed solution: Change this line https://github.com/dotnetcore/CAP/blob/master/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs#L44C9-L44C58 To:
await using var scope = _serviceProvider.CreateAsyncScope();
The text was updated successfully, but these errors were encountered:
Thanks for your feedback, Will be improved in the next version.
Sorry, something went wrong.
Subscriber invoker serviceProvider.CreateScope support IAsyncDispos…
serviceProvider.CreateScope
47c071e
…able. (#1582)
Fixed in version 8.3.0-preview-243613753
8.3.0-preview-243613753
No branches or pull requests
CAP subscribe currently does not work if I use scoped service that implements
IAsyncDisposable
but does not implementIDisposable
. For example:Exception is thrown while handling event:
This happens because CAP does use IServiceScope which does not support
IAsyncDisposable
services.Proposed solution:
Change this line https://github.com/dotnetcore/CAP/blob/master/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs#L44C9-L44C58
To:
The text was updated successfully, but these errors were encountered: