77using System . Collections ;
88using System . Collections . Generic ;
99using System . Collections . ObjectModel ;
10- using System . Text ;
1110
1211using Microsoft . Azure . Functions . PowerShellWorker . Utility ;
1312using Microsoft . Azure . WebJobs . Script . Grpc . Messages ;
1716namespace Microsoft . Azure . Functions . PowerShellWorker . PowerShell
1817{
1918 using System . Management . Automation ;
20- using System . Reflection ;
2119
2220 internal class PowerShellManager
2321 {
@@ -44,23 +42,25 @@ internal class PowerShellManager
4442
4543 public static PowerShellManager Create ( RpcLogger logger )
4644 {
47- // Set up initial session state: set execution policy, import helper module, and using namespace
45+ // Set up initial session state
4846 var initialSessionState = InitialSessionState . CreateDefault ( ) ;
4947 if ( Platform . IsWindows )
5048 {
5149 initialSessionState . ExecutionPolicy = Microsoft . PowerShell . ExecutionPolicy . Unrestricted ;
5250 }
5351 var pwsh = PowerShell . Create ( initialSessionState ) ;
5452
55- // Add HttpResponseContext namespace so users can reference
56- // HttpResponseContext without needing to specify the full namespace
57- // and also import the Azure Functions binding helper module
53+ // Build path to the Azure Functions binding helper module
5854 string modulePath = System . IO . Path . Join (
5955 AppDomain . CurrentDomain . BaseDirectory ,
6056 "Azure.Functions.PowerShell.Worker.Module" ,
6157 "Azure.Functions.PowerShell.Worker.Module.psd1" ) ;
58+
59+ // Add HttpResponseContext namespace so users can reference
60+ // HttpResponseContext without needing to specify the full namespace
6261 pwsh . AddScript ( $ "using namespace { typeof ( HttpResponseContext ) . Namespace } ")
6362 . AddStatement ( )
63+ // Import the Azure Functions binding helper module
6464 . AddCommand ( "Import-Module" )
6565 . AddParameter ( "Name" , modulePath )
6666 . AddParameter ( "Scope" , "Global" )
@@ -83,7 +83,6 @@ public Hashtable InvokeFunction(
8383 // If it does, we invoke the command of that name. We also need to fetch
8484 // the ParameterMetadata so that we can tell whether or not the user is asking
8585 // for the $TriggerMetadata
86-
8786 using ( ExecutionTimer . Start ( _logger , "Parameter metadata retrieved." ) )
8887 {
8988 if ( entryPoint != "" )
0 commit comments