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.
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.
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.
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));
}
}…se.cs Co-Authored-By: Robert Holt <rjmholt@gmail.com>
e3ed09b to
47e0d30
Compare
|
🎉 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.