{"record":{"id":"263f832142eee774","repo":"peass-ng/PEASS-ng","slug":"value-cannot-be-null-parameter-name-path-263f83","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/File Class/File Core Methods/File.DeleteFileCore.cs","lineNumber":48,"sourceCode":"{\n   public static partial class File\n   {\n      /// <summary>Deletes a Non-/Transacted file.</summary>\n      /// <remarks>If the file to be deleted does not exist, no exception is thrown.</remarks>\n      /// <exception cref=\"ArgumentException\"/>\n      /// <exception cref=\"NotSupportedException\"/>\n      /// <exception cref=\"UnauthorizedAccessException\"/>\n      /// <exception cref=\"FileReadOnlyException\"/>\n      /// <param name=\"transaction\">The transaction.</param>\n      /// <param name=\"path\">The name of the file to be deleted.</param>\n      /// <param name=\"ignoreReadOnly\"><c>true</c> overrides the read only <see cref=\"FileAttributes\"/> of the file.</param>\n      /// <param name=\"attributes\"></param>\n      /// <param name=\"pathFormat\">Indicates the format of the path parameter(s).</param>\n      [SecurityCritical]\n      internal static void DeleteFileCore(KernelTransaction transaction, string path, bool ignoreReadOnly, FileAttributes attributes, PathFormat pathFormat)\n      {\n         if (null == path)\n            throw new ArgumentNullException(\"path\");\n\n         if (pathFormat == PathFormat.RelativePath)\n            Path.CheckSupportedPathFormat(path, true, true);\n\n         var pathLp = Path.GetExtendedLengthPathCore(transaction, path, pathFormat, GetFullPathOptions.TrimEnd | GetFullPathOptions.RemoveTrailingDirectorySeparator);\n\n\n         // Reset attributes to Normal if we already know the facts.\n\n         if (ignoreReadOnly && IsReadOnlyOrHidden(attributes))\n\n            SetAttributesCore(transaction, false, pathLp, FileAttributes.Normal, PathFormat.LongFullPath);\n\n\n      startDeleteFile:\n\n         if (!(null == transaction || !NativeMethods.IsAtLeastWindowsVista\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/File Class/File Core Methods/File.DeleteFileCore.cs#L30-L66","documentation":"DeleteFileCore validates its 'path' argument and throws ArgumentNullException when it is null. AlphaFS uses explicit guard clauses because native DeleteFile cannot receive a null path. The null propagates from caller code passing an uninitialized path string.","triggerScenarios":"Calling File.Delete(path) or File.DeleteTransacted(transaction, path) with a null path string (e.g. from a failed lookup, uninitialized variable, or Split/substring producing null).","commonSituations":"Registry or config values read as null and fed directly into File.Delete; a search result returned no path; variables declared but never assigned before cleanup code runs.","solutions":["Initialize or obtain a valid non-null path before calling File.Delete","Add a null check on the path before invoking the delete","Fix the upstream code that produced the null path (e.g. failed config read)"],"exampleFix":"// before\nstring path = GetPathFromConfig();\nFile.Delete(path);\n// after\nstring path = GetPathFromConfig();\nif (string.IsNullOrEmpty(path)) throw new InvalidOperationException(\"path not configured\");\nFile.Delete(path);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(path)) throw new ArgumentException(\"path must be provided\", nameof(path));","typeGuard":"bool IsValidPath(string p) => !string.IsNullOrWhiteSpace(p) && p.IndexOfAny(Path.GetInvalidPathChars()) < 0;","tryCatchPattern":"try { File.Delete(path); }\ncatch (ArgumentNullException ex) { Log(\"null path passed to delete: \" + ex.ParamName); }","preventionTips":["Validate paths coming from config/registry before use","Never pass results of failed lookups directly to File.Delete","Use string.IsNullOrWhiteSpace guards at API boundaries"],"tags":["null","argumentnull","path","validation"],"backgroundTag":"null-path-argument","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}