Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Builds, debugs, modernizes, and reviews ASP.NET Core apps covering hosting, middleware, security, configuration, logging, and deployment.
83% 91%+9 ptsof test cases passed
Passed 21 of 23 test cases with the skill, and 19 of 23 without it.
3 of 3 safety checks passed
This document catalogs common mistakes and anti-patterns in ASP.NET Core development, with explanations of why they are problematic and how to fix them.
Anti-Pattern:
public class WeatherService
{
public async Task<Weather> GetWeatherAsync(string city)
{
using var client = new HttpClient(); // BAD: Creates new socket each time
var response = await client.GetAsync($"https://api.weather.com/{city}");
return await response.Content.ReadFromJsonAsync<Weather>();
}
}
Problem: Creating HttpClient directly leads to socket exhaustion. Each HttpClient instance opens new TCP connections and disposing it does not immediately release sockets (they stay in TIME_WAIT state).
Correct Approach:
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.