运行与System.Diagnostics.Process.Start程序会导致应用程序错误 [英] Running a program with System.Diagnostics.Process.Start causes an Application Error

查看:1370
本文介绍了运行与System.Diagnostics.Process.Start程序会导致应用程序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的电脑的DWG文件开放的:

On my PC DWG files open with:

"C:\Program Files\AutoCAD LT 2007\acadlt.exe" "%1"

如果我在命令行中运行以下命令:

If I run this from the command line:

"C:\Program Files\AutoCAD LT 2007\acadlt.exe" "C:\Some Path\Test.dwg"

AutoCAD的精简版打开DWG文件。

AutoCAD Lite open the DWG file.

同样的,如果我打开一个命令提示符并运行参数相同的exe文件,它工作正常。

Similarly if I open a command prompt and run the same exe with argument, it works fine.

但是,如果我用

var proc = new System.Diagnostics.Process();
var info = new System.Diagnostics.ProcessStartInfo();



然后

and then

info.FileName = "C:\Some Path\Test.dwg";
proc.StartInfo = info;
proc.Start();

info.FileName = "C:\Program Files\AutoCAD LT 2007\acadlt.exe";
info.Arguments= "C:\Some Path\Test.dwg"
proc.StartInfo = info;
proc.Start();

info.FileName = "cmd.exe";
info.Arguments= "C:\Program Files\AutoCAD LT 2007\acadlt.exe" "C:\Some Path\Test.dwg"
proc.StartInfo = info;
proc.Start();



我收到以下错误:

I get the following error:

在0x01317c8c在0x01317c8c指令引用内存。该内存不能为read。

The instruction at "0x01317c8c" referenced memory at "0x01317c8c". The memory could not be "read".

点击确定以终止程序
单击取消调试程序

Click on OK to terminate the program Click on CANCEL to debug the program

顺便说一句,如果我通过与调试器单步执行代码的代码工作正常。

Incidentally the code works ok if I step through the code with the debugger.

任何人都知道怎么用的Process.Start打开该DWG?

Anyone know how I can use Process.Start to open this DWG?

推荐答案

原来,这是Xenocode Postbuild导致应用程序错误。如果我在一个普通的EXE的.NET(不混乱)中运行相同的代码,它工作正常。我已经提到Xenocode一个解决方案。

It turns out that it was Xenocode Postbuild causing the Application Error. If I run the same code on a normal .NET exe (not obfuscated), it works fine. I have referred to Xenocode for a solution.

这篇关于运行与System.Diagnostics.Process.Start程序会导致应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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