Memory leak when using asp-append-version with href pointing to non-existent file
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
Using the asp-append-version attribute (from the LinkTagHelper) on a element with an href pointing to a file which does not exist sets up a memory leak. The memory leak is revealed when a WebApplicationFactory is used to host the app and the app is repeatedly started up and shutdown with the page being requested in between.
### Expected Behavior
asp-append-version should just ignore files which do not exist, and no memory leak should result.
### Steps To Reproduce
Here is a minimal example which reproduces this issue: https://github.com/samueldjack/LinkTagHelperMemoryLeak
The essence: an MVC app where the View contains a ``
In a Test, WebApplicationFactory is used to repeatedly create instances of the web app, call the page, then dispose of the app.
The process eventually crashes with an OutOfMemoryException.
If the ```asp-append-version``` attribute is removed, no memory leak occurs.
### Exceptions (if any)
_No response_
### .NET Version
_No response_
### Anything else?
This is present on .Net 8 and .Net 9
Contributor guide
Assessment
This issue has not been assessed yet.