exePath must be specified when not running inside a stand alone exe.

May 28, 2013 at 2:51 AM
Hi Guys,
          Sometimes as I am working I get this error in the PrintDiagnostics function. I was just rebooting and it did not occur.
Now I have changed all the code references to point to my own debug compiled copies of the nakedObjects dlls and now I am getting this error again and its not going away when I reboot.
Any ideas for me?
 public static void PrintDiagnostics() {
            if (LOG.IsDebugEnabled) {

                Print("------- Naked Objects diagnostics report -------");
                PrintVersion();
                PrintBlock("System properties");
                NameValueCollection properties = GetProperties();
                IEnumerator names = properties.Keys.GetEnumerator();
                while (names.MoveNext()) {
                    var name = (string) names.Current;
                    Print(name + "= " + properties.Get(name));
                }

                Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
                PrintBlock("Assemblies");
                for (int i = 0; i < assemblies.Length; i++) {
                    Print(assemblies[i].FullName);
                }

                
                XDocument xd = null;

                try {
                    Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); // error exePath must be specified when not running inside a stand alone exe occurs here
                    if (File.Exists(cfg.FilePath)) {
                        var fileInfo = new FileInfo(cfg.FilePath);
                        using (FileStream fileStream = fileInfo.OpenRead()) {
                            using (XmlReader xr = XmlReader.Create(fileStream, new XmlReaderSettings {IgnoreWhitespace = true})) {
                                xd = XDocument.Load(xr);
                            }
                        }
                    }
                }
                catch (Exception) {
                    
                }


                if (xd != null) {
                    var sb = new StringBuilder();
                    using (var sw = new StringWriter(sb)) {
                        using (XmlWriter xmlWriter = XmlWriter.Create(sw, new XmlWriterSettings {Indent = true})) {
                            xd.WriteTo(xmlWriter);
                            xmlWriter.Flush();
                        }
                    }
                    PrintBlock("Configuration");
                    Print(sb.ToString());
                }


                PrintBlock("Locale information");
                Print("Default cultureInfo: " + Thread.CurrentThread.CurrentCulture);
                Print("Default timezone: " + TimeZone.CurrentTimeZone);
            }
        }
Regards,
           Alistair