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: January 3, 2026

C#

DateTime.Now Breaks Distributed Logic

- 03.01.26 | 03.01.26 - ErcanOPAK comment on DateTime.Now Breaks Distributed Logic

Same code, different results. WhyLocal time zones and daylight saving. Fix DateTimeOffset.UtcNow   🔥 Why DateTime.Now Breaks Distributed Logic (And What to Use Instead) Same code. Different results.If you’ve ever seen time-based logic randomly fail in production, DateTime.Now might be the silent culprit. In distributed systems, local time is a trap. 🚨 The Core Problem […]

Read More
C#

LINQ Looks Clean but Allocates Heavily

- 03.01.26 - ErcanOPAK comment on LINQ Looks Clean but Allocates Heavily

Readable code, hidden cost. WhyMultiple enumerations. Fix var list = items.ToList();  

Read More
C#

Async Methods Still Block the Thread Pool

- 03.01.26 - ErcanOPAK comment on Async Methods Still Block the Thread Pool

Looks async, behaves sync. WhyCPU-bound work inside async methods. Fix await Task.Run(Compute);  

Read More
SQL

SQL Deadlocks Appear Under Load

- 03.01.26 - ErcanOPAK comment on SQL Deadlocks Appear Under Load

Works fine in testing. WhyDifferent execution order under concurrency. FixStandardize access order across queries.

Read More
SQL

SQL Queries Suddenly Ignore Indexes

- 03.01.26 - ErcanOPAK comment on SQL Queries Suddenly Ignore Indexes

Indexes exist, scans happen. WhyImplicit type conversions. Fix WHERE UserId = @UserId — matching types  

Read More
Asp.Net Core

Logging Slows Down ASP.NET Core APIs

- 03.01.26 - ErcanOPAK comment on Logging Slows Down ASP.NET Core APIs

Logs enabled, throughput drops. WhySynchronous logging blocks request threads. FixUse async logging providers.

Read More
Asp.Net Core / C#

ASP.NET Core Memory Usage Keeps Growing

- 03.01.26 - ErcanOPAK comment on ASP.NET Core Memory Usage Keeps Growing

GC runs, memory stays high. WhyObject pooling misused or ignored. Fix services.AddPooledDbContextFactory<AppDbContext>();  

Read More
Git

Git Pull Suddenly Breaks Local Changes

- 03.01.26 - ErcanOPAK comment on Git Pull Suddenly Breaks Local Changes

No conflicts shown. WhyRebase rewrites local commits. FixStash or commit before pulling with rebase.

Read More
Git

Git History Becomes Impossible to Understand

- 03.01.26 | 03.01.26 - ErcanOPAK comment on Git History Becomes Impossible to Understand

Commits exist, meaning is lost. WhyGeneric commit messages destroy context. FixEnforce semantic commit conventions.

Read More
JavaScript

Ajax Calls Fail Only on Slow Networks

- 03.01.26 - ErcanOPAK comment on Ajax Calls Fail Only on Slow Networks

Fast internet hides the bug. WhyRace conditions between requests. FixCancel in-flight requests before sending new ones.

Read More
JavaScript

JavaScript Event Listeners Multiply Silently

- 03.01.26 - ErcanOPAK comment on JavaScript Event Listeners Multiply Silently

One click triggers multiple handlers. WhyListeners added repeatedly without removal. Fix element.removeEventListener(‘click’, handler);  

Read More
HTML

HTML5 Videos Fail on Mobile Browsers

- 03.01.26 - ErcanOPAK comment on HTML5 Videos Fail on Mobile Browsers

Desktop works, mobile doesn’t. WhyAutoplay restrictions require muted playback. Fix <video autoplay muted playsinline></video>  

Read More
CSS

CSS Grid Layout Breaks on Small Screens

- 03.01.26 - ErcanOPAK comment on CSS Grid Layout Breaks on Small Screens

Looks fine on desktop, broken on mobile. WhyImplicit grid tracks expand unexpectedly. Fix grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));  

Read More
Windows

Windows 11 Apps Freeze Without Crashing

- 03.01.26 - ErcanOPAK comment on Windows 11 Apps Freeze Without Crashing

No error, no recovery. WhyGPU Timeout Detection triggers silently. FixUpdate GPU drivers and adjust TDR settings.

Read More
Windows

Windows 11 Network Speed Drops After Sleep

- 03.01.26 - ErcanOPAK comment on Windows 11 Network Speed Drops After Sleep

Wi-Fi connects, speed collapses. WhyPower-saving resets network drivers. FixDisable power management for network adapters.

Read More
AI

AI Prompt — Clarify Any Confusing Topic

- 03.01.26 - ErcanOPAK comment on AI Prompt — Clarify Any Confusing Topic

Prompt Explain this topic at three levels: 1. Beginner 2. Practitioner 3. Expert Include real-world examples. Topic: <INSERT TOPIC>  

Read More
AI

AI Prompt — Rewrite Code for Maintainability

- 03.01.26 - ErcanOPAK comment on AI Prompt — Rewrite Code for Maintainability

Prompt Refactor this code. Constraints: – Preserve behavior – Reduce cognitive complexity – Improve naming and structure Explain WHY each change helps. Code: <PASTE CODE>  

Read More
AI

AI Prompt — Detect Hidden Race Conditions

- 03.01.26 - ErcanOPAK comment on AI Prompt — Detect Hidden Race Conditions

Prompt Act as a concurrency expert. Analyze this code for: – Race conditions – Thread safety violations – Unsafe shared state Explain the exact execution paths. Code: <PASTE CODE>  

Read More
Docker

Docker Containers Work Locally but Fail in CI

- 03.01.26 - ErcanOPAK comment on Docker Containers Work Locally but Fail in CI

Same image, different result. WhyCI runs on a different CPU architecture. FixBuild multi-arch images explicitly.

Read More
Kubernetes

Kubernetes HPA Doesn’t Scale When Traffic Spikes

- 03.01.26 - ErcanOPAK comment on Kubernetes HPA Doesn’t Scale When Traffic Spikes

Metrics look fine, pods stay the same. WhyCPU-based autoscaling ignores I/O-bound workloads. FixScale using custom or request-based metrics.

Read More
Wordpress

WordPress REST API Returns 401 Randomly

- 03.01.26 - ErcanOPAK comment on WordPress REST API Returns 401 Randomly

Works for some users, fails for others. WhyAuthentication cookies blocked by SameSite rules. FixAdjust cookie settings for cross-origin REST calls.

Read More
Wordpress

WordPress Pages Load Fast but TTFB Is High

- 03.01.26 - ErcanOPAK comment on WordPress Pages Load Fast but TTFB Is High

The page renders quickly… after waiting. WhyHeavy server-side hooks delay the first byte. FixProfile PHP execution time, not frontend assets.

Read More
Photoshop

Photoshop File Becomes Uneditable Over Time

- 03.01.26 - ErcanOPAK comment on Photoshop File Becomes Uneditable Over Time

Layers exist but edits lag. WhyNested smart objects create deep render chains. FixFlatten completed sections and keep only active smart objects.

Read More
Photoshop

Photoshop Images Look Sharp but Increase Page Load Time

- 03.01.26 - ErcanOPAK comment on Photoshop Images Look Sharp but Increase Page Load Time

Design looks perfect, performance tanks. WhyHidden metadata and color profiles inflate file size. FixStrip metadata on export and convert to sRGB explicitly.

Read More
Visual Studio

Visual Studio “Find All References” Misses Usages

- 03.01.26 | 03.01.26 - ErcanOPAK comment on Visual Studio “Find All References” Misses Usages

You rename a method… and production breaks. Why this happensReflection, DI containers, and source generators bypass static reference tracking. Why it mattersRefactors appear safe but silently break runtime behavior. FixSearch for string-based registrations and generated code outputs before refactoring.

Read More
C#

Exceptions Used for Control Flow

- 03.01.26 - ErcanOPAK comment on Exceptions Used for Control Flow

Works until scale. WhyExceptions are expensive. Fix if (!TryParse(…)) return;  

Read More
C#

Events Cause Memory Leaks

- 03.01.26 - ErcanOPAK comment on Events Cause Memory Leaks

Even in managed code. WhyUnsubscribed event handlers. FixAlways unsubscribe or use weak events.

Read More
C#

Structs Can Be Slower Than Classes

- 03.01.26 - ErcanOPAK comment on Structs Can Be Slower Than Classes

Surprising but true. WhyLarge structs copied by value. Fix void Process(in MyStruct data)  

Read More
SQL

Parameter Sniffing Kills Performance

- 03.01.26 - ErcanOPAK comment on Parameter Sniffing Kills Performance

Random slow queries. WhyExecution plans cached incorrectly. Fix OPTION (RECOMPILE)  

Read More
SQL

SQL Query Slows Down as Data Grows

- 03.01.26 - ErcanOPAK comment on SQL Query Slows Down as Data Grows

Same query, worse performance. WhyMissing covering indexes. Fix CREATE INDEX IX_User_Email ON Users (Email) INCLUDE (Name, CreatedAt);  

Read More
Page 1 of 2
1 2 Next »

Posts navigation

Older posts
January 2026
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Dec    

Most Viewed Posts

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

Recent Posts

  • Why foreach Is Sometimes Slower Than for
  • The Hidden Cost of Exceptions as Flow Control
  • Why lock Can Kill Throughput
  • Indexes Can Make Queries Slower (Here’s Why)
  • Why SELECT * Slowly Destroys Performance
  • The Real Cost of IHostedService Misuse
  • Why Async Controllers Still Block Threads
  • Stop Using git pull (Yes, Really)
  • Why Git Rebase “Loses” Commits (It Doesn’t — You Did)
  • Why Fetch Requests “Randomly” Hang (But Server Is Fine)

Most Viewed Posts

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

Recent Posts

  • Why foreach Is Sometimes Slower Than for
  • The Hidden Cost of Exceptions as Flow Control
  • Why lock Can Kill Throughput
  • Indexes Can Make Queries Slower (Here’s Why)
  • Why SELECT * Slowly Destroys Performance

Social

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