Share via


Little Mysteries of the Day

Here's a few random musings from a day of testing a few months ago. I was trying to test some workflow designer scenarios involving gac'ed custom assemblies.

Q. Where is gacutil.exe?

(Answer - It depends... it might not be anywhere at all)

Q. Using the following code why do I not get anything in stderr or stdout when gacutil returns exit code 1?

ProcessStartInfo gac = new ProcessStartInfo(path, args);
gac.UseShellExecute = false;
gac.RedirectStandardError = true;
gac.RedirectStandardOutput = true;
Process gacProcess = Process.Start(gac);
gacProcess.WaitForExit();
int exitCode = gacProcess.ExitCode;
string stderr = gacProcess.StandardError.ReadToEnd();
string stdout = gacProcess.StandardError.ReadToEnd();

(Answer: two reasons.

#1 is in the sample comments on MSDN:
// Do not wait for the child process to exit before
// reading to the end of its redirected error stream.
// p.WaitForExit();
// Read the error stream first and then wait.

Reason #2: There is also a copy/paste bug)

Q. Where does reg.exe work when I pass it /f on the command line but not in code?

(Answer - I was always passing /f at the end when using the command line, but at the start in my code. Reg.exe requires /f after the key name.)

Q. Why isn't my Delay Signing Verification Override working? (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\RARM_Main,93D370B399D1A40)

(Answer - Yet another copy/paste bug. I missed one digit at the end. Sigh.)