Skip to content
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

Make features public to enable testing/customization scenarios #411

Merged
merged 6 commits into from
Oct 9, 2023

Conversation

twsouthwick
Copy link
Member

@twsouthwick twsouthwick commented Oct 4, 2023

This exposes the internal features we use to enable System.Web scenarios for two main reasons:

  1. Some functionality (such as ITransferRequestFeature) is not implemented out of the box
  2. Requests have been made to have access to this for mocking purposes

For now, these are marked as experimental using the new ExperimentalAttribute to give us flexibility to change them if we need to since we haven't had to use them outside of our codebase. They have been moved into the Microsoft.AspNetCore.SystemWebAdapters.Features namespace as part of this change.

Fixes #332

@twsouthwick twsouthwick changed the title Make features public to enable testing scenarios Make features public to enable testing/customization scenarios Oct 4, 2023
@twsouthwick twsouthwick requested a review from Tratcher October 4, 2023 22:16
@twsouthwick
Copy link
Member Author

@joperezr I'm making use of the ExperimentalAttribute here - is there support for this for downlevel, or should we just enable it for .NET 8+?

@joperezr
Copy link
Member

joperezr commented Oct 6, 2023

@joperezr I'm making use of the ExperimentalAttribute here - is there support for this for downlevel, or should we just enable it for .NET 8+?

The attribute itself is .NET 8 only, but the feature is built-in to the compiler so the suggestion for downlevel is just to define an internal attribute that looks just like the .NEt 8 one, and the compiler won't care in which assembly it is defined

@twsouthwick
Copy link
Member Author

@joperezr I'm making use of the ExperimentalAttribute here - is there support for this for downlevel, or should we just enable it for .NET 8+?

The attribute itself is .NET 8 only, but the feature is built-in to the compiler so the suggestion for downlevel is just to define an internal attribute that looks just like the .NEt 8 one, and the compiler won't care in which assembly it is defined

Cool. I added an internal one for downlevel then. Since people may be using it on .NET 6 as well, will they not see any compiler warnings? Does it make sense to add an obsolete to that as well (with the diagnostic id?)?

@twsouthwick twsouthwick merged commit 1f7d0f6 into main Oct 9, 2023
@twsouthwick twsouthwick deleted the public-features branch October 9, 2023 20:28
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.

How to set up mocks/stubs for testing?
3 participants