-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Feature switch to turn off COM support in Windows #50662
Conversation
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
.../System.Private.CoreLib/src/Internal/Runtime/InteropServices/IsolatedComponentLoadContext.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validated with some existing basic unit COM tests in NETClient and NativeClient.
Are you planning on adding tests in this change or a follow-up (or both)? I know you've mentioned dealing with testing, but I don't see anything called out in #50500, so I want to make sure that doesn't get lost.
I could see:
System.Runtime.InteropServices
libraries tests validating the behaviour of public APIs with the switch enabled/disabledComWrappers
(working) running with the switch disabled- COM activation (failure) running with the switch disabled
(2) and (3) would probably require some work in the test infrastructure, since corerun doesn't allow configuring runtime properties right now.
src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
Outdated
Show resolved
Hide resolved
Just to clarify - I'm not arguing that all the tests and updated test infrastructure absolutely have to be in this PR, just that they need to be part of the built-in COM support feature switch work and handled as part of #50500. I would like to see the libraries tests (which shouldn't need corerun/test infrastucture updates) as part of this PR though. |
It would be useful to get a run of all libraries tests with this disabled so that we get a good idea what are all dotnet/runtime features that get impacted by this. |
Why move all the existing tests? That seems inconsistent with how other libraries tests are structured for testing config switches that need to be set for the entire project. I think they keep normal/default cases at the top-level and then have a subfolder for the test project using a non-default config switch. For example, |
For consistency with other libraries tests, I would expect something more like:
And System.Runtime.InteropServices.ComDisabled.Tests.csproj would reach back up out of the subfolder for any shared source as necessary. |
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
Outdated
Show resolved
Hide resolved
....Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime.InteropServices/tests/ComDisabled/AssemblyInfo.cs
Outdated
Show resolved
Hide resolved
...System.Runtime.InteropServices/tests/ComDisabled/System.Runtime.InteropServices.Tests.csproj
Outdated
Show resolved
Hide resolved
...pServices/tests/ComDisabled/System/Runtime/InteropServices/ComAwareEventInfoTests.Windows.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Product changes look fine to me.
For tests, I think we should have basic coverage for every public API we know this blocks - the current tests only hit some of them. We shouldn't need use all the different kinds of test data that the normal tests do, but I think one case for each API (with input such that it should hit the added checks/throws) would be nice.
I know the normal Marshal tests have a separate file for each API, but I think for the ComDisabled ones, it would be reasonable to group them (instead of basically having a lot of files with one test each).
Initial work to have the ability to turn off built-in COM support in windows. This change will allow COM to be turned off but the current behavior will be for built-in COM support to work with no changes for default case.
The initial changes to fix issue #50500. Added an internal property, Marshal.IsComSupported, that reads an AppContext value
System.Runtime.InteropServices.Marshal.IsComSupported
to set this property which is true by default. Added relevant checks in code for the processor directives, FEATURE_COMINTEROP_UNMANAGED_ACTIVATION and FEATURE_COMINTEROP, and throw NotSupportedException if this is set to false. Validated with some existing basic unit COM tests in NETClient and NativeClient.