-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Nullability of reference types in type of parameter 'b' of 'lambda expression' doesn't match the target delegate 'Action<KeysetPaginationBuilder<Category?>>' (possibly because of nullability attributes). csharp(CS8622) #6
Comments
I'm not familiar with Roslynator so I can't comment much on that, but the usage of null suppressions ( |
Thank you very much. I just worked on it and explicitly passed in the
Warning: PaginationService code snippet:
Question on PaginationService code snippet: |
These warnings are actually true in that there's a mismatch, so you can for example do a null suppression in the async id => await _dbContext.Categories.FindAsync(Guid.Parse(id))!, Since async id =>
{
var r = await _dbContext.Categories.FindAsync(Guid.Parse(id));
if (r == null) throw new ...Exception();
return r;
} I wondered before if this should be handled on the library level (so |
Aha, great, thank you. Will do just that. |
So regarding this: MR.AspNetCore.Pagination/src/MR.AspNetCore.Pagination/PaginationService.cs Lines 268 to 281 in ad81c62
The reason the |
Should be fixed in v2.0.1. |
Version Used: 2.0.0
I'm making using of Roslynator extension in VSCode for code refactoring, fixing, analyzing etc.
Nullable is also enabled
Target framework: 6.0
Code snippet
Compilation warnings:
Nullability of reference types in type of parameter 'b' of 'lambda expression' doesn't match the target delegate 'Action<KeysetPaginationBuilder<Category?>>' (possibly because of nullability attributes). csharp(CS8622)
The type 'SoftPurse.Modules.ServiceCatalog.Core.Catalog.Aggregates.Category?' cannot be used as type parameter 'T' in the generic type or method 'IPaginationService.KeysetPaginateAsync<T, TOut>(IQueryable<T>, Action<KeysetPaginationBuilder<T>>, Func<string, Task<T>>, Func<IQueryable<T>, IQueryable<TOut>>, KeysetQueryModel)'. Nullability of type argument 'SoftPurse.Modules.ServiceCatalog.Core.Catalog.Aggregates.Category?' doesn't match 'class' constraint. csharp(CS8634)
Note: Category mention here is the entity.
It is being inferred as
await _paginationService.KeysetPaginateAsync<Category?, GetKeysetPagedCategoriesResponse>(...)
The text was updated successfully, but these errors were encountered: