Note that there are some explanatory texts on larger screens.

plurals
  1. POReaches code, doesn't execute and exits without error
    primarykey
    data
    text
    <p>All my code works fine up to this point:</p> <pre><code>using System.Diagnostics; namespace WebPortalLogging { public static class EventLogging { public static void LogEvent(string origin, string message, EventLogEntryType eventLogEntryType, int eventId) { const string source = "Software"; const string log = "Application"; if (!EventLog.SourceExists(source)) EventLog.CreateEventSource(source, log); EventLog.WriteEntry(source, message, eventLogEntryType, eventId); } } } </code></pre> <p>I even use this class in another project and it works fine. When it hits this line:</p> <p>if (!EventLog.SourceExists(source)) EventLog.CreateEventSource(source, log);</p> <p>It hits this line and exits.</p> <p>Here is what is in my output:</p> <pre><code>The thread 'vshost.NotifyLoad' (0x28c) has exited with code 0 (0x0). The thread 'vshost.LoadReference' (0x470) has exited with code 0 (0x0). 'VmBackup.vshost.exe' (Managed (v4.0.30319)): Loaded 'D:\Google Drive\Code\VMBackup\VMBackup\bin\Debug\VmBackup.exe', Symbols loaded. 'VmBackup.vshost.exe' (Managed (v4.0.30319)): Loaded 'D:\Google Drive\Code\VMBackup\VMBackup\bin\Debug\WebPortalLogging.dll', Symbols loaded. The thread '&lt;No Name&gt;' (0xa44) has exited with code 0 (0x0). 'VmBackup.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The thread '&lt;No Name&gt;' (0x107c) has exited with code 0 (0x0). The thread '&lt;No Name&gt;' (0x1838) has exited with code 0 (0x0). The thread 'vshost.RunParkingWindow' (0xa78) has exited with code 0 (0x0). The thread '&lt;No Name&gt;' (0x10e0) has exited with code 0 (0x0). The program '[6436] VmBackup.vshost.exe: Program Trace' has exited with code 0 (0x0). The program '[6436] VmBackup.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0). </code></pre> <p>It doesn't reach the EventLog.WriteEntry. It is not outputting to the event log either. I've restarted VS2010 and that didn't help. I have prompt at all errors turned on.</p> <p>What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload