Connecting Tech Pros Worldwide Help | Site Map

Error while capturing details from an eventlog

Newbie
 
Join Date: Nov 2007
Posts: 3
#1: Oct 6 '09
Hi All,

I have created a tool in c#, which monitors the eventlog ( security log) and fetches the details of every new entry.

The tool runs fine on one of the machines, but on another machine it runs well for some time and then starts giving the following error:

"The description for Event ID '0' in Source '' cannot be found.
The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event: "


The code is as follows:
Expand|Select|Wrap|Line Numbers
  1. if (eventLog == null) 
  2. eventLog = new EventLog("Security"); 
  3. eventLog.EntryWritten += new EntryWrittenEventHandler(EntryToLog); 
  4. eventLog.EnableRaisingEvents = true; 
  5. ... 
  6. ... 
  7. private void EntryToLog(Object source, System.Diagnostics.EntryWrittenEventArgs e) 
  8. < captures various details of e and proccessed them accordingly 
  9.  
I am not able to figure out if the problem is with the tool, the .net framework or with the machine's event log.

Any kind of help will be highly appreciated

Thanks,

Priyanka
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,148
#2: Oct 8 '09

re: Error while capturing details from an eventlog


When you open the eventlog in the regular viewer, do you see correct messages for the events?
Newbie
 
Join Date: Nov 2007
Posts: 3
#3: Oct 8 '09

re: Error while capturing details from an eventlog


Yes the events logged in the eventvwr are normal and there are no such errors
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,148
#4: Oct 8 '09

re: Error while capturing details from an eventlog


Weird. The only time I have ever seen that error was when I was on an embeded/mobile device, and the like "debug" information for the .NET libraries wasn't there. But that was for every exception. Not sure how to fix it
Reply