Skip to content
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

Assembly loading improvements #20196

Merged
merged 4 commits into from
Dec 28, 2022
Merged

Assembly loading improvements #20196

merged 4 commits into from
Dec 28, 2022

Conversation

isra-fel
Copy link
Member

@isra-fel isra-fel commented Nov 22, 2022

Description

  • This PR disables assembly preloading because we already implemented lazy-loading.
  • The definitions of dependency assemblies are centralized, and with more flexibility. You can specify a range of PowerShell versions to load a certain assembly, or a type of OS. Thanks to this the size of Az module is also reduced.
    • Duplicated Azure.Identity.dll is removed.
    • The following assemblies used to have both netframework and netstandard version in our codebase. This PR removed the netframework versions:
      • Microsoft.Bcl.AsyncInterfaces
      • Microsoft.IdentityModel.Abstractions
      • System.Memory.Data
      • System.Text.Json

Design

The core implementation is a new project named AssemblyLoading (and a new assembly Microsoft.Azure.PowerShell.AssemblyLoading) in Az.Accounts module. The two assembly loaders CustomeAssemblyLoader and AzAssemblyLoadContext will depend on this project to provide the list of assemblies to load according to the environment.

Checklist

  • SHOULD select appropriate branch. Cmdlets from Autorest.PowerShell should go to generation branch.
  • SHOULD make the title of PR clear and informative, and in the present imperative tense.
  • SHOULD update ChangeLog.md file(s) appropriately
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense. Add changelog in description section if PR goes into generation branch.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD have approved design review for the changes in this repository (Microsoft internal only) with following situations
    • Create new module from scratch
    • Create new resource types which are not easy to conform to Azure PowerShell Design Guidelines
    • Create new resource type which name doesn't use module name as prefix
    • Have design question before implementation
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT introduce breaking changes in Az minor release except preview version.
  • SHOULD NOT adjust version of module manually in pull request

@isra-fel isra-fel force-pushed the yeming/assembly-loading branch from baee16a to 77d88d2 Compare November 23, 2022 07:51
@isra-fel isra-fel force-pushed the yeming/assembly-loading branch 2 times, most recently from 7cdda32 to 26f3e9a Compare December 5, 2022 06:39
@isra-fel
Copy link
Member Author

isra-fel commented Dec 6, 2022

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@isra-fel isra-fel force-pushed the yeming/assembly-loading branch from 3d2a6db to bdd5297 Compare December 8, 2022 03:12
@isra-fel isra-fel force-pushed the yeming/assembly-loading branch from 79352ab to 552920a Compare December 9, 2022 06:14
Comment on lines -26 to -29
<Target Name="CopyFiles" AfterTargets="Build">
<Copy SourceFiles="@(PreLoadAssemblies)" DestinationFolder="$(TargetDir)\PreloadAssemblies" />
<Copy SourceFiles="@(NetCoreAssemblies)" DestinationFolder="$(TargetDir)\NetCoreAssemblies" />
</Target>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines were added to support data plane track 2 SDK (#11520). They preload Azure.Core.dll and its dependencies. But now Azure.Core is handled by Az.Accounts so these are no longer needed.
cc @blueww

@isra-fel isra-fel marked this pull request as ready for review December 15, 2022 09:11
@isra-fel isra-fel mentioned this pull request Dec 16, 2022
1 task
@msJinLei msJinLei self-assigned this Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants