NullReferenceException在Process.Start()上 [英] NullReferenceException on Process.Start()

查看:93
本文介绍了NullReferenceException在Process.Start()上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些.Net C ++代码可以启动一个新进程,如下所示:

I have some .Net C++ code that starts a new process as below:

   pProcess = new Process();
   pProcess->StartInfo->FileName  = myappexe;
   pProcess->StartInfo->Arguments = some_parameters;

   try
   {
      pProcess->Start();
   }
   catch(Exception * e)
   {
      ... process the exception ...
      fSuccess = false;
   }

推荐答案

一些其他信息:

Some further info:

我在调试下发现pProcess-> startInfo-> useShellExecute设置为true;如果我在调试会话中将其重置为false,则NullReferenceException消失,并且该过程正常启动.但是我仍然不明白是什么原因导致了这种情况 默认情况下具有错误的值,或者为什么现在需要将其设置为false(如果这已更改).

I found under debug that pProcess->startInfo->useShellExecute is set to true; if I reset it to false in the debug session the NullReferenceException disappears, and the process starts up fine. But I still don't understand what has caused this to spontaneously have the wrong value by default, or why it now needs to be false (if thats what has changed).


这篇关于NullReferenceException在Process.Start()上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆