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

Visual Studio

Visual Studio High CPU When Idle? Live Code Analysis

- 13.12.25 - ErcanOPAK comment on Visual Studio High CPU When Idle? Live Code Analysis

Background analyzers can eat CPU. ✅ Fix Disable unused analyzers: Tools → Options → Text Editor → C# → Advanced Turn off: Full solution analysis

Read More
Wordpress

WordPress Slow Admin Panel? Heartbeat API

- 13.12.25 - ErcanOPAK comment on WordPress Slow Admin Panel? Heartbeat API

WordPress sends frequent AJAX calls. ✅ Fix Install Heartbeat ControlReduce frequency or disable in admin. Result Faster editor Lower CPU usage

Read More
Windows

Windows 11 Micro-Stutters in Apps? Disable MPO

- 13.12.25 - ErcanOPAK comment on Windows 11 Micro-Stutters in Apps? Disable MPO

Multi-Plane Overlay causes flickering and stutter. ✅ Fix (Registry) DisableMPO = 1 (Path: GraphicsDrivers)

Read More
Windows

Windows 11 Laptop Slow on Battery? CPU Throttling

- 13.12.25 - ErcanOPAK comment on Windows 11 Laptop Slow on Battery? CPU Throttling

Windows limits CPU aggressively. ✅ Fix powercfg /setactive SCHEME_MIN Or switch to Best Performance power mode.

Read More
Ajax / JavaScript

AJAX Requests Fail Randomly? CSRF Token Missing

- 13.12.25 - ErcanOPAK comment on AJAX Requests Fail Randomly? CSRF Token Missing

POST requests fail silently without CSRF token. ✅ Fix headers: { ‘X-CSRF-TOKEN’: token } Common victims Laravel Django ASP.NET MVC

Read More
JavaScript

JS “await” Inside forEach Is a Bug

- 13.12.25 - ErcanOPAK comment on JS “await” Inside forEach Is a Bug

This does NOT work: items.forEach(async item => { await process(item); }); ✅ Correct Patterns for (const item of items) { await process(item); } or parallel: await Promise.all(items.map(process));  

Read More
HTML

HTML5 Lazy Loading Without JavaScript

- 13.12.25 - ErcanOPAK comment on HTML5 Lazy Loading Without JavaScript

Stop writing JS for images. <img src=”image.jpg” loading=”lazy” /> Benefits Faster page load Better Core Web Vitals Zero JavaScript

Read More
CSS

CSS 100vh Is Broken on Mobile (Real Fix)

- 13.12.25 - ErcanOPAK comment on CSS 100vh Is Broken on Mobile (Real Fix)

height: 100vh breaks on mobile browsers. ✅ Correct Solution height: 100dvh; Or fallback: min-height: -webkit-fill-available; Why Mobile address bars change viewport height dynamically.

Read More
Asp.Net Core / C#

ASP.NET Core Thread Pool Starvation Explained

- 13.12.25 - ErcanOPAK comment on ASP.NET Core Thread Pool Starvation Explained

Symptoms: Random timeouts CPU low but requests hang Root cause Blocking calls inside async code: Task.Delay(1000).Wait(); ✅ Fix await Task.Delay(1000); Rule Never block threads in ASP.NET.

Read More
Asp.Net Core / C#

ASP.NET Core Logging Slows Your API (Yes, Really)

- 13.12.25 - ErcanOPAK comment on ASP.NET Core Logging Slows Your API (Yes, Really)

This is expensive: _logger.LogInformation($”User {id} logged in”); ✅ Correct Way _logger.LogInformation(“User {UserId} logged in”, id); Why Avoids string interpolation Enables structured logging Reduces allocations

Read More
SQL

SQL Index Exists but Still Not Used? Here’s Why

- 13.12.25 - ErcanOPAK comment on SQL Index Exists but Still Not Used? Here’s Why

SQL ignores indexes when: Data type mismatch Implicit conversion Example problem: WHERE UserId = ‘123’ — string ✅ Fix WHERE UserId = 123 — int Golden rule Indexes only work when types match exactly.

Read More
SQL

SQL COUNT(*) Is Slower Than You Think

- 13.12.25 - ErcanOPAK comment on SQL COUNT(*) Is Slower Than You Think

This query scans rows: SELECT COUNT(*) FROM Orders; ✅ Faster Metadata Count (Approximate) SELECT SUM(row_count) FROM sys.dm_db_partition_stats WHERE object_id = OBJECT_ID(‘Orders’) AND index_id IN (0,1); Use when Dashboards Monitoring Large tables

Read More
C#

C# ValueTask — The Hidden Performance Weapon

- 13.12.25 | 13.12.25 - ErcanOPAK comment on C# ValueTask — The Hidden Performance Weapon

Most async methods return Task<T> even when they complete synchronously. ✅ Better for hot paths public ValueTask<int> GetCachedValueAsync() { return ValueTask.FromResult(42); } When to use Cache hits High-frequency calls Allocation-sensitive paths

Read More
C#

C# Dictionary Lookup Slow? You’re Using It Wrong

- 13.12.25 - ErcanOPAK comment on C# Dictionary Lookup Slow? You’re Using It Wrong

This is inefficient: if (dict.ContainsKey(key)) value = dict[key]; ✅ Correct Way if (dict.TryGetValue(key, out var value)) { // use value } Why Avoids double hash lookup Faster under high frequency usage

Read More
C#

C# Task.WhenAll Can Kill Your Server (Concurrency Trap)

- 13.12.25 - ErcanOPAK comment on C# Task.WhenAll Can Kill Your Server (Concurrency Trap)

This looks innocent: await Task.WhenAll(requests.Select(r => ProcessAsync(r))); But if requests = 10,000 items →you just spawned 10,000 concurrent tasks. ✅ Safe Pattern using var semaphore = new SemaphoreSlim(10); await Task.WhenAll(requests.Select(async r => { await semaphore.WaitAsync(); try { await ProcessAsync(r); } finally { semaphore.Release(); } })); Why this matters Prevents thread starvation Protects downstream services Stabilizes […]

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