S
Szymon Madejczyk
example code:
public class envtest
{
public static void Main()
{
System.Diagnostics.Process proc =
System.Diagnostics.Process.GetCurrentProcess();
string env = proc.StartInfo.EnvironmentVariables["test"];
}
}
when I compile that code to envtest.exe
and before running it set some env variables that differs only in letter
scope, i.e.
set test=1
set Test=1
I recieve following exception.
Unhandled Exception: System.ArgumentException: Item has already been
added. Key in dictionary: "test" Key being added:
"test"
at System.Collections.Hashtable.Insert(Object key, Object nvalue,
Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at System.Collections.Specialized.StringDictionary.Add(String key,
String value)
at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
at env.Main()
Unknown signal 79
I can catch it but I still cannot get variables value
Any idea how to handle that ?
Szymek
public class envtest
{
public static void Main()
{
System.Diagnostics.Process proc =
System.Diagnostics.Process.GetCurrentProcess();
string env = proc.StartInfo.EnvironmentVariables["test"];
}
}
when I compile that code to envtest.exe
and before running it set some env variables that differs only in letter
scope, i.e.
set test=1
set Test=1
I recieve following exception.
Unhandled Exception: System.ArgumentException: Item has already been
added. Key in dictionary: "test" Key being added:
"test"
at System.Collections.Hashtable.Insert(Object key, Object nvalue,
Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at System.Collections.Specialized.StringDictionary.Add(String key,
String value)
at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
at env.Main()
Unknown signal 79
I can catch it but I still cannot get variables value
Any idea how to handle that ?
Szymek