Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6620233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:04:19+00:00 2026-05-25T21:04:19+00:00

When using System.Diagnostics.Eventing.Reader.EventLogQuery to read events from the Windows Event Log, the EventRecord.FormatDescription() method

  • 0

When using System.Diagnostics.Eventing.Reader.EventLogQuery to read events from the Windows Event Log, the EventRecord.FormatDescription() method sometimes returns null. Why is this? In the Event Viewer there are messages on the events which return null.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:04:19+00:00Added an answer on May 25, 2026 at 9:04 pm

    This is due to a bug in the .NET framework.

    Basically what you need to do to work around this bug is to set the CurrentCulture to “en-US”.

    Example:

    var beforeCulture = Thread.CurrentThread.CurrentCulture;
    
    try
    {
      Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
    
      using (var session = new EventLogSession(ipOrAddress, userDomain, username, password, SessionAuthentication.Default))
      {
        var query = new EventLogQuery("System", PathType.LogName, queryString)
          {
            ReverseDirection = true,
            Session = session
          };
    
        using (var reader = new EventLogReader(query))
        {
          for (var record = reader.ReadEvent(); record != null; record = reader.ReadEvent())
          {
            // Read event records
            string message = record.FormatDescription();
          }
        }
      }
    }
    finally
    {
      Thread.CurrentThread.CurrentCulture = beforeCulture;
    }
    

    This workaround is was very hard to find, so I thought I would document it a place where it will be indexed by Google. I found it in an old MS Connect case, but it has been closed with a status of “wont fix”.

    UPDATE:
    The bug has been reported for .NET 4 as well and the status is “Sent to Engineering Team for consideration” and comment alluding that the bug might be fixed in the next major .NET framework release (v5).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using System.Diagnostics.Process to execute an svn command from a windows console application. This
I'm using System.Diagnostics.ProcessStartInfo to set up the parameters for launching a process from a
It's common knowledge that using System.Diagnostics.Process.Start is the way to launch a url from
I need a flexible way to log keyvalue pairs of arguments using System.Diagnostics.Trace. Basically,
I'm creating new processes using System.Diagnostics.Process class from my application. I want this processes
I am trying to call a process using System.Diagnostics.Process, send it a parameter, just
I have a simple Tray icon program that opens a site using System.Diagnostics.Process.Start(URL) And
I have the following code: using System; using System.Diagnostics; using System.IO; using PdfSharp.Pdf.Printing; namespace
I have implemented tracing based on System.Diagnostics. I am also using a System.Diagnostics.TextWriterTraceListener, and
I'm investigating the differences between using log4net and System.Diagnostics.Trace for logging, and I'm curious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.