* Resolve MakeGenericType ILLink warning in DependencyInjection
Resolve the ILLink warning in DependencyInjection by adding a runtime check that is behind a new AppContext switch 'Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability'. The runtime check ensures the trimming annotations on the open generic types are compatible between the service and implementation types. The check is enabled by default when PublishTrimmed=true.
* Make VerifyOpenGenericServiceTrimmability a full feature switch
* Copy ILLink.LinkAttributes from mono to shared.
* Update ILLink.LinkAttributes that are now shared between mono and coreclr
- Move IntrinsicAttribute to mono only
- Introduce feature switches for NullabilityInfoContext and AggressiveAttributeTrimming
- Minor other cleanup
* Respect the NullabilityInfoContext.IsSupported feature switch in NullabilityInfoContext.
* Document new feature switches
* Add trimming tests for NullabilityInfoContextSupport
* Move NonVersionableAttribute to mono-only
* Fix Linq tests now that the ExtensionAttribute isn't being trimmed all the time on mono WASM
Move the metadata update related APIs to the MetadataUpdater class
The old APIs AssemblyExtensions.ApplyUpdate() and AssemblyExtensions.GetApplyUpdateCapabilities() will be removed
after all the references to them have been changed to the new APIs.
Add the new IsSupported API described in issue https://github.com/dotnet/runtime/issues/51159.
Change the tests to use the MetadataUpdater APIs.
Fix the ApplyUpdate qcalls and icalls
Add the ILLink substitutions for MetadataUpdater.IsSupported property
Change the old APIs to call the new ones
Update mono's MetadataUpdater.IsSupported property
Update feature switch doc
Fixed the argument checking in coreclr's MetadataUpdater.ApplyUpdate().
Add an NSAutoreleasePool to all managed create threads including the Main and Finalizer.
This expands the current support where support was only added to ThreadPool threads.
New feature switch was created and the ThreadPool one was removed.
- System.Threading.Thread.EnableAutoreleasePool
Updated AutoReleaseTest for the new scenarios.
* Making System.Resources.ResourceManager trim safe
* Addressing PR Feedback
* Rename objects => types
* Also rename the strings.resx
* More PR Feedback
* Add UnconditionalSuppressMessage to Extensions
* Rename feature switch and reword error messages
* Removing new warning that is already addressed
* Rename AppContext switch and add feature switch to docs
* Addressing Feedback
* Revert changes to findtype plus some other feedback
* Revert FindType back
* move feature check up
Since the DiagnosticsHandler still gets instantiated in the HttpClientHandler, none of its overriden methods are getting trimmed. This leads to System.Diagnostics.DiagnosticListener still being preserved in a linked application.
The fix is to split DiagnosticsHandler.IsEnabled() into two methods:
* IsGloballyEnabled() - checks the AppContext switch, and is replaced by the linker by a feature swtich.
* IsEnabled() - which checks IsGloballyEnabled() and if there is an Activity or listener available.
This allows all but the IsEnabled and IsGloballyEnabled methods to get trimmed on DiagnosticsHandler.
Contributes to #38765
Applications are given the option of disabling BinaryFormatter.Serialize and BinaryFormatter.Deserialize, meaning they'll throw NotSupportedException if anybody tries calling them. WASM projects always disable these APIs via a hardcoded mechanism; there is no re-enablement mechanism for those projects.
This commit only introduces the switch. It does not disable it in any project types by default. (Exception: wasm, as mentioned above.) The related PR https://github.com/dotnet/sdk/pull/12434 causes aspnet 5.0+ applications to disable BinaryFormatter functionality by default, but apps can re-enable if needed.