P
Paul Steele
I often use the following code to check if a program is already running:
if
(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length
This works find on all of my systems, but a student using one of my programs
reported that he was getting an "Unhandled Exception" trying to load my
program. This is even stranger since the code in question is in a try/catch
block. I took a look at the student's system but couldn't find any
immediately obvious that would cause this problem. The fact that it's
happening with two different applications indicates that there is some sort
of problem with his system. I suspect the .NET Framework but a reinstall of
that didn't help. Is there some other system process that would cause this
error to occur? I suspect a reinstall of Windows would solve the problem but
there has to be something a bit less drastic. Any suggestions would be
appreciated.
if
(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length
1) ...
This works find on all of my systems, but a student using one of my programs
reported that he was getting an "Unhandled Exception" trying to load my
program. This is even stranger since the code in question is in a try/catch
block. I took a look at the student's system but couldn't find any
immediately obvious that would cause this problem. The fact that it's
happening with two different applications indicates that there is some sort
of problem with his system. I suspect the .NET Framework but a reinstall of
that didn't help. Is there some other system process that would cause this
error to occur? I suspect a reinstall of Windows would solve the problem but
there has to be something a bit less drastic. Any suggestions would be
appreciated.