c# - Executing msbuild process through code gets exit code -1073741502 -
my application executing msbuild.exe using process.start();
running user. process running service. when executing process instantly fails , returns error code -1073741502
.
- i executing code service.
- no matter user, or permissions grant occurs (even administrator).
- the service user has both local security policy
run service
,impersonate user
- no matter logging methods not called. means it's failing before starts?
- other executables have no problem executing in manner.
- when not executing code service executes successfully.
- wtf negative error code
1073741502
??(!!) closest thing i've found this.
example code:
void main(){ var startinfo = new processstartinfo { filename = path, arguments = args, workingdirectory = workingpath, createnowindow = true, useshellexecute = false, redirectstandardoutput = true, redirectstandarderror = true, loaduserprofile = true, domain = system.environment.machinename, username = creds.username, password = generatesecurestring(creds.password) }; var process = process.start(startinfo); process.outputdatareceived += process_outputdatareceived; process.errordatareceived += process_outputdatareceived; process.exited += process_exited; process.enableraisingevents = true; process.waitforexit(); } internal void process_outputdatareceived(object sender, datareceivedeventargs e) { console.writeline(e.data); } void process_exited(object sender, eventargs e) { var process = ((process) sender); console.writeline("process has finished execution, exit code '{0}'.", process.exitcode); } private securestring generatesecurestring(string password) { var secure = new securestring(); foreach (var c in password.tochararray()) { secure.appendchar(c); } return secure; }
any appreciated. seems permissions/local security policy issue, without knowing more feels i've reached "definition of insanity" point of troubleshooting i'm repeating same actions expecting different result.
when investigating event logs see following exception (vague hell):
faulting application name: msbuild.exe, version: 12.0.31101.0, time stamp: 0x545443d5 faulting module name: kernelbase.dll, version: 6.3.9600.17668, time stamp: 0x54c846bb exception code: 0xc0000142 fault offset: 0x0009e052 faulting process id: 0x3e8 faulting application start time: 0x01d065cdac34cc77 faulting application path: c:\program files (x86)\msbuild\12.0\bin\msbuild.exe faulting module path: kernelbase.dll report id: ecce8b9d-d1c0-11e4-80d7-00155d611ee6 faulting package full name: faulting package-relative application id:
according thread ( why process crashing launched? ), starting process service may result in native createprocesswithlogonw
api call seems not working service. found thread because think i'm facing similar issue powershell start-process commandlet running in service (which make use of createprocesswithlogonw
internally.
Comments
Post a Comment