{"record":{"id":"30370f5c47272e68","repo":"egametang/ET","slug":"dir-path-getfullpath-workingdirectory-command","errorCode":null,"errorMessage":"dir: {Path.GetFullPath(workingDirectory)}, command: {exe} {arguments}","messagePattern":"dir: (.+?), command: (.+?) (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.core/Scripts/Core/Share/Helper/ProcessHelper.cs","lineNumber":89,"sourceCode":"                    };\n            \n                    // 异步读取错误输出\n                    process.ErrorDataReceived += (sender, args) =>\n                    {\n                        if (!string.IsNullOrEmpty(args.Data))\n                        {\n                            Log.Error(args.Data);\n                        }\n                    };\n                    process.BeginOutputReadLine();\n                    process.BeginErrorReadLine();\n                }\n\n                return process;\n            }\n            catch (Exception e)\n            {\n                throw new Exception($\"dir: {Path.GetFullPath(workingDirectory)}, command: {exe} {arguments}\", e);\n            }\n        }\n    }\n}","sourceCodeStart":71,"sourceCodeEnd":93,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.core/Scripts/Core/Share/Helper/ProcessHelper.cs#L71-L93","documentation":"Thrown by ProcessHelper.Run when Process.Start (or its setup) fails for any reason. The framework wraps the original exception and echoes the resolved working directory, executable, and arguments so the operator can see exactly what it tried to launch. It is used to spawn dotnet and pwsh child processes during build/deploy steps.","triggerScenarios":"Calling ProcessHelper.Run/DotNet/PowerShell with an exe path that does not exist on the current OS (e.g. '/usr/local/share/dotnet/dotnet' missing on Linux), a workingDirectory that does not exist or is not accessible, or when UseShellExecute conflicts with RedirectStandardOutput.","commonSituations":"Wrong dotnet/pwsh install path on macOS/Linux (hardcoded /usr/local paths), building on a machine where the working directory was deleted by a clean step, permission denied on the binary, or a build pipeline running in a container without the runtime installed.","solutions":["Verify the executable path exists on the OS; on non-Windows install dotnet/pwsh to the hardcoded paths or adjust ProcessHelper.Run to use 'which dotnet'/'which pwsh' lookups.","Check that workingDirectory resolves to a real folder (Path.GetFullPath it before calling Run).","Inspect the wrapped inner exception (Exception.InnerException / .Message) for the real cause such as Win32 'No such file' or permission errors.","Ensure the process is not being launched with UseShellExecute=true while redirecting streams."],"exampleFix":"// before\nProcessHelper.DotNet(\"build\", \"./Missing\");\n// after\nvar dir = Path.GetFullPath(\"./Repo\");\nif (!Directory.Exists(dir)) throw new InvalidOperationException($\"workdir missing: {dir}\");\nProcessHelper.DotNet(\"build\", dir);","handlingStrategy":"try-catch","validationCode":"var exePath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? \"dotnet.exe\" : \"dotnet\";\nif (!File.Exists(exePath) && !HasOnPath(exePath))\n    throw new FileNotFoundException($\"executable not found: {exePath}\");\nif (!Directory.Exists(Path.GetFullPath(workingDirectory)))\n    throw new DirectoryNotFoundException(workingDirectory);","typeGuard":"null","tryCatchPattern":"try { return ProcessHelper.Run(exe, args, workdir, waitExit); }\ncatch (Exception e) when (e.Message.StartsWith(\"dir:\"))\n{\n    Log.Error($\"failed to launch process: {e.InnerException?.Message}\");\n    throw;\n}","preventionTips":["Resolve exe and workingDirectory to absolute paths and check existence before launching.","Use platform detection to pick the correct runtime path.","Always inspect InnerException for the real OS-level cause."],"tags":["process","diagnostics","build","csharp"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}