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

Visual Studio

VS “Debugger Attached But Breakpoints Skip” — The Optimization Trap

- 09.12.25 - ErcanOPAK comment on 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  

Read More
Wordpress

WP “Permalinks Not Working” — The .htaccess Rewrite Reset

- 09.12.25 - ErcanOPAK comment on 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.

Read More
Windows

Windows 11 “VPN Slow After Update” — Broken MTU

- 09.12.25 - ErcanOPAK comment on 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  

Read More
Windows

Windows 11 “Alt-Tab Lag” — The Explorer Restart Trick

- 09.12.25 - ErcanOPAK comment on 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.

Read More
Ajax / JavaScript

AJAX “POST Suddenly Fails” — The Missing Content-Type Header

- 09.12.25 - ErcanOPAK comment on 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.

Read More
JavaScript

JS “Undefined Errors in Loops” — The Closure Trap

- 09.12.25 - ErcanOPAK comment on 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);  

Read More
HTML

HTML5 Input “step=any” — The Secret to Fix Broken Decimal Validation

- 09.12.25 - ErcanOPAK comment on 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

Read More
CSS

CSS “Absolute Element Misaligned” — The position: relative Curse

- 09.12.25 - ErcanOPAK comment on 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.

Read More
Asp.Net Core / C#

.NET Core “Kestrel Timeout” — The Hidden Request Body Limit

- 09.12.25 - ErcanOPAK comment on .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

Read More
Asp.Net Core / C#

ASP.NET Core “IOptions Snapshot Turns Slow” — The Startup Misuse

- 09.12.25 - ErcanOPAK comment on 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.

Read More
SQL

SQL “Blocking Chains” — The Magic of READPAST

- 09.12.25 - ErcanOPAK comment on 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

Read More
SQL

SQL “High CPU for No Reason” — The Missing Statistics Update

- 09.12.25 - ErcanOPAK comment on 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.

Read More
C#

C# “JsonSerializer Ignores Private Setters” — The Missing Attribute

- 09.12.25 - ErcanOPAK comment on 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.

Read More
C#

C# “Background Task Randomly Stops” — Lost Exceptions in Fire-and-Forget

- 09.12.25 - ErcanOPAK comment on 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.

Read More
C#

C# “StringBuilder Turns Slow” — The Hidden Capacity Trap

- 09.12.25 - ErcanOPAK comment on 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 […]

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