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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:09:51+00:00 2026-06-11T00:09:51+00:00

I wrote a class in C++/CLI which inherits from System.Windows.Forms.UserControl . It works fine,

  • 0

I wrote a class in C++/CLI which inherits from System.Windows.Forms.UserControl. It works fine, but whenever I try to view some form which contains this control in designer view, it crashes with this error:

Designer error

If I click on “Go to the Code”, I get sent to MainForm.Designer.cs, at the line where mConsole, the instance of my control, is added to the form. I am told it’s not declared, but that is done a few lines below. BeginInit is the first function called after new’ing mConsole, so Init was called before setting all properties. Everything looks right on this end.

The control’s dll is built with the /clr switch, and the Windows Forms project which uses it has the reference set. It builds and runs perfectly every time. The only problem is the design view. Every time I need to add some component, I have to edit the designer file manually, which is a real hassle.

Here’s some of my control’s code:

//Console.h
namespace MConsole {
public ref class MCConsole :    public System::Windows::Forms::UserControl,
                                public System::ComponentModel::ISupportInitialize {
public:
    MCConsole();
    virtual ~MCConsole();
    !MCConsole();
    //Skipping custom properties and methods...
    virtual void BeginInit();
    virtual void EndInit();
protected:
    virtual void OnPaint( System::Windows::Forms::PaintEventArgs ^ pe ) override;
};

//Console.cpp
#include "Console.h"

void MCConsole::Init(){
    if( m_bInitialized )
        return;
    // Initialize native instance
    m_pNativeInstance->Init( (HWND)this->Handle.ToPointer() );
    m_bInitialized = true;
    // Initialize timer
    m_TimerTickHandler = gcnew System::EventHandler( this, &MCConsole::Render );
    m_Timer.Tick += m_TimerTickHandler;
    m_Timer.Interval = Math::Round<float, int>(1000.0f/FRAMES_PER_SECOND);
    m_Timer.Start();
    // Initialize event handlers
    m_MouseWheelHandler = gcnew System::Windows::Forms::MouseEventHandler( this, &MCConsole::MouseWheelHandlerZoom );
    this->MouseWheel += m_MouseWheelHandler;
    m_ResizeHandler = gcnew System::EventHandler( this, &MCConsole::Resize );
    this->SizeChanged += m_ResizeHandler;
    m_MouseDownHandler = gcnew System::Windows::Forms::MouseEventHandler( this, &MCConsole::MouseDownHandler );
    this->MouseDown += m_MouseDownHandler;
    m_MouseLeaveHandler = gcnew System::EventHandler( this, &MCConsole::MouseLeaveHandler );
    this->MouseLeave += m_MouseLeaveHandler;
    m_MouseMoveHandler = gcnew System::Windows::Forms::MouseEventHandler( this, &MCConsole::MouseMoveHandler );
    this->MouseMove += m_MouseMoveHandler;
    m_MouseUpHandler = gcnew System::Windows::Forms::MouseEventHandler( this, &MCConsole::MouseUpHandler );
    this->MouseUp += m_MouseUpHandler;
    m_KeyPressHandler = gcnew System::Windows::Forms::KeyPressEventHandler( this, &MCConsole::KeyPressHandler );
    this->KeyPress += m_KeyPressHandler;
    m_DropHandler = gcnew System::Windows::Forms::DragEventHandler( this, &MCConsole::DropHandler );
    this->DragDrop += m_DropHandler;
    m_VisibleChangedHandler = gcnew System::EventHandler( this, &MCConsole::VisibleChangedHandler );
    this->VisibleChanged += m_VisibleChangedHandler;
    // Initialize layout wrapper
    m_hRegionLayout = gcnew MCLayout( *m_pNativeInstance->getRegionLayout() );
    m_bInitialized = true;
}

void MCConsole::BeginInit(){
    Init();
}

void MCConsole::EndInit(){}

void MCConsole::OnPaint( System::Windows::Forms::PaintEventArgs ^ pe ) {
    System::Windows::Forms::UserControl::OnPaint( pe );
    if( m_bInitialized )
        m_pNativeInstance->Refresh();
}

What I am missing or messing up? Or how can I debug the Designer crash?

UPDATE: I just tried starting another instance of Visual Studio and attaching to the process of the other VS. I configured the former to break on all kinds of exceptions, and I noticed that when I open the design view, I get ‘System.MissingMethodException’ with Additional information: Attempted to access a missing member. which eventually leads (hitting continue) to the message in the screenshot. If only I knew which method is missing…

  • 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-06-11T00:09:53+00:00Added an answer on June 11, 2026 at 12:09 am

    It is finding an old copy of the DLL. Maybe the toolbox folder has an old copy, remove it from the toolbox and add it back. Maybe the GAC has an old copy, not very likely if it works okay at runtime.

    If you can’t find it then run Fuslogvw.exe from the Visual Studio Command Prompt. Log all bindings so you can see where the CLR retrieved the assembly from.

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

Sidebar

Related Questions

I am newbie. I wrote a class, that implements service and uses gps, but
I wrote a class which working with MYSQL on Tomcat 7.0 server. I connected
I have an unmanaged library which I want to use from a managed class.
I wrote a class MyIntent which extends Intent. and then i use an instance
I wrote the class Link which has a method shortTolong() this should return the
Here is a related manager I wrote: class PortfolioItemManager(models.Manager): use_for_related_fields = True def extended(self):
Okay, so i have this code i wrote: class Connection { public static StreamWriter
I wrote a class that implements the IGroupPolicyObject Interface in COM. one of the
I wrote simple class that on the start it just increase the value of
I wrote this class that draws a animated progress with a circle (it draws

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.