Uh oh!
There was an error while loading. Please reload this page.
Add SetEntryAssembly() API to System.Reflection - #102271
Conversation
ghost
commented
May 15, 2024
Note regarding the |
Tagging subscribers to this area: @dotnet/area-system-reflection |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
"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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This needs some tests ( is a good place to add them) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…embly.cs Co-authored-by: Jan Kotas <jkotas@microsoft.com>
ivdiazsa
commented
May 16, 2024
Seems I got an import wrong. Will look into it. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
fixed the issue with the remote executor.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
ivdiazsa
commented
May 17, 2024
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! |
ivdiazsa
commented
May 17, 2024
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. |
ivdiazsa
commented
May 17, 2024
/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.