Skip to content

Conversation

@iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Feb 8, 2020

PR Summary

Address #9840.

  • Set correct PSProvider full name at module load time.
  • Make PSProvider.FullName public

PR Context

In #8831 we added caching for ProviderInfo.FullName. This created a side effect.
PowerShell engine loads a module with name based on RootModule manifest property. Then it set explicitly correct module name based on the module (manifest) path. If the module contains a provider PowerShell engine loads and initializes the provider too. Full name of the provider is based on the module name and it is cached. So we should update the provider full name too that the fix explicitly does.

PR Checklist

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Feb 8, 2020
@iSazonov iSazonov added this to the GA-consider milestone Feb 8, 2020
@iSazonov iSazonov force-pushed the fix-provider-drive-hidden2 branch from e9511dd to 5230d80 Compare February 8, 2020 17:15
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that you're using a foreach immediately below, would it be possible to remove the LINQ usage altogether?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I removed the LINQ.

@adityapatwardhan
Copy link
Member

@iSazonov Adding a new public API will need extra scrutiny for considering this for 7 GA.

@iSazonov
Copy link
Collaborator Author

iSazonov commented Feb 11, 2020

@adityapatwardhan I reverted FullName to internal and update test.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Feb 11, 2020
@rjmholt rjmholt self-requested a review February 12, 2020 23:46
@iSazonov
Copy link
Collaborator Author

@daxian-dbw @rjmholt Could you please review?

@iSazonov iSazonov modified the milestones: GA-consider, 7.1.0-preview.1 Mar 13, 2020
@iSazonov iSazonov force-pushed the fix-provider-drive-hidden2 branch from 279cfcf to e3ed09b Compare March 29, 2020 06:46
@iSazonov
Copy link
Collaborator Author

@daxian-dbw Could you please continue?

@adityapatwardhan
Copy link
Member

@daxian-dbw Please re-review

Copy link
Member

@daxian-dbw daxian-dbw Apr 24, 2020

Choose a reason for hiding this comment

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

I think we probably should add the smart-ness into ProviderInfo.FullName to change the cached _fullName when the ModuleName property is changing.
Something like this:

private string _cachedModuleName = null;
internal string FullName
{
    get
    {
        string GetFullName(string name, string psSnapInName, string moduleName)
        { ... }

        if (_fullName != null && _cachedModuleName == ModuleName)
        {
            return fullName;
        }

        _cachedModuleName = ModuleName;
        return (_fullName = GetFullName(Name, PSSnapInName, ModuleName));
    }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Apr 24, 2020
@iSazonov iSazonov force-pushed the fix-provider-drive-hidden2 branch from e3ed09b to 47e0d30 Compare April 25, 2020 07:02
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Apr 25, 2020
Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM

@adityapatwardhan adityapatwardhan merged commit 86b6a9d into PowerShell:master Apr 27, 2020
@adityapatwardhan adityapatwardhan added CL-Engine Indicates that a PR should be marked as an engine change in the Change Log and removed CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log labels Apr 27, 2020
@iSazonov iSazonov deleted the fix-provider-drive-hidden2 branch April 28, 2020 03:23
@ghost
Copy link

ghost commented May 19, 2020

🎉v7.1.0-preview.3 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants