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

Test-MofResourceType Inadvertently Unloads Module #29

Closed
alx9r opened this issue Dec 25, 2016 · 1 comment
Closed

Test-MofResourceType Inadvertently Unloads Module #29

alx9r opened this issue Dec 25, 2016 · 1 comment
Labels

Comments

@alx9r
Copy link
Owner

alx9r commented Dec 25, 2016

This invokation of Import-Module in New-ClassResourceObject seems to re-import the module of the class resource on each invokation even if it has already been loaded. It seems to happen once per bound resource, so the bigger the configuration document the slower the creation of the instructions. Some resource modules are large enough that they take seconds to load. The modules should probably remain cached as they are imported, but they don't currently seem to be.

@alx9r alx9r added the Feature label Dec 25, 2016
@alx9r
Copy link
Owner Author

alx9r commented Dec 26, 2016

It looks like this call to Test-MofResourceType can inadvertently invoke Remove-Module each time a new bound resource is created. The apparent offending call site seems to use an unreliable method for detecting whether a module is already loaded. Here is a trace demonstrating the problem from that call site:

image

The file extensions differ differ so the module described by $DscResourceInfo unloads the module. That is incorrect. A more rigorous method of detecting whether a module corresponding to a DSC resource is loaded should be used.

@alx9r alx9r changed the title Resource Importing Should Be Cached Test-MofResourceType Inadvertently Unloads Module Dec 26, 2016
@alx9r alx9r added Bug and removed Feature labels Dec 26, 2016
@alx9r alx9r closed this as completed in b608286 Dec 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant