Prerequisites
Steps to reproduce
- Installed pwsh 7.4.0-preview-4 on a domain joined PC, but the PC was on an external network provided by a mobile hotspot.
- Tried to launch pwsh-preview after installing
Expected behavior
PowerShell launches normally and prompt provided.
Actual behavior
PowerShell fails to start with the following message:
The shell cannot be started. A failure occurred during initialization:
Object reference not set to an instance of an object.
Note that if the PC is on the domain network, the preview release starts normally. It does not start if either a different network connection is used that doesn't have access to the domain network, or the network is turned off all together.
I also tested on pwsh 7.3.2 and pwsh 7.4.0-preview.3 and on both these versions pwsh will start in either state so the bug must have been introduced between 7.4.0-preview.3 and 7.4.0-preview.4.
I was not able to inspect the exception in the release version as the shell does not stay running. I built a debug version from my working area (that is between preview.3 and preview.4 in terms of code), and found it asserted on the machine in question with the following error:
pathToAdd should not be null according to contract of the function.
This is being triggered in GetModulePath of ModuleIntrinsics.cs when it tries to add a path to the module path, but the value it's trying to add is null.
I tried checking if each of personalModulePathToUse, sharedModulePath and systemModulePathToUse is null before allowing them to be added, and with that change, the debug version of pwsh starts on the machine in question when in the disconnected state, but I'm not clear on what this code is doing with the path indices after adding them so I'm not confident to provide a PR for this.
### Error details
_No response_
### Environment data
```powershell
Name Value
---- -----
PSVersion 7.4.0-preview.4
PSEdition Core
GitCommitId 7.4.0-preview.4
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
Expected behavior
PowerShell launches normally and prompt provided.Actual behavior
Note that if the PC is on the domain network, the preview release starts normally. It does not start if either a different network connection is used that doesn't have access to the domain network, or the network is turned off all together.
I also tested on pwsh 7.3.2 and pwsh 7.4.0-preview.3 and on both these versions pwsh will start in either state so the bug must have been introduced between 7.4.0-preview.3 and 7.4.0-preview.4.
I was not able to inspect the exception in the release version as the shell does not stay running. I built a debug version from my working area (that is between preview.3 and preview.4 in terms of code), and found it asserted on the machine in question with the following error:
This is being triggered in
GetModulePathofModuleIntrinsics.cswhen it tries to add a path to the module path, but the value it's trying to add is null.I tried checking if each of
personalModulePathToUse,sharedModulePathandsystemModulePathToUseis null before allowing them to be added, and with that change, the debug version of pwsh starts on the machine in question when in the disconnected state, but I'm not clear on what this code is doing with the path indices after adding them so I'm not confident to provide a PR for this.Visuals
No response