-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add SetEntryAssembly()
API to System.Reflection
#102271
Conversation
Note regarding the
|
Tagging subscribers to this area: @dotnet/area-system-reflection |
src/coreclr/System.Private.CoreLib/CompatibilitySuppressions.xml
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
"s_overriddenEntryAssembly", added an API doc to SetEntryAssembly(), added validation for it to be a Runtime Assembly, and changed the type to allow a null entry assembly.
...ries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
This needs some tests ( is a good place to add them) |
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Outdated
Show resolved
Hide resolved
…embly.cs Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Seems I got an import wrong. Will look into it. |
...ries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs
Outdated
Show resolved
Hide resolved
...ics.TraceSource/tests/System.Diagnostics.TraceSource.Tests/DefaultTraceListenerClassTests.cs
Outdated
Show resolved
Hide resolved
fixed the issue with the remote executor.
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
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.
LGTM. Thank you!
I wonder where that trailing whitespace came from... Let me fix it so we can merge. Thanks a lot for your guidance with this @jkotas! |
Might be just my ptsd of breaking the outerloop with a PR I did last year, so I'll kick off an outerloop run just to be safe we can merge this. |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
…re not passing parameters to it.
* Trying out JanK's approach to override the entry assembly... * Fixed what was missing for this reflection scenario to work correctly. * Reverted the compatibility suppressions added by the build script. * Forgot to revert also the nativeaot part of the suppressions. * Addressed PR comments: Updated the tests to use the new "s_overriddenEntryAssembly", added an API doc to SetEntryAssembly(), added validation for it to be a Runtime Assembly, and changed the type to allow a null entry assembly. * Added tests and addressed more comments on the PR. * Added exception test case for SetEntryAssembly, and wrapped all its test cases in a RemoteExecutor.Invoke() call, in order to avoid potentially interferring with the GetEntryAssembly tests. * Update src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs Co-authored-by: Jan Kotas <jkotas@microsoft.com> * Refactored further the tests that force a null entry assembly, and fixed the issue with the remote executor. * Apply Jan's suggestions Co-authored-by: Jan Kotas <jkotas@microsoft.com> * Fixed a sneaky trailing whitespace that was messing up with the code analyzers. * Changed ConditionalTheory to ConditionalFact in the tests because we're not passing parameters to it. * Disabled building the CustomHostTests test file when .NET Framework --------- Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Implements the API proposal detailed and approved in issue #101616. This new API will allow developers to change the entry assembly of their .NET apps on the fly, should they require it. One important scenario is app launchers. With the usage of this API, then functions like
GetEntryAssembly()
will return the right value, and thus we will be able to ensure the information is consistent and correct.