November 2026
Every post published in November 2026, newest first. Pick a day to jump straight to it.
- Posts
- 1,091
- Topics
- 89
- Reading time
- 124 h
- Active days
- 16
Posts 931–960 of 1,091 · November 4, 2026
Page 32 of 37
Wednesday, November 4, 2026
30 of 91 posts
How to Send API Requests from a .http File in VS Code and Visual Studio
Keep your API requests in a .http file next to the code, and send them with a click: the REST Client extension in VS Code, or the built-in editor in Visual Studio. The file format, variables, request separators, JSON bodies and what the response looks like, with a real .NET 10 Web API.
6 min readHow to Make a MySQL Text Comparison Case-Sensitive
By default MySQL treats usb and USB as equal, and cafe and café too. Use COLLATE to compare exactly for one query, learn what utf8mb4_bin and utf8mb4_0900_as_cs do, and see the column's collation that causes it. Every statement run on MySQL 9.7.
5 min readHow to Search Text in MySQL with LIKE and LOCATE
Search for text in MySQL with LIKE and its % and _ wildcards, or with LOCATE, which has none. Find text anywhere or at the start, search for a real percent sign, and see why a lowercase search finds uppercase text. Every statement run on MySQL 9.7.
5 min readHow to Get the Last Inserted ID and Affected Rows in MySQL
LAST_INSERT_ID gives you the ID MySQL just generated, and ROW_COUNT tells you how many rows the last statement changed. See how each one behaves on MySQL 9.7 after an insert, a failed insert, an update that changes nothing, and a delete that finds nothing.
5 min readWhy MySQL AUTO_INCREMENT IDs Have Gaps
Failed inserts and rolled-back transactions use up AUTO_INCREMENT values, so IDs in MySQL skip numbers. See it happen on MySQL 9.7 with a duplicate key and a ROLLBACK, what Oracle's manual says about it, and why it's nothing to fix.
5 min readHow to Check if a MySQL Query Uses an Index with EXPLAIN
Put EXPLAIN in front of a query to see how MySQL will run it. Read the tree format MySQL 9.7 uses by default: table scans, index lookups and covering indexes, on real queries with about 5,000 rows, plus the traditional format and why LIKE '%x%' can't use an index properly.
6 min readHow to Join Two Tables in MySQL
Read from two MySQL tables at once with INNER JOIN and LEFT JOIN: what each one leaves out, how to find rows with no match, and why COUNT(*) gives the wrong number on a LEFT JOIN. Real results on MySQL 9.7, with a table of categories and a table of products.
5 min readHow to Count Rows in a MySQL Table
Count rows in MySQL with COUNT(*), count only the rows that match, count per group with GROUP BY, and get totals with SUM, MIN and MAX. Includes the difference between COUNT(*) and COUNT(column), shown with a real NULL column on MySQL 9.7.
4 min readHow to Page Results in MySQL with LIMIT and OFFSET
Page through MySQL results with LIMIT and OFFSET: the formula for any page, why ORDER BY needs a unique last column, and a real example of the same LIMIT returning different rows because no order was asked for. Run on MySQL 9.7.
5 min readHow to Delete Rows from a MySQL Table Safely
Delete rows from MySQL without losing the wrong ones: check them with a SELECT first, use ROW_COUNT, try it in a transaction you can roll back, and let foreign keys and safe-updates mode stop mistakes. Every step run on MySQL 9.7.
4 min readHow to Update Rows in a MySQL Table Safely
Change rows with UPDATE without changing the wrong ones: check the WHERE with a SELECT first, read Rows matched and Changed, use a transaction you can undo with ROLLBACK, and turn on safe-updates mode. Every step run on MySQL 9.7.
5 min readHow to Insert a Row into a MySQL Table
Add rows to MySQL with INSERT: name the columns, give the values, get the generated ID back with LAST_INSERT_ID, and add several rows in one statement. Every step run on MySQL 9.7, including the error you get for leaving a required column out.
5 min readHow to Read Rows from a MySQL Table with SELECT
Read data from MySQL with SELECT: every column or only the ones you need, one row by its ID, rows that match a condition, sorted results and the first few rows. Every statement run on MySQL 9.7, with its real output.
4 min readFixed: "Body was inferred but the method does not allow inferred body parameters" in a Minimal API
One GET endpoint with a record parameter made every request in a minimal API answer 500: InvalidOperationException: Body was inferred but the method does not allow inferred body parameters. GET requests don't get a JSON body. How [AsParameters] or a POST fixes it, and why one bad endpoint breaks them all.
6 min readFixed: "Cannot resolve scoped service 'InventoryDbContext' from root provider" in ASP.NET Core
Asking app.Services for a DbContext in Program.cs crashed the app at startup with InvalidOperationException: Cannot resolve scoped service from root provider. There's no request yet, so there's no scope. How CreateAsyncScope gives you one for startup work.
5 min readFixed: "Cannot consume scoped service 'DbContextOptions' from singleton" in ASP.NET Core
An ASP.NET Core API wouldn't start: Cannot consume scoped service DbContextOptions<InventoryDbContext> from singleton CategoryCache. A singleton lives for the whole app, and a DbContext for one request. Why Development catches this at startup, and how IServiceScopeFactory fixes it.
6 min readFixed: A Missing Number in a JSON Request Becomes 0 in an ASP.NET Core Minimal API
A request with no unitPrice was accepted, and the price quietly became 0, because a C# decimal can't be null and [Required] can't see a difference. Making the property decimal? with [Required] turns it into a clear 400. Shown on .NET 10 with AddValidation.
5 min readFixed: "415 Unsupported Media Type" from a POST to an ASP.NET Core Minimal API
A POST with valid JSON answered 415 Unsupported Media Type, and the log showed no error, because curl sends application/x-www-form-urlencoded unless told otherwise. How the debug log reveals it, and the one header that fixes it in curl, .http files and PowerShell.
5 min readFixed: "error CA1848: For improved performance, use the LoggerMessage delegates" in .NET
A plain logger.LogInformation call stopped a .NET 10 build with CA1848, and CA1873 when an argument looks expensive, because the solution treats warnings as errors with latest-recommended analysis. The LoggerMessage source generator fixes both, in a few lines.
5 min readFixed: "error CS0266: Cannot implicitly convert type 'decimal?' to 'decimal'" in C# (Nullable Decimal)
Assigning a decimal? to a decimal property stopped the build with CS0266: Cannot implicitly convert type 'decimal?' to 'decimal'. An explicit conversion exists (are you missing a cast?). The cast it suggests compiles, and throws at runtime on null. What to write instead.
4 min readFixed: "error CS8629: Nullable value type may be null" in C#
Using .Value on a decimal? property stopped the build with CS8629: Nullable value type may be null, because TreatWarningsAsErrors turns the warning into an error. The request is validated before the code runs, but the compiler can't know that. Three ways to fix it, and how to choose.
5 min readFixed: "error CS1593: Delegate 'RequestDelegate' does not take 2 arguments" in a Minimal API
A minimal API lambda that returned TypedResults.NotFound() or TypedResults.Ok() from a ternary failed with CS1593: Delegate 'RequestDelegate' does not take 2 arguments. The real problem is that the lambda has no return type C# can work out. Two ways to fix it, and what each one does to your OpenAPI document.
5 min readFixed: "error CS1929: 'DbSet<Category>' does not contain a definition for 'FirstOrDefaultAsync'" in .NET 10
On .NET 10, a missing using Microsoft.EntityFrameworkCore no longer gives the old message. It gives CS1929 pointing at AsyncEnumerable.FirstOrDefaultAsync, and CS0411 for ToListAsync, which send you the wrong way. Why System.Linq.AsyncEnumerable shows up, and the one line that fixes all of them.
5 min readFixed: "The query uses the 'First'/'FirstOrDefault' operator without 'OrderBy' and filter operators" in EF Core
EF Core logged warn: The query uses the 'First'/'FirstOrDefault' operator without 'OrderBy' and filter operators. This may lead to unpredictable results. The query worked, but nothing said which row is first. Why that matters on MySQL, and what removes the warning.
6 min readFixed: "The query uses a row limiting operator ('Skip'/'Take') without an 'OrderBy' operator" in EF Core
EF Core logged warn: The query uses a row limiting operator ('Skip'/'Take') without an 'OrderBy' operator. This may lead to unpredictable results. The endpoint still answered 200, in an order nobody chose. How MySQL picked that order, and how to make pages stable.
7 min readFixed: "Expression 'COLLATE utf8mb4_bin' in the SQL tree does not have a type mapping assigned" in EF Core with MySQL
Passing StringComparison.OrdinalIgnoreCase to Contains in an EF Core query failed with Oracle's MySQL provider: InvalidOperationException: Expression '[SqlExpressions.SqlFunctionExpression] COLLATE utf8mb4_bin' in the SQL tree does not have a type mapping assigned. The column's collation already ignores case, so the argument isn't needed.
7 min readFixed: EF Core StartsWith Finds Nothing While Contains Works (Case-Sensitive with Oracle's MySql.EntityFrameworkCore)
With Oracle's MySql.EntityFrameworkCore provider, Contains("usb") found USB-C products but StartsWith("usb") returned an empty list. The provider adds COLLATE utf8mb4_bin to StartsWith and EndsWith, which makes them case-sensitive. EF.Functions.Like gives case-insensitive prefix searches.
7 min readFixed: "Sequence contains more than one element" with EF Core SingleOrDefaultAsync
SingleOrDefaultAsync threw InvalidOperationException: Sequence contains more than one element because the query matched several rows, and the OrDefault in its name doesn't help. Why it sends LIMIT 2, how to tell whether your filter or your data is wrong, and what to use instead.
6 min readFixed: "Sequence contains no elements" with EF Core FirstAsync
A GET for an ID that doesn't exist answered 500 with InvalidOperationException: Sequence contains no elements, because FirstAsync throws when no row matches. The query ran fine and found nothing. How FirstOrDefaultAsync turns that into a clean 404, and when FirstAsync is still right.
5 min readFixed: "Cannot access a disposed context instance" in EF Core
A background task in an ASP.NET Core API failed with ObjectDisposedException: Cannot access a disposed context instance, while the request itself answered 200. The DbContext belonged to the request, and it was gone by the time the task ran. How to give background work its own scope.
6 min read