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 7611317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:38:28+00:00 2026-05-31T01:38:28+00:00

I have a project where in my error reporting I want to send a

  • 0

I have a project where in my error reporting I want to send a complete error report via email. I’m catching the exception and passing all the information to another method that is responsible for sending an email to support.

I’m adding important custom values to the Exception.Data object. However, I’m unable to figure out what type I need to use in my method for the entire Data object to be passed.

Here is my code:

catch (Exception exc)
{
    exc.Data.Add("ID", id);
    emailConnector.sendErrorEmail(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name.ToString() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), exc.Message, exc.Data, exc.StackTrace);
}

I’m passing exc.Data to the sendErrorEmail method so in the parameter declarations I have:

public void sendErrorEmail(string origin, string error_message, IDictionary<object, object> data, string stack)

But I can’t seem to get the type declaration correct for Exception.Data. I prefer to keep the variables and structure the same (no new variables) because I currently have dozens of methods calling sendErrorEmail in the Catch block.

What type should I be using or is there an easier way to get this Exception.Data passed correctly with the extra pertinent information I included in it?

Thanks

  • 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-31T01:38:30+00:00Added an answer on May 31, 2026 at 1:38 am

    Looking at the help page it seems that your problem is that the type of exc.Data is IDictionary whereas you are declaring it as IDictionary<object, object>.

    You should have had an error message telling you the type that it was having trouble converting between…

    Also unless this method is being used for things other than exceptions I would go with the suggestion in comments to pass the whole exception through and disect it afterwards rather than passing through multiple properties.

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

Sidebar

Related Questions

We have multiple vb projects.We want to put error handlers in all functions, and
I have a gwt project that uses gwt-mosaic. Here is the error message I
I have downloaded a web project from CodePlex and am getting the following error
I get this error when trying to link a win32 exe project. I have
I have a project where I would like to generate a report export in
I'm working on a project, and Firebug keeps on reporting a nsLoginManager error (which
I have created free-style software project in Hudson. I want to clone a public
How should I write error reporting modules in PHP? Say, I want to write
I have an Visual Studio 2010 ASP.Net project. And I want to deploy this
I have an old Report Server Project created in Visual Studio 2005. The reports

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.