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

  • SEARCH
  • Home
  • 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 4270888
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:22:03+00:00 2026-05-21T07:22:03+00:00

Encountered a strange problem with this event, event wrapper and handler: public delegate void

  • 0

Encountered a strange problem with this event, event wrapper and handler:

public delegate void StatusUpdateHandler(string message, Exception exc, SeverityLevel severity);

public event StatusUpdateHandler StatusUpdate;

private void FireStatusUpdate(string message)
{
    if (this.StatusUpdate != null)
        this.StatusUpdate(message, null, SeverityLevel.None);
}

void scanDocProcessor_StatusUpdate(string message, Exception exc, SeverityLevel severity)
{
    try
    {
        if (exc != null)
        {
            if (severity >= setSevLevel)
                this._logger.Log(message + Environment.NewLine + exc.ToString(), LogEntryType.Emergency, "OCR Submission Processor Status Update", true);
            else
                this._logger.Log(message + Environment.NewLine + exc.ToString(), LogEntryType.Error, "OCR Submission Processor Status Update", false);
        }
        else if (severity >= setSevLevel)
        {
            this._logger.Log(message, LogEntryType.Info, "OCR Submission Processor Status Update", true, true);
        }
        else
            this._logger.Log(message, LogEntryType.Info, "OCR Submission Processor Status Update", false);
    }
    catch (Exception)
    {
        EventLog.WriteEntry("Russia OCR Submission Processor", "Could not log status update event: " + exc.ToString(), EventLogEntryType.Information);
    }
}

For a period of a few minutes, the _logger stopped logging messages and instead I received these messages in the event log:

Could not log status update event: System.NullReferenceException: Object reference not set to an instance of an object.
at ScannedService.scanDocProcessor_StatusUpdate(String message, Exception exc, SeverityLevel severity)
at ScannedService.Processor.FireStatusUpdate(String message)
at ScannedService.Processor.ProcessQueue(Object Object)

I’m confused how the Event log could get such a stack trace when it should be writing exc.ToString(). I looked at the IL for the scanDocProcessor_StatusUpdate method is not initializing an Exception object. Beyond that I don’t know how a nullreferenceexception is getting thrown. When the Log method does catch an exception it swallows it or re-throws it with “throw;”. The message parameter is never null and SeverityLevel is an enumeration.

  • 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-21T07:22:04+00:00Added an answer on May 21, 2026 at 7:22 am

    You are throwing an exception in one of the else conditions where ecx is null. In the catch block, you are assuming that ecx is not null, which generates another exception that hides your original one.

    You can make your log statement null-safe with the following:

    EventLog.WriteEntry("Russia OCR Submission Processor", 
        String.Format("Could not log status update event: {0}", exc), EventLogEntryType.Information);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I encountered a strange problem this week that I can't explain: I switched my
I have encountered a strange problem where if I call getString(R.string.somestringname) , from time
I encountered a strange problem today. Whenever i put a breakpoint in one of
We have encountered a very strange class not found problem in our web app
I've encountered a strange problem in a Grails webapp running under Grails: java.io.UnsupportedEncodingException is
I recently encountered a strange problem on my website. Images with æ ø and
I've encountered with some strange problem. It's strange for me because I don't understand
I've just encountered a rather strange problem. A Winforms (although that may not be
I'm new to Drupal and am experiencing this strange problem with my testing Drupal
This question will seem obvious to those who haven't encountered the problem themselves. I

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.