{"record":{"id":"732bbb32389bbc84","repo":"peass-ng/PEASS-ng","slug":"value-cannot-be-null-parameter-name-path-732bbb","errorCode":null,"errorMessage":"Value cannot be null.\r\nParameter name: path","messagePattern":"Value cannot be null\\.\r\nParameter name: path","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory.SetCurrentDirectory.cs","lineNumber":69,"sourceCode":"      /// <summary>\n      /// Sets the application's current working directory to the specified directory.\n      /// <para>\n      ///   MSDN: Multithreaded applications and shared library code should not use the GetCurrentDirectory function and should avoid using relative path names.\n      ///   The current directory state written by the SetCurrentDirectory function is stored as a global variable in each process,\n      ///   therefore multithreaded applications cannot reliably use this value without possible data corruption from other threads that may also be reading or setting this value.\n      ///   <para>This limitation also applies to the SetCurrentDirectory and GetFullPathName functions. The exception being when the application is guaranteed to be running in a single thread,\n      ///   for example parsing file names from the command line argument string in the main thread prior to creating any additional threads.</para>\n      ///   <para>Using relative path names in multithreaded applications or shared library code can yield unpredictable results and is not supported.</para>\n      /// </para>\n      /// </summary>\n      /// <param name=\"path\">The path to which the current working directory is set.</param>\n      /// <param name=\"pathFormat\">Indicates the format of the path parameter.</param>\n      [SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Utils.IsNullOrWhiteSpace validates arguments.\")]\n      [SecurityCritical]\n      public static void SetCurrentDirectory(string path, PathFormat pathFormat)\n      {\n         if (Utils.IsNullOrWhiteSpace(path))\n            throw new ArgumentNullException(\"path\");\n\n         var fullCheck = pathFormat == PathFormat.RelativePath;\n         Path.CheckSupportedPathFormat(path, fullCheck, fullCheck);\n         var pathLp = Path.GetExtendedLengthPathCore(null, path, pathFormat, GetFullPathOptions.AddTrailingDirectorySeparator);\n\n         if (pathFormat == PathFormat.FullPath)\n            pathLp = Path.GetRegularPathCore(pathLp, GetFullPathOptions.None, false);\n\n\n         // SetCurrentDirectory()\n         // 2016-09-29: MSDN does not confirm LongPath usage but a Unicode version of this function exists.\n         // 2017-05-30: MSDN confirms LongPath usage: Starting with Windows 10, version 1607\n\n         var success = NativeMethods.SetCurrentDirectory(pathLp);\n\n         var lastError = Marshal.GetLastWin32Error();\n         if (!success)\n            NativeError.ThrowException(lastError, pathLp);","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory.SetCurrentDirectory.cs#L51-L87","documentation":"An ArgumentNullException guard on the 'path' parameter of SetCurrentDirectory: the argument validation rejects a null string before the Win32 SetCurrentDirectory call is made. It fires only when the caller supplies null as the target directory path.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory.SetCurrentDirectory.cs:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply a non-null directory path to SetCurrentDirectory","Validate the path (null/empty check and Directory.Exists) before changing the current directory","Build the path from a known-good constant or validated configuration value"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}