Skip to content

#2765 Allow Filter instance reuse #2839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

remcolam
Copy link
Contributor

@remcolam remcolam commented Apr 25, 2024

Resolves #2765.

@remcolam
Copy link
Contributor Author

@martincostello I think this might solve this issue... This PR is not complete yet, but I am curious as to whether this approach is the way to go. If so I will add extension methods for all filter types

@remcolam
Copy link
Contributor Author

Oh, this is about #2765

Copy link
Collaborator

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a reasonable approach.

@remcolam
Copy link
Contributor Author

@martincostello I just added that test website, to help investigate, I plan on deleting it. I just needed something to put the example program.cs in from the issue.

This was mostly meant as a POC PR, to see if this would be the approach to solve it. I will now work on a proper solve.

@remcolam remcolam force-pushed the feature/#2765-multiple-constructor-calls branch from 3c27f55 to c43a0a1 Compare April 26, 2024 06:20
@remcolam remcolam changed the title #2765 Allow Filter instance reuse Draft: #2765 Allow Filter instance reuse Apr 26, 2024
@remcolam remcolam marked this pull request as draft April 26, 2024 08:42
@remcolam remcolam changed the title Draft: #2765 Allow Filter instance reuse #2765 Allow Filter instance reuse Apr 26, 2024
@remcolam remcolam marked this pull request as ready for review April 26, 2024 09:11
@remcolam
Copy link
Contributor Author

@martincostello I think I am done with this, pending any new comments

@martincostello
Copy link
Collaborator

The build is failing due to the strong naming changes. You might be hitting the complexity I noted here: #2805 (comment)

If you can't easily resolve that, you'll have to create a manual mock and remove NSub.

Also, can you apply the same exact changes as in this commit to your PR please? The CI is failing since GitHub updated the macOS runner: App-vNext/Polly@d7bad63

I could do it myself in a separate PR, but then it would hold things up waiting for someone else to review my changes.

@remcolam
Copy link
Contributor Author

I configured all projects to be signed, hopefully that should fix the issue... locally the tests run fine now

@martincostello
Copy link
Collaborator

I configured all projects to be signed, hopefully that should fix the issue... locally the tests run fine now

Signing any project we ship to NuGet that is not already strong-named is a massively breaking change for anyone using Swashbuckle via netstandard2.0 in a .NET Framework application. We cannot make such a change.

@martincostello
Copy link
Collaborator

In fact, breaking or not, at this point this is far too much churn to allow the use of NSub in a few places for your test. Please revert all the signing changes and create a manual mock.

This was referenced Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Registered IDocumentFilter, IOperationFilter types instantiated very often on first http request
3 participants