I am getting below exception while running the console application: I am facing a build issue (in release mode) and on Jenkins server which is running on a remote machine. I am dealing with command line arguments and I thnk the error cause means that when exe is run no arguments are passed.
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
Below is my command line argument:
C:\Dev\Client\AddIns\Office\Word2010AddIn\bin\XTS.Office.AddIn.Word.dll Debug amd64
I don't have this issue on the local dev machine in debug configuration, I didn't figure out what causing this issue.
Can anyone here help me to solve it.
Thank you.
The stacktrace hints that _outputfile
has not yet been set, when WriteOutput
is called.
Make sure you initialize it before any call to WriteOutput
is made.
Mind:
string dependency;
try{
// exception thrown HERE
dependency = "somepath"; // <= Will not be executed
}
catch
{
CallToMethodDependingOnDependency(); // <= Will throw again
}
At first glance this looks like the call is after dependency is set but the exception jumps the initialization.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.