Skip to content

Code to support an article on why you should avoid C# events in ASPNET Core apps

License

Notifications You must be signed in to change notification settings

ardalis/AvoidCSharpEventsAspNetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avoid CSharp Events in Asp.Net Core

Code to support an article on why you should avoid C# events in ASPNET Core apps:

Avoid Using C# Events in ASP.NET Core Apps

See also: C# Advent of Code 2024

Long Running Demo of Resource Leak

Pull down the code, cd into the LongRunningConsole, and execute dotnet run. You'll see something like this:

Long Running Leak Demo

Note that it starts out showing each line of 1000 iterations every second or so but quickly slows down such that by iteration 260000 it takes 15+ seconds per line. The leak isn't just causing memory problems, but other performance issues as all of the handlers that weren't cleaned up must still be considered with each event raised.

About

Code to support an article on why you should avoid C# events in ASPNET Core apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages