【发布时间】:2021-01-03 02:24:19
【问题描述】:
我在运行控制台应用程序时遇到以下异常: 我在远程机器上运行的 Jenkins 服务器上面临构建问题(在发布模式下)。 我正在处理命令行参数,我认为错误原因意味着运行 exe 时没有传递任何参数。
unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at VstoManifestGenerator.Program.WriteOutput(String entry, Object[] args) in C:\Dev\Client\VstoManifestGenerator\VstoManifestGenerator\Program.cs:line 318
at VstoManifestGenerator.Program.Main(String[] args) in C:\Dev\Client\VstoManifestGenerator\VstoManifestGenerator\Program.cs:line 164
下面是我的命令行参数:
C:\Dev\Client\AddIns\Office\Word2010AddIn\bin\XTS.Office.AddIn.Word.dll Debug amd64
我在调试配置的本地开发机器上没有这个问题,我没有弄清楚是什么导致了这个问题。
这里谁能帮我解决一下。
谢谢。
【问题讨论】:
-
这是您应该了解minimal reproducible example的时候了
-
您将
_ouputfile在第一次(潜在)调用后设置为WriteOutput。 (主要) -
^^ 您在
catch(Main 中的外部)中调用WriteOutput,其中_ouputfile可能尚未设置。我猜这是 Stacktrace 的第 164 行? -
如果您告诉我们发生异常的行会有所帮助。使用 F11 单步执行代码并使用 F9 设置断点。
标签: c# .net xml visual-studio jenkins