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 8, 2025

Visual Studio

Visual Studio “Build Never Stops” — The Rogue MSBuild Node Issue

- 08.12.25 - ErcanOPAK comment on Visual Studio “Build Never Stops” — The Rogue MSBuild Node Issue

Sometimes build gets stuck forever at 0%. ✔ Life-Saving Fix taskkill /IM MSBuild.exe /F taskkill /IM VBCSCompiler.exe /F Restart VS → build works instantly. 💡 Why It Happens Zombie MSBuild nodes fail to unload.

Read More
Wordpress

WordPress “Images Not Updating” — The Persistent Cache Trap

- 08.12.25 - ErcanOPAK comment on WordPress “Images Not Updating” — The Persistent Cache Trap

Even if you upload a new image, WP serves the cached thumbnail. ✔ Fix Delete old thumbnails: /wp-content/uploads/YYYY/MM/imagename-*x*.jpg Then regenerate thumbnails using plugin: ✨ Regenerate Thumbnails. Instant fix for “image not updating” issues.

Read More
Windows

Windows 11 “High RAM Usage After Sleep” — Memory Compression Bug

- 08.12.25 - ErcanOPAK comment on Windows 11 “High RAM Usage After Sleep” — Memory Compression Bug

Windows sometimes never releases compressed memory. ✔ Fix Run: powershell -command “Disable-MMAgent -mc” powershell -command “Enable-MMAgent -mc” Resets memory manager without reboot.

Read More
Windows

Windows 11 “Audio Crackling” — The Hidden CPU Scheduling Bug

- 08.12.25 - ErcanOPAK comment on Windows 11 “Audio Crackling” — The Hidden CPU Scheduling Bug

This happens on systems using: Realtek chips Low latency settings CPU parking ✔ Fix Disable MMCSS Audio Throttling: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Audio /v DisableMMCSS /t REG_DWORD /d 1 /f Restart → audio becomes crystal clear.

Read More
Ajax / JavaScript

AJAX “Stale Data” — Browser Caching GET Requests Deeply

- 08.12.25 - ErcanOPAK comment on AJAX “Stale Data” — Browser Caching GET Requests Deeply

Even server changes don’t update responses. ✔ Fix $.ajax({ url: “/api/data”, cache: false }); or fetch: fetch(“/api/data”, { cache: “no-store” }); Instantly fixes “old response stuck” issue.

Read More
JavaScript

JS “Unexpected NaN” — The Invisible Type Coercion Trap

- 08.12.25 - ErcanOPAK comment on JS “Unexpected NaN” — The Invisible Type Coercion Trap

Common bug: “5” – “2” // works => 3 “5” + “2” // ’52’ “5” * “hi” // NaN JS coerces AND behaves inconsistently. ✔ Life-Saving Fix Always convert: Number(value) or parseInt(value, 10) 💡 Bonus Trap parseInt(“08”) returns 8 but “08” == 8 is true → chaos.

Read More
HTML

HTML5 Video Autoplay Failing? — The REAL Browser Requirement

- 08.12.25 - ErcanOPAK comment on HTML5 Video Autoplay Failing? — The REAL Browser Requirement

Chrome, Safari, Firefox → all require muted autoplay. ✔ Correct Way <video autoplay muted playsinline> <source src=”video.mp4″ type=”video/mp4″> </video> If muted is missing → autoplay is blocked. 💡 Mobile Tip Add playsinline to avoid fullscreen takeover.

Read More
CSS

CSS Grid “Overflow Bug” — When Your Layout Randomly Breaks

- 08.12.25 - ErcanOPAK comment on CSS Grid “Overflow Bug” — When Your Layout Randomly Breaks

If a grid child is bigger than the track → grid collapses. ✔ Life-Saving Fix Add: min-width: 0; min-height: 0; ⚠ Why? CSS Grid defaults are NOT zero — they try to preserve content size.This breaks responsive layouts.

Read More
Asp.Net Core / C#

ASP.NET Core “IHostedService Never Stops” — Fixing Broken Graceful Shutdowns

- 08.12.25 - ErcanOPAK comment on ASP.NET Core “IHostedService Never Stops” — Fixing Broken Graceful Shutdowns

Many background workers never stop on SIGTERM. ✔ Real Fix Bind cancellation token: public Task StartAsync(CancellationToken ct) { _ = DoWorkAsync(ct); return Task.CompletedTask; } 💡 Super Tip In Program.cs: builder.Services.AddHostedService<MyWorker>(); builder.Services.Configure<HostOptions>(o => { o.ShutdownTimeout = TimeSpan.FromSeconds(20); }); Most devs don’t know this exists → massively improves controlled shutdown.

Read More
Asp.Net Core / C#

.NET Core Dependency Injection “Multiple Registrations” Bug

- 08.12.25 - ErcanOPAK comment on .NET Core Dependency Injection “Multiple Registrations” Bug

This bug causes random services to switch implementations unexpectedly. ⚠ Problem Registering twice: services.AddSingleton<IMailer, SmtpMailer>(); services.AddSingleton<IMailer, FakeMailer>(); ASP.NET Core uses the last registration → extremely hard-to-debug issues. ✔ Fix Remove duplicates OR name your registrations: services.AddSingleton<IMailer, SmtpMailer>(“smtp”); 💡 Hidden Debug Trick Log all registrations: services.ToList().ForEach(x => Console.WriteLine(x.ServiceType));  

Read More
SQL

SQL “Blocking Sessions” — The Hidden Killer: Orphaned Transactions

- 08.12.25 - ErcanOPAK comment on SQL “Blocking Sessions” — The Hidden Killer: Orphaned Transactions

Long-running transaction = entire DB slowdown. ✔ Quick Diagnostic SELECT * FROM sys.dm_tran_active_transactions; If you see an uncommitted transaction running for hours → that’s your culprit. ✔ The Fix Enable XACT_ABORT to auto-kill faulty transactions: SET XACT_ABORT ON; This is rarely known but prevents ghost locks forever.

Read More
SQL

SQL “Slow Pagination” — The Secret Trick: Seek Method

- 08.12.25 - ErcanOPAK comment on SQL “Slow Pagination” — The Secret Trick: Seek Method

Most devs use: ORDER BY Id OFFSET @Skip ROWS FETCH NEXT @Take ROWS This is painfully slow after page 5000+because SQL scans all skipped rows. ✔ REAL FIX: Seek Pagination SELECT TOP (@Take) * FROM Orders WHERE Id > @LastSeenId ORDER BY Id; 💡 Benefit No full scans No offsets Linear, predictable speed

Read More
C#

C# “List Reallocations” — Stop Hidden Performance Loss

- 08.12.25 - ErcanOPAK comment on C# “List Reallocations” — Stop Hidden Performance Loss

Large lists cause hidden reallocations: ⚠ Problem When List grows past capacity → reallocates + copies entire array. ✔ Fix Pre-size it: var list = new List<Order>(50000); 💡 Hidden Tip To estimate size: use .Count from previous runs → AUTO-TUNE your list capacity.

Read More
C#

C# DTO Mapping Speed Issues — The Hidden Cost of Reflection in AutoMapper

- 08.12.25 - ErcanOPAK comment on C# DTO Mapping Speed Issues — The Hidden Cost of Reflection in AutoMapper

Many devs see slow API responses and blame SQL, not realizing the slowdown is Mapper. ⚠ The Problem AutoMapper uses reflection for complex object graphs.Under load → becomes slow. ✔ Life-Saver Solution Switch to compiled mapping: var config = new MapperConfiguration(cfg => { cfg.CreateMap<User, UserDto>().ConvertUsing(src => new UserDto(src.Id, src.Name)); }); or write your own mapping: […]

Read More
C#

C# “Random Freezes” — The REAL Cause: Async → Sync Deadlocks

- 08.12.25 - ErcanOPAK comment on C# “Random Freezes” — The REAL Cause: Async → Sync Deadlocks

Developers often write: var result = GetDataAsync().Result; or var result = GetDataAsync().GetAwaiter().GetResult(); This is how 80% of production deadlocks happen. 👉 Why It Deadlocks Async code tries to resume on the captured context (SynchronizationContext).But since you blocked the thread with .Result, it can’t resume → deadlock. ✔ The Fix Make the entire call chain async: […]

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