My updater is failing to close my main program (C#) -


i have updater, called via main program once update detected (from remote xml file), first checks whether process open

if (clsprocess.processname.tolower().contains("conkinator-bot.exe")) {      clsprocess.closemainwindow();     return true;  } 

(this gets run every process until finds (foreach loop))

the updater downloads file:

client.downloadfile(url, "conkinator-bot-new.exe"); 

and attempts delete current 1 , rename it:

file.delete("conkinator-bot.exe"); file.move("conkinator-bot-new.exe", "conkinator-bot.exe"); 

but error when occurs following:

unhandled exception: system.unauthorizedaccessexception: access path 'd:\conkinator's skype tool\conkinator-bot.exe' denied.

however new version of program download.

just because main window closed doesn't mean process over. need wait process exit after close main window:

clsprocess.waitforexit(); 

ideally, you'd use timeout - there might preventing window closing, or process might have faulty exit mechanism.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -