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

Importing of Microsoft.Graph Hangs on checking .net4.7.2 requirements steps for 10+min #2479

Closed
dujuantaylor502 opened this issue Dec 5, 2023 · 6 comments

Comments

@dujuantaylor502
Copy link

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

Describe the bug
When running command "import-module microsoft.graph -verbose" it takes about 10min on the checking .net 4.7.2 requirements step.

To Reproduce
Steps to reproduce the behavior:
run command "import-module microsoft.graph -verbose" after installing the module
on the verbose step of checking .net 4.7.2 requirements it hangs for about 10min before proceeding

VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.

Expected behavior

I expect the import module command to take less than 5min

Debug Output
VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\microsoft.graph\1.27.0\microsoft.gra
ph.psd1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2
because it is not included in the list of permitted versions.
WARNING: Selected Microsoft Graph profile 'v1.0' does not exist for module 'Microsoft.Graph.Financials'. No cmdlets were loaded.
WARNING: Selected Microsoft Graph profile 'v1.0' does not exist for module 'Microsoft.Graph.WindowsUpdates'. No cmdlets were loaded.
Import-Module : Function Disable-MgDeviceManagementManagedDeviceLostMode cannot be created because function capacity 4096 has been exceeded for this scope.
At line:1 char:1

  • import-module microsoft.graph -Verbose -Debug
  •   + CategoryInfo          : InvalidOperation: (Disable-MgDevic...dDeviceLostMode:String) [Import-Module], SessionStateOverflowException
      + FullyQualifiedErrorId : FunctionOverflow,Microsoft.PowerShell.Commands.ImportModuleCommand
    
    

Module Version

Happens for current through N-3 versions.

Environment Data

Name Value


PSVersion 5.1.19041.3693
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3693
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Screenshots
image
Additional context
N/A

@timayabi2020
Copy link
Collaborator

Hi @dujuantaylor502 the errors you are getting is unfortunately a PowerShell 5.1 limitation.
You need to explore the following options as an alternative.

  • Use the latest version of PowerShell 7+ as the runtime version.
  • Only load the modules that you require. See list of modules here
  • Set $maximumfunctioncount variable to its max value, 32768.

@dujuantaylor502
Copy link
Author

dujuantaylor502 commented Dec 19, 2023 via email

@dujuantaylor502
Copy link
Author

dujuantaylor502 commented Dec 21, 2023 via email

@timayabi2020
Copy link
Collaborator

@dujuantaylor502 I'm still not able to reproduce your issue because when I try it on both PowerShell 5 and 7, it takes less than 20s. However, in PowerShell 7 installed modules are automatically imported to the session when you use any commands or providers in the module. If you are running a script, you should consider removing those import declarations.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

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

No branches or pull requests

2 participants