Title: Unexpected exception is thrown in PropertyAccessor.cs, line 138. · Issue #2205 · PowerShell/PowerShell · GitHub
Open Graph Title: Unexpected exception is thrown in PropertyAccessor.cs, line 138. · Issue #2205 · PowerShell/PowerShell
X Title: Unexpected exception is thrown in PropertyAccessor.cs, line 138. · Issue #2205 · PowerShell/PowerShell
Description: Steps to reproduce In CentOS7, Setup and run PSRP remote scenario by following instructions at https://github.com/powershell/psl-omi-provider. Expected behavior No exception is thrown. If needed, return a proper error. Actual behavior Hi...
Open Graph Description: Steps to reproduce In CentOS7, Setup and run PSRP remote scenario by following instructions at https://github.com/powershell/psl-omi-provider. Expected behavior No exception is thrown. If needed, r...
X Description: Steps to reproduce In CentOS7, Setup and run PSRP remote scenario by following instructions at https://github.com/powershell/psl-omi-provider. Expected behavior No exception is thrown. If needed, r...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2205
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected exception is thrown in PropertyAccessor.cs, line 138. ","articleBody":"\u003c!--\n\nIf it is a bug report:\n- make sure you are able to repro it on the latest released version. \nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\n- Search the existing issues.\n- Refer to the [FAQ](../docs/FAQ.md).\n- Refer to the [known issues](../docs/KNOWNISSUES.md).\n- Fill out the following repro template\n\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\n-->\n## Steps to reproduce\n\nIn CentOS7, Setup and run PSRP remote scenario by following instructions at https://github.com/powershell/psl-omi-provider. \n## Expected behavior\n\nNo exception is thrown. If needed, return a proper error. \n## Actual behavior\n\nHit exception as below when trying to login remotely from a windows client, \n PS C:\\windows\\system32> Enter-PSSession -ComputerName li-cent7 -Credential $cred -Authentication neg\notiate -SessionOption $o\nEnter-PSSession : The type initializer for 'System.Management.Automation.ConfigPropertyAccessor'\nthrew an exception.\nAt line:1 char:1\n- Enter-PSSession -ComputerName li-cent7 -Credential $cred -Authenticat ...\n- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n - CategoryInfo : NotSpecified: (:) [Enter-PSSession], TypeInitializationException\n - FullyQualifiedErrorId : RemoteRunspaceStateInfoReason\n## Environment data\n\n\u003c!-- provide the output of $PSVersionTable -->\n\n``` powershell\n> $PSVersionTable\nName Value\n---- -----\nPSVersion 6.0.0-alpha\nPSEdition Core\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\nBuildVersion 3.0.0.0\nGitCommitId v6.0.0-alpha.9\nCLRVersion\nWSManStackVersion 3.0\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\n```\n\nAfter debugging, the exception is thrown in PropertyAccessor.cs, line 138. When PSRP tries to CreatDirectory /root/.config/powershell under root at GetCurrentUserConfigDirectory(). It is inconsistent that the logic catches the exception at JsonConfigFileAccessor(), but not GetCurrentUserConfigDirectory(). \n\n```\n internal JsonConfigFileAccessor()\n {\n //\n // Sets the system-wide configuration directory\n //\n Assembly assembly = typeof(PSObject).GetTypeInfo().Assembly;\n psHomeConfigDirectory = Path.GetDirectoryName(assembly.Location);\n\n //\n // Sets the per-user configuration directory\n //\n appDataConfigDirectory = Utils.GetUserConfigurationDirectory();\n if (!Directory.Exists(appDataConfigDirectory))\n {\n try\n {\n Directory.CreateDirectory(appDataConfigDirectory);\n }\n catch (UnauthorizedAccessException)\n {\n // Do nothing now. This failure shouldn't block initialization\n appDataConfigDirectory = null;\n }\n }\n }\n\n /// \u003csummary>\n /// Enables delayed creation of the user settings directory so it does \n /// not interfere with PowerShell initialization\n /// \u003c/summary>\n /// \u003creturns>Returns the directory if present or creatable. Throws otherwise.\u003c/returns>\n private string GetCurrentUserConfigDirectory()\n {\n if (null == appDataConfigDirectory)\n {\n string tempAppDataConfigDir = Utils.GetUserConfigurationDirectory();\n if (!Directory.Exists(tempAppDataConfigDir))\n {\n Directory.CreateDirectory(tempAppDataConfigDir);\n // Only assign it if creation succeeds. It will throw if it fails.\n appDataConfigDirectory = tempAppDataConfigDir;\n }\n // Do not catch exceptions here. Let them flow up.\n }\n return appDataConfigDirectory;\n }\n```\n\ntempAppDataConfigDir is /root/.config/powershell at the failure case.\n","author":{"url":"https://github.com/lilyfang","@type":"Person","name":"lilyfang"},"datePublished":"2016-09-07T23:29:21Z","url":"https://github.com/PowerShell/PowerShell/issues/2205"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c0912be0-a846-9493-dc63-b9a4938f5305 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E004:178F0E:244641:349DCE:6AFD7A73 |
| html-safe-nonce | c551f8b9058df08c3988855572d5a50bec5ef5a0c57e2e1aecb665661af7dd3c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDA0OjE3OEYwRToyNDQ2NDE6MzQ5RENFOjZBRkQ3QTczIiwidmlzaXRvcl9pZCI6IjU5MjA0NDcxNDg5ODk0NDY3NzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1f15efc292265cbef9f4a95b9a74b3bd2a08ef7155959ad41c05f9008a425797 |
| hovercard-subject-tag | issue:175630636 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/2205/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e09ac2de9a72a52a73166165e12f88455fe6adc0368a489a4354efac244c8c32/PowerShell/PowerShell/issues/2205 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e09ac2de9a72a52a73166165e12f88455fe6adc0368a489a4354efac244c8c32/PowerShell/PowerShell/issues/2205 |
| og:image:alt | Steps to reproduce In CentOS7, Setup and run PSRP remote scenario by following instructions at https://github.com/powershell/psl-omi-provider. Expected behavior No exception is thrown. If needed, r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lilyfang |
| hostname | github.com |
| expected-hostname | github.com |
| None | 544ff6b59bd215c4609120f6e334dbd0b00d34fb6f8bc03a476f72256998887e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 71c92f8b27ec5e9aa6f6477b4e067a4727fc9edb |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width