Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access

Day: December 12, 2025

Visual Studio

VS “Auto-Using Not Working” — The Broken Roslyn Cache Fix

- 12.12.25 - ErcanOPAK comment on VS “Auto-Using Not Working” — The Broken Roslyn Cache Fix

When VS stops adding using statements automatically: ✔ Fix Delete folder: %LocalAppData%\Microsoft\VisualStudio\<version>\ComponentModelCache Restart VS → everything works again.

Read More
Wordpress

WP “Plugin Update Breaks Site” — The Rollback Life-Saver

- 12.12.25 - ErcanOPAK comment on WP “Plugin Update Breaks Site” — The Rollback Life-Saver

Use the plugin: 👉 WP Rollback Allows you to downgrade ANY plugin version instantly. 💡 Perfect for WooCommerce disasters Theme compatibility Checkout errors

Read More
Windows

Windows 11 “SSD Suddenly Slow” — Disabled Write Caching

- 12.12.25 - ErcanOPAK comment on Windows 11 “SSD Suddenly Slow” — Disabled Write Caching

Some updates disable write caching silently. ✔ Fix Device Manager → Disk → Properties → Enable “Write Caching”. 💡 Instant SSD speed boost.

Read More
Windows

Windows 11 “CPU Stays High for No Reason” — SearchIndexer Loop Bug

- 12.12.25 - ErcanOPAK comment on Windows 11 “CPU Stays High for No Reason” — SearchIndexer Loop Bug

Sometimes SearchIndexer.exe loops on corrupted index. ✔ Fix Run: taskkill /IM SearchIndexer.exe /F Then rebuild index. Huge CPU drop.

Read More
Ajax

AJAX “CORS Works in Postman But Fails in Browser” — Preflight Hell

- 12.12.25 - ErcanOPAK comment on AJAX “CORS Works in Postman But Fails in Browser” — Preflight Hell

99% of devs forget this: Preflight requires BOTH headers: Access-Control-Allow-Origin: * Access-Control-Allow-Headers: * ✔ Fix server side Add: Access-Control-Allow-Methods: GET,POST,PUT,DELETE 💡 Why Postman Works Postman does NOT run preflight.Browser does.

Read More
JavaScript

JS “Object Mutation Side Effects” — The Hidden Reference Bug

- 12.12.25 - ErcanOPAK comment on JS “Object Mutation Side Effects” — The Hidden Reference Bug

const a = { x: 5 }; const b = a; b.x = 999; Now a.x is also 999.This breaks apps everywhere. ✔ Fix: Clone before modifying const b = structuredClone(a); or: const b = { …a };  

Read More
HTML

HTML5 “Form Enter Key Submits Wrong Button” — The Invisible Default Button Rule

- 12.12.25 - ErcanOPAK comment on HTML5 “Form Enter Key Submits Wrong Button” — The Invisible Default Button Rule

Browser submits the first submit button by default. ✔ Fix Add formnovalidate or type=”button”: <button type=”button”>Search</button> <button type=”submit”>Save</button> 💡 Hidden Detail Prevent wrong form submissions on mobile.

Read More
CSS

CSS “Text Overflow Ellipsis Not Working” — The Missing Combo

- 12.12.25 - ErcanOPAK comment on CSS “Text Overflow Ellipsis Not Working” — The Missing Combo

Most devs do only: text-overflow: ellipsis; But it requires three rules: overflow: hidden; white-space: nowrap; text-overflow: ellipsis; 💡 Add max-width too for perfect control.

Read More
Asp.Net Core / C#

.NET Core “Configuration Not Updating” — Missing ReloadOnChange

- 12.12.25 - ErcanOPAK comment on .NET Core “Configuration Not Updating” — Missing ReloadOnChange

If you update appsettings.json in production and nothing changes… ✔ Fix builder.Configuration.AddJsonFile( “appsettings.json”, optional: false, reloadOnChange: true ); 💡 Bonus Works even in Kubernetes (mounted config map).

Read More
Asp.Net Core / C#

ASP.NET Core “Middleware Never Executes” — The Ordering Trap

- 12.12.25 - ErcanOPAK comment on ASP.NET Core “Middleware Never Executes” — The Ordering Trap

If you place middleware in the wrong order → it silently does nothing. ❌ Wrong app.UseEndpoints(…); app.UseAuthentication(); ✔ Correct app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(…); 💡 Golden Rule Auth must come BEFORE endpoints.

Read More
SQL

SQL “Dirty Reads & Weird Data” — Fix With SNAPSHOT Isolation

- 12.12.25 - ErcanOPAK comment on SQL “Dirty Reads & Weird Data” — Fix With SNAPSHOT Isolation

Readers block writers, writers block readers → chaos. ✔ The Fix Enable snapshot isolation: ALTER DATABASE MyDB SET READ_COMMITTED_SNAPSHOT ON; 💡 Why Reads no longer block updates → faster API.

Read More
SQL

SQL “Scalar Functions Destroy Performance” — The Hidden Anti-Pattern

- 12.12.25 - ErcanOPAK comment on SQL “Scalar Functions Destroy Performance” — The Hidden Anti-Pattern

Scalar UDFs run row-by-row → slowest possible execution. ✔ Replace with Inline Table-Valued Function CREATE FUNCTION GetPrice(@id INT) RETURNS TABLE AS RETURN SELECT Price FROM Products WHERE Id = @id; Then: SELECT p.*, f.Price FROM Orders o CROSS APPLY GetPrice(o.ProductId) f; 💡 Boost CPU ↓, IO ↓, query ↑.

Read More
C#

C# “Regex Is Slow as Hell” — Missing Compiled Option

- 12.12.25 - ErcanOPAK comment on C# “Regex Is Slow as Hell” — Missing Compiled Option

If regex is used repeatedly: var r = new Regex(pattern); → insanely slow. ✔ Right Way var r = new Regex(pattern, RegexOptions.Compiled); 💡 Speed Boost Up to 20× faster on repeated matches.

Read More
C#

C# “LINQ Select N+1 Disaster” — Why Your Code Makes 500 SQL Calls

- 12.12.25 - ErcanOPAK comment on C# “LINQ Select N+1 Disaster” — Why Your Code Makes 500 SQL Calls

The classic mistake: var users = db.Users.ToList(); var details = users.Select(u => GetDetails(u.Id)).ToList(); If GetDetails hits DB → N+1 query explosion. ✔ SOLUTION: Use Include or Join var data = db.Users .Include(u => u.Details) .ToList(); 💡 Result 500 queries → 1 query CPU + DB load azalır API response hızlanır

Read More
C#

C# “HttpClient Freezing Request” — The Hidden Deadlock: Sync-over-Async

- 12.12.25 - ErcanOPAK comment on C# “HttpClient Freezing Request” — The Hidden Deadlock: Sync-over-Async

Developers still do this: var response = client.GetStringAsync(url).Result; In ASP.NET = 100% guaranteed deadlock. ✔ The Real Fix Make the entire pipeline async: var response = await client.GetStringAsync(url); 💡 Hidden Detail ASP.NET sync context blocks continuation → hard deadlock.

Read More
December 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Nov   Jan »

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (923)
  • How to add default value for Entity Framework migrations for DateTime and Bool (814)
  • Get the First and Last Word from a String or Sentence in SQL (808)
  • How to select distinct rows in a datatable in C# (784)
  • How to make theater mode the default for Youtube (664)
  • Add Constraint to SQL Table to ensure email contains @ (561)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (544)
  • Average of all values in a column that are not zero in SQL (510)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (460)
  • Find numbers with more than two decimal places in SQL (427)

Recent Posts

  • C# Value Types Copied More Than You Think
  • C# Async Void Is Dangerous
  • C# Foreach vs For Performance Difference
  • SQL Deletes Lock Tables
  • SQL Queries Slow Despite Indexes
  • .NET Core APIs Feel Slow Under Load
  • ASP.NET Core Memory Grows Slowly
  • Git Conflicts Keep Reappearing
  • Git Rebase Feels Dangerous
  • Ajax Forms Submit Twice

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (923)
  • How to add default value for Entity Framework migrations for DateTime and Bool (814)
  • Get the First and Last Word from a String or Sentence in SQL (808)
  • How to select distinct rows in a datatable in C# (784)
  • How to make theater mode the default for Youtube (664)

Recent Posts

  • C# Value Types Copied More Than You Think
  • C# Async Void Is Dangerous
  • C# Foreach vs For Performance Difference
  • SQL Deletes Lock Tables
  • SQL Queries Slow Despite Indexes

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com