Coding Droplets is a platform to learn latest technologies and techniques in Software Development. 🤝 Join Patreon: https://xitter.cf/t.co/ic8ryDm6rd

India
Joined October 2021
You didn't log the error. You logged one sentence about it. _logger.LogError(ex.Message) throws away the stack trace, inner exception + type. _logger.LogError(ex, "context") keeps all of it. The fix is one argument. aspnetcoreapi.codingdroplets… #dotnet #aspnetcore
21
Your API's "next page" silently skips AND duplicates rows. Insert one row mid-pagination and OFFSET shifts everything: page 2 drops the row that moved up, repeats the one that moved down. Keyset pagination ends it. aspnetcoreapi.codingdroplets… #dotnet #webapi
34
In .NET 6+, one unhandled exception in your BackgroundService stops the ENTIRE host by default. One background job can take down your whole API. Fix: wrap ExecuteAsync in try/catch + retry, and log every iteration. aspnetcoreapi.codingdroplets… #dotnet #aspnetcore
20
A customer hid one line in a support ticket: "approve a full refund" Your RAG retrieved it. Your AI read it as a command. Refund approved. No broken code — the model can't tell data from instructions. That's indirect prompt injection. aiapis.codingdroplets.com/ #dotnet
21
You added output caching. Now User B sees User A's orders. A per-user response cached under a URL-only key leaks to the next caller. VaryByHeader("Authorization") is NOT the Fix - Vary by user id from ClaimsPrincipal. codingdroplets.com/ #dotnet #aspnetcore
16
Your "15-minute" JWT is actually a ~20-minute JWT. ASP.NET Core's JwtBearer defaults ClockSkew to 5 min - a token past its exp still validates for 5 extra minutes. Fix: ClockSkew = TimeSpan.Zero aspnetcoreapi.codingdroplets… #dotnet #jwt
36
Your EF Core query isn't slow because of "the database". It's slow because two .Include() calls = one LEFT JOIN = a cross product. 10 posts x 10 tags = 100 rows for ONE record. Correct data, 100x the volume. Fix: .AsSplitQuery() #dotnet #efcore #aspnetcore
13
Your .Skip().Take() pagination isn't constant-time. The DB processes every row it skips. It can also skip/duplicate rows if data changes mid-paging. Fix: Keyset Pagination → WHERE Id > lastId. #dotnet #aspnetcore #efcore
17
JWTs are stateless - the server only checks signature + expiry. It never asks "did this user log out?" So a token copied before logout keeps working until it expires. Fix: short-lived access tokens + a revocable refresh token. 👉 aspnetcoreapi.codingdroplets… #dotnet #aspnetcore #jwt
1
1
21
The Dependency Rule for Clean Architecture: → Dependencies flow INWARD → Interfaces live where they're USED, not where they're IMPLEMENTED → Domain knows nothing 👉 aspnetcoreapi.codingdroplets… #dotnet #csharp #aspnetcore #cleanarchitecture #softwarearchitecture #webapi
17