Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Broken code - UAC related?

  1. Oct 30, 2008 #1


    User Avatar
    Science Advisor
    Homework Helper

    Broken code -- UAC related?

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

    Code (Text):
    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;
            sw = new StreamWriter(outputFilename);
            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.
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted