Add SetEntryAssembly() API to System.Reflection#102271
Merged
ivdiazsa merged 14 commits intodotnet:mainfrom May 21, 2024
ivdiazsa:managed-contract-facade
Merged
Add SetEntryAssembly() API to System.Reflection#102271ivdiazsa merged 14 commits intodotnet:mainfrom ivdiazsa:managed-contract-facade
SetEntryAssembly() API to System.Reflection#102271ivdiazsa merged 14 commits intodotnet:mainfrom
ivdiazsa:managed-contract-facade
Conversation
|
Note regarding the |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-reflection |
kg
reviewed
May 15, 2024
src/coreclr/System.Private.CoreLib/CompatibilitySuppressions.xml
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 15, 2024
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 15, 2024
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 15, 2024
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.
jkotas
reviewed
May 15, 2024
...ries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 15, 2024
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 15, 2024
Member
|
This needs some tests ( is a good place to add them) |
jkotas
reviewed
May 15, 2024
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Show resolved
Hide resolved
jkotas
reviewed
May 15, 2024
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>
Contributor
Author
|
Seems I got an import wrong. Will look into it. |
jkotas
reviewed
May 16, 2024
...ries/System.Configuration.ConfigurationManager/tests/System/Configuration/CustomHostTests.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 16, 2024
...ics.TraceSource/tests/System.Diagnostics.TraceSource.Tests/DefaultTraceListenerClassTests.cs
Outdated
Show resolved
Hide resolved
fixed the issue with the remote executor.
jkotas
reviewed
May 17, 2024
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 17, 2024
src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 17, 2024
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
May 17, 2024
src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Contributor
Author
|
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! |
Contributor
Author
|
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. |
Contributor
Author
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…re not passing parameters to it.
This was referenced May 17, 2024
This was referenced May 21, 2024
Ruihan-Yin
pushed a commit
to Ruihan-Yin/runtime
that referenced
this pull request
May 30, 2024
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.