c# - Trun off third party SDK after process exit/close/kill -


i've written c# application uses system.diagnostics.process class create process, using

var process = process.start(startinfo); 

the process invoked serviceinvoker. service calls third party dll in cource of duration.

after waiting time kill process using,

process.kill(); 

even after killing process if dll executing wont stop.

kill not invoke onexit event of process. how can stop dll execution in case.

any in matter appreciable .

maybe need kill process , children?

    /// <summary>     /// kill process, , of children, grandchildren, etc.     /// </summary>     /// <param name="pid">process id.</param>     private static void killprocessandchildren(int pid)     {         managementobjectsearcher searcher = new managementobjectsearcher           ("select * win32_process parentprocessid=" + pid);         managementobjectcollection moc = searcher.get();         foreach (managementobject mo in moc)         {             killprocessandchildren(convert.toint32(mo["processid"]));         }         try         {             process proc = process.getprocessbyid(pid);             proc.kill();         }         catch (argumentexception)         {             // process exited.         }     } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -