Is the Broken Code Related to UAC Settings in AppData Folder?

  • Thread starter Thread starter CRGreathouse
  • Start date Start date
  • Tags Tags
    Broken Code
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
0 replies · 2K views
Messages
2,832
Reaction score
0
Broken code -- UAC related?

Here's the code I'm having trouble with, cut down the relevant part:

Code:
protected void ProcessFiles(string[] files)
{
	if (File.Exists(outputFilename))
		throw new Exception("Output file " + outputFilename + " already exists!");
	if (Directory.Exists(direc(outputFilename)))
		throw new Exception("Output file directory " + direc(outputFilename) + " does not exist!");
	MessageBox.Show("output filename ok");
	StreamWriter sw;
	try
	{
		sw = new StreamWriter(outputFilename);
	}
	catch
	{
		throw new Exception("Unspecified error");
	}
	MessageBox.Show("sw setup");
	// . . .

The "output filename ok" dialog comes up, but then nothing. The program doesn't crash, the exception doesn't occur, the "sw setup" dialog doesn't appear.

The output filename, for what it's worth, is in the user's AppData folder, so I don't think this should be a problem even with Vista's UAC, but I might be missing something obvious.