C#

Fix ASP.NET Core, EF Core, async, DI, microservices, memory leaks, real-world problems

Hard

Fix EF Core Connection Leak Causing Pool Exhaustion

Your ASP.NET API randomly hangs under load. EF Core DbContext is being reused incorrectly, causing connection leaks. Fix the lifetime and disposal problem.

Medium

Fix Deadlock Caused by Using .Result Inside ASP.NET Controller

Developers often call async methods using .Result or .Wait(), causing deadlocks. Rewrite the API to fully use async/await.

Medium

Fix Memory Leak Caused by Timer Event Handler Capturing Instance

Timers and event handlers keep class instances alive, causing memory leaks in long-running APIs. Fix by unregistering callbacks.

Easy

Fix Slow JSON Serialization in ASP.NET Core API

Your API returns large objects and is slow due to System.Text.Json using default configuration. Add caching, reduced depth, and improved serialization settings.

Hard

Fix Socket Exhaustion by Using HttpClientFactory

Creating new HttpClient per request causes socket exhaustion. Switch to HttpClientFactory for pooled handlers.

Medium

Fix Memory Leak from Event Handler Not Unsubscribed

Event handlers keep objects alive, preventing garbage collection.

Medium

Fix Thread Safety Issue in Singleton Pattern

Singleton implementation is not thread-safe, causing multiple instances.

Medium

Fix Memory Leak from Event Handlers Not Unsubscribed

Event handlers keep objects alive, preventing garbage collection.

Easy

Fix Null Reference Exception from Nullable Reference Types

Nullable reference types not enabled, causing NRE at runtime.

Hard

Fix SQL Injection in Entity Framework Raw Queries

User input concatenated into raw SQL query, vulnerable to SQL injection.

Medium

Fix Thread Safety Issue in Singleton Pattern

Singleton implementation not thread-safe, allowing multiple instances.

Easy

Fix Memory Leak from Unclosed File Streams

File streams are not disposed, causing file handle exhaustion.

Medium

Fix Race Condition in Dictionary Operations

Dictionary accessed from multiple threads without synchronization.

Hard

Fix HttpClient Not Reused Causing Socket Exhaustion

Creating new HttpClient per request exhausts sockets.

Medium

Fix Async Void Methods Causing Unhandled Exceptions

Async void methods can't be awaited and exceptions are unhandled.

Medium

Fix ConfigureAwait False Missing in Library Code

Library code doesn't use ConfigureAwait(false), causing deadlocks.

Easy

Fix Memory Leak from Timer Not Disposed

Timer continues running after object is disposed, causing memory leak.

Medium

Fix Entity Framework N+1 Query Problem

Loading related entities triggers N+1 queries, causing performance issues.

Easy

Fix String Concatenation in Loop Causing Performance Issues

String concatenation in loop creates many intermediate strings.

Hard

Fix Reflection Performance Issue from Repeated Type Lookups

Repeated reflection operations cause performance degradation.

Medium

Fix Task Not Awaited Causing Fire-and-Forget

Task is not awaited, causing exceptions to be lost.

Hard

Fix Circular Dependency in Dependency Injection

Two services depend on each other, causing circular dependency.

Hard

Fix Memory Leak from Event Subscription in Static Events

Static events keep subscribers alive, preventing garbage collection.

Hard

Fix Thread Safety Issue in Lazy Initialization

Double-checked locking pattern incorrectly implemented.

Medium

Fix Async Method Not Properly Configured

Async method doesn't handle cancellation or exceptions properly.

Medium

Fix Entity Framework Change Tracking Performance Issue

Change tracking enabled for read-only queries, causing performance degradation.