-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Set correct PSProvider full name #11813
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
Set correct PSProvider full name #11813
Conversation
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
e9511dd to
5230d80
Compare
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Outdated
Show resolved
Hide resolved
|
@iSazonov Adding a new public API will need extra scrutiny for considering this for 7 GA. |
|
@adityapatwardhan I reverted FullName to internal and update test. |
src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Outdated
Show resolved
Hide resolved
|
@daxian-dbw @rjmholt Could you please review? |
279cfcf to
e3ed09b
Compare
|
@daxian-dbw Could you please continue? |
|
@daxian-dbw Please re-review |
There was a problem hiding this comment.
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));
}
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…se.cs Co-Authored-By: Robert Holt <rjmholt@gmail.com>
e3ed09b to
47e0d30
Compare
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
🎉 Handy links: |
PR Summary
Address #9840.
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
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.