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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:56:44+00:00 2026-05-27T00:56:44+00:00

An unhandled exception of type ‘System.ArgumentException’ occurred in System.Drawing.dll Additional information: Parameter is not

  • 0

An unhandled exception of type ‘System.ArgumentException’ occurred in System.Drawing.dll

Additional information: Parameter is not valid.

This is happening at the end of this code.

public void WriteStatusMessage(string message)
{
    m_ToolStripStatusLabelUserMessage.BackColor = WriteDefaultBackColor;
    m_ToolStripStatusLabelUserMessage.ForeColor = WriteDefaultForeColor;
    m_ToolStripStatusLabelUserMessage.Text = CommonConstants.Space + message;
    Update();
}

If I add a breakpoint in the code, it gets by that error, but happens on a later update. As far as I know, the only graphics code we’re doing involves drawing graphs (which would be consistent with how I’m getting this error by trying to open a file of historic watch variable values which then display as graphs), and only employing Brushes, Pens, and Fonts (part of my recent changes was going through and adding "using" to ensure they got disposed of because we were getting memory leaks).

Mainly, I’m hoping someone can point me in the right direction to start decoding this. Much to my dismay, it’s one of those cases where a large number of changes were made and checked in and I could swear I’d checked it before checking in, particularly as this action relates to the problem I was solving, but it’s hard to argue with facts and the fact is that it’s failing right now.

Thank you for any help you can give.

Edit: I have managed to revert to an earlier version on one of my check-ins, so I’ve got a general idea as to where to look for problems. It is indeed one of the graphics libraries, specifically the one that plots out the graphs which is a modification of the library at http://www.codeproject.com/KB/miscctrl/GraphComponents.aspx. As per the advice below, I’ll start by looking at the Paint procedures I modified.

Further Edit: I found it. OnPaint, much as predicted:

protected override void OnPaint(PaintEventArgs e)
{
    if (!Visible)
        return;

    Graphics graphics = e.Graphics;
    Draw(graphics);
        
    base.OnPaint(e);
}

was turned into

protected override void OnPaint(PaintEventArgs e)
{
    if (!Visible)
        return;

    using (Graphics graphics = e.Graphics)
    {
        Draw(graphics);
    }       
    base.OnPaint(e);
}

when I was aggressively removing references to Drawing objects that didn’t have a Dispose. Reverting that function removed the crashes. Unfortunately, it looks like I’m back to tracking down the memory leak I was searching for when I made these changes…

  • 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-27T00:56:45+00:00Added an answer on May 27, 2026 at 12:56 am

    Use Break on exceptions in Visual Studio.
    Menu: Debug->Exceptions and click in “thrown” on the exception you wish to find.

    Oh and dont forget to debugcompile and run with debugger 😉

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

Sidebar

Related Questions

An unhandled exception of type 'System.TypeInitializationException' occurred in Microsoft.VisualStudio.HostingProcess.Utilities.dll Additional information: The type initializer
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll Make sure you do not
I am getting this error: An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Uri test = new Uri(http%3A%2F%2F100.100.1.1%3A8080); An unhandled exception of type 'System.UriFormatException' occurred in System.dll
An unhandled exception of type 'System.StackOverflowException' occurred in wcfserviceLibrary.DLL the code is show as
I am getting An unhandled exception of type 'System.StackOverflowException' occurred in System.Data.dll in my
My program stops working with this warning An unhandled exception of type 'System.NullReferenceException' occurred
System.TypeInitializationException was unhandled Message=The type initializer for 'SmartHomeworkOrganizer.ViewModels.MainViewModel' threw an exception. Source=SmartHomeworkOrganizer TypeName=SmartHomeworkOrganizer.ViewModels.MainViewModel StackTrace:
Exception: ProcessModel: Default DomainUsage: Single Execution Runtime: net-4.0 Unhandled Exception: System.ArgumentException: The net-4.0 framework
I get the following error: Unhandled Exception: System.IO.IOException: The parameter is incorrect. at System.IO.__Error.WinIOError(Int32

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.