Skip to content

Conversation

@peombwa
Copy link
Member

@peombwa peombwa commented Mar 13, 2021

This PR closes #534 by implementing an assembly resolve handler that handles loading our dependencies for side-by-side loading with other modules. This change involves:

  • Dividing auth module into two assemblies: Microsoft.Graph.Authentication.Core and Microsoft.Graph.Authentication.
    image
    Microsoft.Graph.Authentication.Core and Microsoft.Graph.Authentication will be loaded by PowerShell, and all our dependencies will be loaded by Microsoft.Graph.Authentication.Core into the execution context.
    • Microsoft.Graph.Authentication.Core specifies and makes calls to our dependencies e.g. MSAL.
    • Microsoft.Graph.Authentication contains implementations of our cmdlets and calls methods in Microsoft.Graph.Authentication.Core.
  • Updates ADO pipeline scripts to build, sign, and pack Microsoft.Graph.Authentication and Microsoft.Graph.Authentication.Core assemblies into our Authentication module.
  • Adds pester tests to validate changes and ensure no breaking change is introduced.
  • Removes unused ADO pipeline scripts from .\azure-pipelines.

This PR should unblock #555, #415, #334, and #517

@peombwa peombwa changed the title Safe Dependency Resolution Safe Dependency Resolution For Side-By-Side Loading With Other Modules Mar 16, 2021
@peombwa peombwa requested review from ddyett and georgend March 16, 2021 22:41
@peombwa peombwa self-assigned this Mar 16, 2021
@peombwa peombwa marked this pull request as ready for review March 16, 2021 22:41
@georgend
Copy link
Contributor

Can this PR lead us to a path of building and testing on linux?

// Catalog our dependencies here to ensure we don't load anything else.
private static IReadOnlyDictionary<string, Version> Dependencies = new Dictionary<string, Version>
{
{ "Microsoft.Identity.Client", new Version("4.23.0.0") },
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the resolution logic use a file instead of being explicitly set here?

For example read the csproj to determine this list?

Copy link
Member Author

@peombwa peombwa Mar 19, 2021

Choose a reason for hiding this comment

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

We can't access csproj here since this is done at runtime and not build time. We need to know which assembly and version to load on our own when PowerShell imports a module thus the need for an in-memory dictionary.

Also, read and write speed is something to consider when resolving dependencies.

@peombwa
Copy link
Member Author

peombwa commented Mar 19, 2021

Can this PR lead us to a path of building and testing on linux?

@finsharp, the scope of this PR is only limited to addressing dependency resolution at runtime. To build on Linux, we will need to overhaul our generation scripts.

@georgend georgend merged commit e8b87ca into dev Mar 22, 2021
@peombwa peombwa deleted the po/AssemblyDependencyResolutionFix branch March 31, 2021 22:24
This was referenced Apr 12, 2021
peombwa added a commit that referenced this pull request Apr 16, 2021
* Bump .NET Core version

* Add client capability to MSAL.

* Bump MS Graph core version.

* Weekly OpenApiDocs Download

* Safe Dependency Resolution For Side-By-Side Loading With Other Modules (#585)

* Divide project into 2 assemblies.

* Update build scripts to build, sign and pack auth module with core dll.

* Updates ADO pipeline to also sign and strong name MSG.Authentication.Core.dll.

* Add Pester tests for loading module side by side.

* Add internals visible to test proj.

* Load multiframework dependencies.

* Weekly OpenApiDocs Download

* Update agreementFile remove directive (#605)

* Fix aggrement file directive.

* Bump SDK version to 1.4.3.

* Adds missing site permissions to sites module (#607)

* Add sistes.permissions tag to module mappings.

* Generate profile for sites.

* Sort crawl logs.

* Weekly OpenApiDocs Download (#616)

Co-authored-by: Microsoft Graph DevX Tooling <GraphTooling@service.microsoft.com>

* identity governance: reduce unneeded EM cmdlets  (#577)

* add suppression for autogenerated get cmdlets

* remove New cmdlets

* add remove set and update variants of those get cmdlets

* remove search and ro cmdlets

* remove cmdlets for read only links and objects

* Update src/Identity.Governance/Identity.Governance/readme.md

Co-authored-by: Peter Ombwa <peter.ombwa@microsoft.com>

* Weekly OpenApiDocs Download (#619)

Co-authored-by: Microsoft Graph DevX Tooling <GraphTooling@service.microsoft.com>

* 1.5.0 Pre-Release (#617)

* Bump SDK version to 1.5.0

* Handle duplicate cmdlet names across modules.

* Update readme.md

* Use version in manifest if module is not in repo.

Co-authored-by: Microsoft Graph DevX Tooling <GraphTooling@service.microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mark Wahl <mwahl@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement assembly resolve handler for side-by-side loading with other modules

3 participants