{"record":{"id":"d8b0a5cd85d965e9","repo":"peass-ng/PEASS-ng","slug":"value-cannot-be-null-parameter-name-destination","errorCode":null,"errorMessage":"Value cannot be null.\r\nParameter name: destinationPath","messagePattern":"Value cannot be null\\.\r\nParameter name: destinationPath","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/File Class/File CopyMove/File.ValidateFileOrDirectoryMoveArguments.cs","lineNumber":62,"sourceCode":"         if (cma.PathsChecked)\n            return cma;\n\n\n         cma.IsCopy = IsCopyAction(cma);\n\n         if (!cma.IsCopy)\n            cma.DelayUntilReboot = VerifyDelayUntilReboot(sourcePath, cma.MoveOptions, cma.PathFormat);\n\n\n         if (cma.PathFormat != PathFormat.LongFullPath)\n         {\n            if (null == sourcePath)\n               throw new ArgumentNullException(\"sourcePath\");\n            \n            // File Move action: destinationPath is allowed to be null when MoveOptions.DelayUntilReboot is specified.\n\n            if (!cma.DelayUntilReboot && null == destinationPath)\n               throw new ArgumentNullException(\"destinationPath\");\n            \n\n            if (sourcePath.Trim().Length == 0)\n               throw new ArgumentException(Resources.Path_Is_Zero_Length_Or_Only_White_Space, \"sourcePath\");\n\n            if (null != destinationPath && destinationPath.Trim().Length == 0)\n               throw new ArgumentException(Resources.Path_Is_Zero_Length_Or_Only_White_Space, \"destinationPath\");\n\n\n            // MSDN: .NET3.5+: IOException: The sourceDirName and destDirName parameters refer to the same file or directory.\n            // Do not use StringComparison.OrdinalIgnoreCase to allow renaming a folder with different casing.\n\n            if (sourcePath.Equals(destinationPath, StringComparison.Ordinal))\n               NativeError.ThrowException(Win32Errors.ERROR_SAME_DRIVE, destinationPath);\n\n\n            if (!driveChecked)\n            {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/File Class/File CopyMove/File.ValidateFileOrDirectoryMoveArguments.cs#L44-L80","documentation":"File.Move / CopyMove allows destinationPath to be null only when MoveOptions.DelayUntilReboot is specified (pending-rename style move). In every other case a null destinationPath raises ArgumentNullException(\"destinationPath\") during argument validation.","triggerScenarios":"Calling File.Move(src, null) or File.CopyMove(src, null, ...) without MoveOptions.DelayUntilReboot in the MoveOptions.","commonSituations":"Code paths where the destination is computed dynamically (e.g. renaming based on a value that came back null); forgetting to pass MoveOptions.DelayUntilReboot when deliberately deferring the move until reboot.","solutions":["Supply a non-null destination path string.","If a deferred move is intended, add MoveOptions.DelayUntilReboot to the MoveOptions and keep the null destination.","Validate the destination value before calling."],"exampleFix":"// before\nFile.Move(src, dstPath); // ArgumentNullException when dstPath is null\n// after\nFile.Move(src, dstPath ?? throw new ArgumentException(\"Destination required.\"), MoveOptions.DelayUntilReboot);","handlingStrategy":"validation","validationCode":"if (destinationPath == null && !moveOptions.HasFlag(MoveOptions.DelayUntilReboot))\n    throw new ArgumentException(\"destinationPath is required unless MoveOptions.DelayUntilReboot is set.\", nameof(destinationPath));","typeGuard":"static bool RequiresDestination(MoveOptions opts) => !opts.HasFlag(MoveOptions.DelayUntilReboot);","tryCatchPattern":"try { File.Move(src, destinationPath); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"destinationPath\")\n{\n    // destination missing and no DelayUntilReboot: compute a default and retry\n    File.Move(src, Path.ChangeExtension(src, \".moved\"));\n}","preventionTips":["Only omit destinationPath together with MoveOptions.DelayUntilReboot","Compute destinations with Path.Combine and validate before calling","Never pass an empty string where a null-with-DelayUntilReboot was intended"],"tags":["arguments","null","argumentnullexception"],"backgroundTag":"null-path-argument","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}