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
  • Privacy Policy

Day: October 4, 2026

CSS

CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode

- 04.10.26 - ErcanOPAK comment on CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode

🎨 The Dark Mode Query That Wasn’t the Only One Running A prefers-color-scheme media query reads the operating system’s reported color scheme preference and switches a site’s own styles accordingly, which works correctly and predictably as long as the only thing deciding how the page looks is the page’s own stylesheet. A browser extension that […]

Read More
Git

Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently

- 04.10.26 - ErcanOPAK comment on Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently

πŸ”€ The File Two Branches Both Agreed to Lose Git’s three-way merge treats a file as cleanly resolved, with no conflict markers and no manual intervention needed, whenever both sides of the merge agree on the outcome for that file – and two branches that each independently deleted the same file, for entirely different and […]

Read More
HTML

HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It

- 04.10.26 - ErcanOPAK comment on HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It

🧩 The Image That Was Lazy Forever Native lazy loading decides whether to fetch an image based on its position relative to the viewport, which works well for images further down a normally visible page – but an image placed inside a tab panel, an accordion section, or any other container hidden with a display-none […]

Read More
AI

The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null

- 04.10.26 - ErcanOPAK comment on The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null

πŸ€– The Prompt That Asks Where the Null Actually Came From A null reference exception’s stack trace reliably shows where a null value was finally used in a way that crashed – a method call, a property access, a dereference – but it says nothing at all about where that value became null in the […]

Read More
AI

The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps

- 04.10.26 - ErcanOPAK comment on The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps

πŸ€– The Prompt That Reads the Fine Print Before You Need It A gym membership contract’s cancellation terms are usually buried a few pages in, written in the same dense legal phrasing as the rest of the agreement, and structured around conditions that only matter once you actually want out – a required notice period, […]

Read More
Photoshop

Photoshop: Fix a Color Profile Mismatch That Makes Printed Output Look Nothing Like What You Saw On Screen

- 04.10.26 - ErcanOPAK comment on Photoshop: Fix a Color Profile Mismatch That Makes Printed Output Look Nothing Like What You Saw On Screen

πŸ–ŒοΈ The Print That Looked Like a Different Photo Entirely A monitor displays color using its own calibration and the document’s assigned color profile, converted on the fly for your specific screen, which is why an image can look vivid and accurate while you edit it – but sending that same document to a printer […]

Read More
Wordpress

WordPress: Fix Search Results That Return Pages From a Theme You Deactivated Months Ago

- 04.10.26 - ErcanOPAK comment on WordPress: Fix Search Results That Return Pages From a Theme You Deactivated Months Ago

πŸ“ The Search Results Still Haunted by an Old Theme WordPress’s built-in search queries the posts table directly and has no awareness of which theme happens to be active, which is exactly why switching themes normally has no effect on search results at all – but a page builder or a theme-specific plugin that registered […]

Read More
Visual Studio

Visual Studio: Fix a Test Project That Builds Fine Alone but Fails to Discover Any Tests After a NuGet Restore

- 04.10.26 - ErcanOPAK comment on Visual Studio: Fix a Test Project That Builds Fine Alone but Fails to Discover Any Tests After a NuGet Restore

πŸ› οΈ The Test Project That Built, and Then Found Nothing A test project depends on a specific test adapter package to let Visual Studio’s Test Explorer discover and run the tests it contains, and that adapter is resolved and loaded independently of whether the project itself compiles successfully – which means a restore that pulls […]

Read More
Asp.Net Core

ASP.NET Core: Fix a File Upload That Times Out on Slow Connections Only Because Kestrel’s Minimum Data Rate Feature Kicked In

- 04.10.26 - ErcanOPAK comment on ASP.NET Core: Fix a File Upload That Times Out on Slow Connections Only Because Kestrel’s Minimum Data Rate Feature Kicked In

βš™οΈ The Upload That Failed Only on the Slowest Connections Kestrel enforces a minimum data rate on both reading a request and writing a response, dropping the connection if a client sends or receives data more slowly than the configured floor for more than a short grace period – a safety feature meant to free […]

Read More
JavaScript

JavaScript: Fix an Array Destructuring Default Value That Silently Never Applies Because null Was Passed Instead of Undefined

- 04.10.26 - ErcanOPAK comment on JavaScript: Fix an Array Destructuring Default Value That Silently Never Applies Because null Was Passed Instead of Undefined

⚑ The Default Value That Only Worked for One Kind of Missing A default value in a destructuring pattern only kicks in when the corresponding position is exactly undefined – not when it is missing from a shorter array, and specifically not when it is present but holds the value null, which JavaScript treats as […]

Read More
Kubernetes

Kubernetes: Fix a Sidecar Container That Keeps the Pod Running Forever Because It Never Signals Completion to the Job Controller

- 04.10.26 - ErcanOPAK comment on Kubernetes: Fix a Sidecar Container That Keeps the Pod Running Forever Because It Never Signals Completion to the Job Controller

☸️ The Sidecar That Never Let the Job Finish A Job is only considered complete once every container in its pod has exited, and a sidecar added for logging, a service mesh proxy, or metrics collection typically runs as a long-lived process with no built-in reason to ever exit on its own – which is […]

Read More
Asp.Net Core

ASP.NET Core: Fix an Endpoint Filter That Silently Does Nothing on a Controller Action Because It Only Applies to Minimal APIs

- 04.10.26 - ErcanOPAK comment on ASP.NET Core: Fix an Endpoint Filter That Silently Does Nothing on a Controller Action Because It Only Applies to Minimal APIs

βš™οΈ The Filter That Only Worked on Half the API Endpoint filters were introduced as a lightweight way to run logic before and after a request reaches its handler, and registering one reads almost identically to registering an action filter, which makes it easy to assume the two are interchangeable. They are not: an endpoint […]

Read More
SQL

SQL Server: Fix a Query That Gets Slower After You Add an Index Because the Optimizer Now Picks a Worse Plan

- 04.10.26 - ErcanOPAK comment on SQL Server: Fix a Query That Gets Slower After You Add an Index Because the Optimizer Now Picks a Worse Plan

πŸ—„οΈ The Index That Made the Query Slower, Not Faster Adding an index is supposed to give the query optimizer another option, never take one away, so a newly indexed query that suddenly runs slower than before feels backwards – but a new index can change which plan the optimizer’s cost estimates actually favor, and […]

Read More
Docker

Docker: Fix a Multi-Stage Build Cache That Never Invalidates Because a COPY Layer Hashes Identically Across Unrelated Commits

- 04.10.26 - ErcanOPAK comment on Docker: Fix a Multi-Stage Build Cache That Never Invalidates Because a COPY Layer Hashes Identically Across Unrelated Commits

🐳 The Cache That Thought Nothing Had Changed Docker’s build cache decides whether to reuse a layer by hashing the instruction and, for a COPY instruction, the content of the files being copied – which is normally exactly the right behavior, skipping real work when nothing relevant actually changed. A COPY instruction that copies an […]

Read More
SQL

SQL Server: Fix a Trigger That Fires Once Per Statement Instead of Once Per Row and Silently Processes Only the First Row

- 04.10.26 - ErcanOPAK comment on SQL Server: Fix a Trigger That Fires Once Per Statement Instead of Once Per Row and Silently Processes Only the First Row

πŸ—„οΈ The Trigger That Only Ever Saw One Row A trigger fires exactly once per statement, not once per affected row, and the inserted and deleted pseudo-tables inside it can hold any number of rows at once when a single statement updates or inserts several rows together – a batch import, a bulk status change, […]

Read More
Windows

Windows 11: Fix a Second Monitor That Reverts to 60Hz Every Time the PC Wakes From Sleep

- 04.10.26 - ErcanOPAK comment on Windows 11: Fix a Second Monitor That Reverts to 60Hz Every Time the PC Wakes From Sleep

πŸͺŸ The Refresh Rate That Reset Itself Every Morning A monitor’s refresh rate setting in Windows is tied to the specific display configuration the graphics driver negotiates with that monitor each time the connection is established, and waking from sleep re-establishes that connection rather than simply resuming the previous session’s settings exactly as they were. […]

Read More
C#

C#: Fix a Lazy Initialization That Silently Runs Its Factory Twice Because the Thread-Safety Mode Was Never Set

- 04.10.26 - ErcanOPAK comment on C#: Fix a Lazy Initialization That Silently Runs Its Factory Twice Because the Thread-Safety Mode Was Never Set

πŸ”§ The Lazy Value That Wasn’t Actually Thread-Safe Wrapping an expensive factory method in a lazy-initialization helper promises that the factory runs exactly once no matter how many threads ask for the value, but that guarantee only holds for the thread-safety mode the object actually uses, and the plain parameterless constructor does not pick the […]

Read More
Git

Git: Fix a Pre-Push Hook That Silently Does Nothing Because It Lost Its Executable Bit After Cloning on Windows

- 04.10.26 - ErcanOPAK comment on Git: Fix a Pre-Push Hook That Silently Does Nothing Because It Lost Its Executable Bit After Cloning on Windows

πŸ”€ The Hook That Was There, and Did Nothing A pre-push hook committed to a repository as a plain script file needs its executable permission bit set before Git will actually run it, and that bit is a Unix filesystem attribute that a checkout on Windows has no real equivalent for – the file arrives […]

Read More
AI

The AI Prompt That Finds Race Conditions in Code That Only Fails Under Concurrent Load

- 04.10.26 - ErcanOPAK comment on The AI Prompt That Finds Race Conditions in Code That Only Fails Under Concurrent Load

πŸ€– The Prompt That Reads Code the Way a Second Thread Would A race condition rarely announces itself in the source code the way a syntax error or an obvious null check does – the code reads as correct on its own, line by line, and only breaks when a second thread, request, or task […]

Read More
C#

C#: Fix a Byref-Like Struct That Compiles Cleanly Until You Try to Store It in a Field or Capture It in an Async Method

- 04.10.26 - ErcanOPAK comment on C#: Fix a Byref-Like Struct That Compiles Cleanly Until You Try to Store It in a Field or Capture It in an Async Method

πŸ”§ The Struct That Only Looked Like Any Other Struct A byref-like struct – the kind returned by slicing a contiguous block of memory into a stack-only view – behaves like a normal value type for arithmetic, comparisons, and passing between ordinary methods, so nothing about using it feels unusual at first. The restrictions only […]

Read More
Wordpress

WordPress: Fix a Plugin Update That Silently Reverts Every Customized Setting Back to Its Default Values

- 04.10.26 - ErcanOPAK comment on WordPress: Fix a Plugin Update That Silently Reverts Every Customized Setting Back to Its Default Values

πŸ“ The Update That Forgot Everything You’d Changed A plugin update is supposed to replace only its own code, leaving whatever settings you configured through its admin screen untouched in the database – but a plugin that stores its settings as one large serialized option, rather than as individual option entries, can overwrite that entire […]

Read More
Windows

Windows 11: Fix File Explorer Search That Returns Zero Results Even Though Indexing Shows as Complete

- 04.10.26 - ErcanOPAK comment on Windows 11: Fix File Explorer Search That Returns Zero Results Even Though Indexing Shows as Complete

πŸͺŸ The Search That Came Back Empty for No Visible Reason File Explorer’s search box relies on the Windows Search index to return fast results, and the indexing status panel reporting that indexing is complete gives a reasonable, false sense that every included folder is actually searchable – but a folder can be silently excluded […]

Read More
C#

C#: Fix a Source-Generated Logging Message That Still Evaluates Its Arguments Even When the Log Level Is Disabled

- 04.10.26 - ErcanOPAK comment on C#: Fix a Source-Generated Logging Message That Still Evaluates Its Arguments Even When the Log Level Is Disabled

πŸ”§ The Log Line That Ran Even When Nobody Was Listening A source-generated logging method is supposed to skip the actual work of formatting a message entirely when its log level is disabled in configuration, which is the whole performance case for using it instead of a plain string interpolation. That guarantee covers the message […]

Read More
Ajax

Ajax: Fix a Fetch Call That Silently Ignores Your Abort Signal Because the Controller Was Created After the Request Already Started

- 04.10.26 - ErcanOPAK comment on Ajax: Fix a Fetch Call That Silently Ignores Your Abort Signal Because the Controller Was Created After the Request Already Started

πŸ”„ The Abort Signal Nobody Was Listening For Canceling an in-flight fetch request depends entirely on passing the abort controller’s signal into the request before it starts, since the signal has to already be attached for the browser to know which in-flight request a later abort call is supposed to interrupt. A controller created and […]

Read More
Photoshop

Photoshop: Fix a Layer Mask That Inverts Itself the Moment You Apply a Smart Filter on Top of It

- 04.10.26 - ErcanOPAK comment on Photoshop: Fix a Layer Mask That Inverts Itself the Moment You Apply a Smart Filter on Top of It

πŸ–ŒοΈ The Mask That Flipped Itself Without Being Touched A layer mask painted to reveal one specific area and hide the rest keeps that exact relationship until something explicitly changes it, which makes an apparent self-inversion – the masked area suddenly hidden and the rest suddenly visible, with no inversion command ever consciously run – […]

Read More
C#

C#: Fix a Primary Constructor Parameter That Silently Turns Into a Captured Field and Allocates More Than You Expect

- 04.10.26 - ErcanOPAK comment on C#: Fix a Primary Constructor Parameter That Silently Turns Into a Captured Field and Allocates More Than You Expect

πŸ”§ The Constructor Parameter That Became a Field Without Telling You A primary constructor parameter looks like a plain, short-lived value that only exists while the constructor runs – but the moment you reference it anywhere outside the constructor body, in any instance method, the compiler silently generates a private field to back it so […]

Read More
Visual Studio

Visual Studio: Fix Hot Reload That Silently Stops Applying Code Changes Until You Restart Debugging

- 04.10.26 - ErcanOPAK comment on Visual Studio: Fix Hot Reload That Silently Stops Applying Code Changes Until You Restart Debugging

πŸ› οΈ The Hot Reload That Quietly Stopped Reloading Hot Reload applies a specific category of code edits to a running application without a full rebuild and restart – mostly method body changes – and it silently falls back to doing nothing the moment an edit falls outside that supported set, such as adding a new […]

Read More
Asp.Net Core

ASP.NET Core: Fix a gRPC Service That Silently Truncates Large Responses Because of a Default Message Size Limit

- 04.10.26 - ErcanOPAK comment on ASP.NET Core: Fix a gRPC Service That Silently Truncates Large Responses Because of a Default Message Size Limit

βš™οΈ The gRPC Response That Got Cut Off at Exactly Four Megabytes gRPC applies a default maximum message size on both sending and receiving to protect the server from unbounded memory use on a single call, and it is a sane default for most RPCs – right up until a service legitimately needs to return […]

Read More
C#

C#: Fix an IAsyncEnumerable That Silently Loads Everything Into Memory Because of One Accidental ToListAsync Call

- 04.10.26 - ErcanOPAK comment on C#: Fix an IAsyncEnumerable That Silently Loads Everything Into Memory Because of One Accidental ToListAsync Call

πŸ”§ The Await Foreach That Was Never Actually Streaming An async-enumerable sequence is supposed to stream results one at a time, pulling and awaiting only what the consumer actually asks for – that is the entire reason to reach for it over a regular collection. Add a single call that materializes the whole sequence into […]

Read More
AI

The AI Prompt That Turns a Plant Tag’s Care Instructions Into a Personalized Weekly Watering and Light Schedule

- 04.10.26 - ErcanOPAK comment on The AI Prompt That Turns a Plant Tag’s Care Instructions Into a Personalized Weekly Watering and Light Schedule

πŸ€– The Prompt That Turns a Tiny Plastic Tag Into an Actual Routine A plant care tag packs real information into a few icons and a couple of lines of tiny print, but it is written as generic species-level guidance, not adjusted for your actual home – a sunny window gets far more light than […]

Read More
Page 1 of 3
1 2 3 Next Β»

Posts pagination

1 2 3 Next »
October 2026
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Sep    

Most Viewed Posts

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

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps
  • Photoshop: Fix a Color Profile Mismatch That Makes Printed Output Look Nothing Like What You Saw On Screen
  • WordPress: Fix Search Results That Return Pages From a Theme You Deactivated Months Ago
  • Visual Studio: Fix a Test Project That Builds Fine Alone but Fails to Discover Any Tests After a NuGet Restore
  • ASP.NET Core: Fix a File Upload That Times Out on Slow Connections Only Because Kestrel’s Minimum Data Rate Feature Kicked In
  • JavaScript: Fix an Array Destructuring Default Value That Silently Never Applies Because null Was Passed Instead of Undefined

Most Viewed Posts

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

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps

Social

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