Most devs know not to use new HttpClient(),but they forget the REAL killer: DNS caching. Containers change DNS → HttpClient reuses stale DNS forever. ✔ Fix Use SocketsHttpHandler.PooledConnectionIdleTimeout: builder.Services.AddHttpClient(“api”) .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { PooledConnectionIdleTimeout = TimeSpan.FromMinutes(2) }); Prevents DNS poisoning.
Author: ErcanOPAK
ASP.NET Core “Random 404 After Deploy” — Broken Routing Cache
Kestrel caches endpoints.When you add a new route but deploy without clearing the build output → ghost routes happen. ✔ Fix Add this to .csproj: <PropertyGroup> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> </PropertyGroup> Ensures routes rebuild properly every deploy.
SQL “Parameter Sniffing Hell” — The REAL Fix Nobody Uses
When SQL caches a plan for one specific parameter, other queries become slow. Most people use OPTION RECOMPILE.BUT the REAL fix? ✔ Create an optimized local variable DECLARE @local INT = @UserId; SELECT … WHERE UserId = @local; SQL can no longer sniff the parameter → balanced plan for all users.
SQL “Zombie TempDB” — The Invisible Performance Killer
TempDB grows silently until EVERYTHING slows. ✔ Fix: Right-size files ALTER DATABASE tempdb MODIFY FILE (NAME=’tempdev’, SIZE=4GB); And create multiple TempDB files: 4–8 files = massive improvement 💡 Why? TempDB is used for: joins sorting hashing version store This tweak alone boosts 90% of sluggish systems.
C# “DateTime.Now Is Lying to You” — The Hidden Clock Skew Bug
Microservices deployed across containers = clock drifting. DateTime.Now can differ by 1-4 seconds between services → token validation fails → weird 401 errors. ✔ Use: DateTime.UtcNow Even better: ISystemClock clock 💡 Hidden Detail JWT validation is extremely sensitive to skew.Use: ClockSkew = TimeSpan.FromMinutes(2)
C# Memory Leak: Event Handlers Never Unsubscribe
The classic leak: service.OnData += Handler; If you never do: service.OnData -= Handler; your entire object stays in memory FOREVER. ✔ Life-Saving Pattern using var reg = service.OnData.Register(Handler); Self-disposing event registration.Almost nobody uses this but it prevents weeks-long debugging nightmares.
C# “Async LINQ Disaster” — Why Your Parallel Queries Freeze Your App
Developers commonly mix async with LINQ: var results = items.Select(async x => await Process(x)); await Task.WhenAll(results); Looks correct, right?Nope. This triggers thousands of async state machines, killing perf. await Parallel.ForEachAsync(items, async (item, ct) => { await Process(item); }); 💡 Why It Saves You uses shared workers avoids micro-task explosion predictable throughput
VS “Debugger Attached But Breakpoints Skip” — The Optimization Trap
If breakpoints turn hollow → VS cannot attach because JIT optimized code away. ✔ Fix Project → Properties → Build → Uncheck “Optimize code”Then: Clean → Rebuild → Restart VS 💡 Hidden Tip Also ensure: Debug → Options → Enable Just My Code
WP “Permalinks Not Working” — The .htaccess Rewrite Reset
Sometimes WP permalinks break silently. ✔ Fix Go to:Settings → Permalinks → Save (without changing) This regenerates .htaccess with: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress Instant fix.
Windows 11 “VPN Slow After Update” — Broken MTU
Windows updates sometimes reset MTU to a suboptimal value. ✔ Detect: ping google.com -f -l 1472 Reduce until no fragmentation. ✔ Apply Fix: netsh interface ipv4 set subinterface “Ethernet” mtu=1400 store=persistent
Windows 11 “Alt-Tab Lag” — The Explorer Restart Trick
Alt-Tab becomes slow due to animation caching. ✔ Fix: taskkill /IM explorer.exe /F start explorer.exe Refreshes UI animation buffers.
AJAX “POST Suddenly Fails” — The Missing Content-Type Header
Many backends reject requests silently. ✔ Fix: $.ajax({ method: “POST”, url: “/api/data”, contentType: “application/json”, data: JSON.stringify({ id: 1 }) }); Missing contentType = backend can’t parse payload.
JS “Undefined Errors in Loops” — The Closure Trap
Typical bug: for (var i = 0; i < 5; i++) { setTimeout(() => console.log(i), 100); } Output: 5 5 5 5 5 Because var is function-scoped. ✔ Fix for (let i = 0; i < 5; i++) { setTimeout(() => console.log(i), 100); } Or: setTimeout(((x)=>()=>console.log(x))(i), 100);
HTML5 Input “step=any” — The Secret to Fix Broken Decimal Validation
Developers struggle with inputs like: <input type=”number” step=”0.01″ /> But values like 0.333 fail. ✔ Fix Allow any decimal: <input type=”number” step=”any” /> 💡 Works beautifully for: currency measurements percentages
CSS “Absolute Element Misaligned” — The position: relative Curse
Absolute positioned child needs a positioned parent. ❌ Wrong .parent { } .child { position: absolute; top: 10px; } ✔ Correct .parent { position: relative; } .child { position: absolute; top: 10px; } 💡 Hidden Trap Transforms also create new positioning contexts.
.NET Core “Kestrel Timeout” — The Hidden Request Body Limit
Many APIs fail mysteriously with: “Unexpected end of request content.” Because the request body timeout is too low. ✔ Fix builder.WebHost.ConfigureKestrel(o => { o.Limits.RequestBodyTimeout = TimeSpan.FromMinutes(5); }); 💡 Life-Saver For: file uploads slower mobile clients integrations with old systems
ASP.NET Core “IOptions Snapshot Turns Slow” — The Startup Misuse
Calling IOptionsSnapshot in tight loops = performance disasterbecause it reconstructs objects every request. ✔ Fix Use IOptionsMonitor for high-frequency reads. public MyService(IOptionsMonitor<MyConfig> cfg) { _cfg = cfg; } Monitor is cached, Snapshot is per-request.
SQL “Blocking Chains” — The Magic of READPAST
Ever seen queries freeze because a row is locked? Use the magical, rarely-used hint: SELECT * FROM Orders WITH (READPAST) WHERE Status = ‘Pending’; This skips locked rows instead of waiting. ✔ Perfect for: Queue tables Background workers Batch processors
SQL “High CPU for No Reason” — The Missing Statistics Update
Sometimes SQL goes to 80–90% CPU “out of nowhere”because stats are stale. ✔ Emergency Fix: UPDATE STATISTICS Orders WITH FULLSCAN; 💡 Why It Works The optimizer chooses WILDLY wrong plans if statistics aren’t fresh. ⚠ Pro Tip If your DB is huge → don’t FULLSCAN often.Use: EXEC sp_updatestats; Much lighter.
C# “JsonSerializer Ignores Private Setters” — The Missing Attribute
System.Text.Json does not serialize properties with private setters unless marked. ✔ Fix: [JsonInclude] public string Name { get; private set; } 💡 Hidden Trick This works even when constructor injection is used — extremely useful for DDD entities.
C# “Background Task Randomly Stops” — Lost Exceptions in Fire-and-Forget
The classic mistake: Task.Run(() => DoWork()); Exceptions inside fire-and-forget tasks are lost forever → task silently dies. ✔ Correct Pattern _ = Task.Run(async () => { try { await DoWork(); } catch (Exception ex) { logger.LogError(ex, “Background task failed”); } }); 💡 Why This Saves Lives Silent exceptions = random missing jobs.
C# “StringBuilder Turns Slow” — The Hidden Capacity Trap
Everyone uses StringBuilder for speed…but almost nobody knows WHY it becomes slow after heavy use. ⚠ Problem When StringBuilder grows beyond its internal buffer → it doubles memory and copies everything.Large loops = huge perf waste. ✔ Life-Saving Fix var sb = new StringBuilder(50000); // pre-allocate If you know approximate size → pre-allocating saves massive […]
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.
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.
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.
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.
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.
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.
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.
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.








