2026
Every post published in 2026, newest first. Pick a month to narrow it down.
- Posts
- 1,054
- Topics
- 114
- Reading time
- 128 h
- Active months
- 6
Posts 661–690 of 1,054 · November 4, 2026
Page 23 of 36
November 2026
802 postsWednesday, November 4, 2026
30 of 91 posts
Fixed: "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 readFixed: "A second operation was started on this context instance before a previous operation completed" in EF Core
Running three EF Core queries with Task.WhenAll on one DbContext threw InvalidOperationException: A second operation was started on this context instance. And the same code sometimes worked, which makes it worse. Why a DbContext can't run two things at once, and the two ways to fix it.
7 min readFixed: "The instance of entity type cannot be tracked because another instance with the same key value is already being tracked" in EF Core
Calling Update on a new object after loading the same row threw InvalidOperationException: The instance of entity type 'Category' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. Why EF Core allows one object per row, and the simple way to update instead.
7 min readFixed: "JSON deserialization for type was missing required properties" in an ASP.NET Core Minimal API
Binding a request to a class with C# required properties failed with JsonException: JSON deserialization for type 'Category' was missing required properties including: 'name', and clients got a bare 400. Why the required keyword answers this way, and how a request record with validation gives a useful message.
6 min readFixed: "A possible object cycle was detected" When Returning EF Core Entities from a Web API
Returning EF Core entities from an ASP.NET Core endpoint failed with JsonException: A possible object cycle was detected, because Category has Products and each Product has a Category. Why Include causes it, why a Select to a response record is the real fix, and what ReferenceHandler.IgnoreCycles does instead.
7 min readFixed: DbUpdateConcurrencyException "The database operation was expected to affect 1 row(s), but actually affected 0 row(s)" in EF Core
DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s). Three real ways to get it with EF Core and MySQL: a stale concurrency token, a row someone else deleted, and Update on an ID that doesn't exist. How to tell which one you have, and how to answer each.
9 min readFixed: "Failure to infer one or more parameters" in an ASP.NET Core Minimal API
Every request to a minimal API answered 500 with InvalidOperationException: Failure to infer one or more parameters, listing clock as UNKNOWN. The endpoint asked for a service that was never registered. How to read the table in the message, and the one line that fixes it.
6 min readFixed: "InvalidCastException: Unable to cast object of type 'System.Attribute[]' to type 'IEnumerable`1[ValidationAttribute]'" with AsParameters in /openapi/v1.json
After adding a record with validation attributes and [AsParameters] to a minimal API, /openapi/v1.json answered 500 with InvalidCastException in ApplyParameterInfo. It's a known ASP.NET Core 10 bug, fixed for .NET 11. Putting property: on the attributes fixes it today, and validation keeps working.
7 min readFixed: "BadHttpRequestException: Failed to read parameter from the request body as JSON" Returns 500 Instead of 400 in a Minimal API
With UseExceptionHandler and ProblemDetails in ASP.NET Core 10, broken JSON and bad query values answered 500 in Development, logged as BadHttpRequestException, but 400 in Production. Why the two environments differ, and how StatusCodeSelector keeps the client's 400.
7 min readFixed: "Unable to retrieve project metadata. Ensure it's an SDK-style project." in dotnet ef
dotnet ef failed in a freshly cloned .NET project with error NETSDK1004: Assets file project.assets.json not found, and Unable to retrieve project metadata. Ensure it's an SDK-style project. The project is SDK-style: it just hasn't been restored yet. One command fixes it.
5 min readFixed: "The model for context has pending changes. Add a new migration before updating the database." in EF Core
dotnet ef database update printed The model for context 'InventoryDbContext' has pending changes, then No migrations were applied and Done, with exit code 0, while the new column was still missing from MySQL. Two causes: no migration for the change, or tools running on a stale build. How to tell them apart.
7 min readFixed: "The migration 'AddProductVersion' was not found." with dotnet ef --no-build
dotnet ef migrations script failed with System.InvalidOperationException: The migration 'AddProductVersion' was not found, seconds after dotnet ef migrations add created it. The migration file existed, but --no-build ran the tools on a DLL built before it. How to spot that, and when --no-build is safe.
5 min readFixed: "ERROR 1175 (HY000): You are using safe update mode" in MySQL
MySQL refuses an UPDATE or DELETE with ERROR 1175 when safe-updates mode is on and the WHERE doesn't use a key column. See which statements it lets through, why a WHERE on a plain column still fails, and how to work with it, not around it. Run on MySQL 9.7.
6 min readFixed: "ERROR 1364 (HY000): Field doesn't have a default value" in MySQL
MySQL refuses an INSERT with ERROR 1364 when a column that can't be NULL has no default and isn't in your statement. Here's how to read that from SHOW COLUMNS, what strict SQL mode has to do with it, and the two real fixes, run on MySQL 9.7.
6 min readFixed: MySQL Rounds a Decimal Like 9.999 to 10.00 Without an Error (Note 1265: Data truncated for column)
An API accepted a price of 9.999 and MySQL stored 10.00, with no error, even in strict mode. A DECIMAL(12,2) column rounds extra decimal places and only raises Note 1265, which EF Core never shows. How to see the note, and how to refuse such a value with a validation attribute.
7 min readFixed: "Data too long for column 'Name' at row 1" When Saving with EF Core and MySQL
A POST to an ASP.NET Core API answered 500 because a name was longer than its varchar(100) column: MySqlException: Data too long for column 'Name' at row 1, inside a DbUpdateException. How to find the column's limit, and how a StringLength attribute turns it into a clear 400.
7 min readFixed: "Unknown column 'p.Version' in 'field list'" with EF Core and MySQL
An ASP.NET Core API answered 500 with MySqlException: Unknown column 'p.Version' in 'field list' right after a new property was added to an EF Core entity. The C# model and the MySQL table disagreed. How to confirm that in one command, and how a migration fixes it.
7 min readFixed: "missed comma between flow collection entries" in Docusaurus Front Matter
A site check refused a blog post's front matter with missed comma between flow collection entries, and the comma was right there. In a YAML [ ] list, a # after a space starts a comment, and [ ] inside a word ends the list. Here are both causes, and the two fixes.
6 min readFixed: "ModuleNotFoundError: No module named 'PIL'" in Python
Python says No module named 'PIL', and pip install PIL fails too, because the package you need is called Pillow. Install it into a virtual environment, and run your script with that environment's Python. Real output from Python 3.15.2 and Pillow 13.0.0.
5 min readFixed: "montage: unable to read font" in ImageMagick on macOS
ImageMagick's montage printed unable to read font when asked for labels, and made a contact sheet with none. The cause was a build with no list of fonts. Name a font file with -font, before the images. Includes the silent mistake of putting the option after them.
5 min read