System.MissingMethodException: 'Constructor on type '' not found.' Issue

Matthew Lyons 1 Reputation point
2022-01-01T01:25:35.957+00:00

Good afternoon everyone and happy new year!

I run into this issue periodically, and in the past have had to restart my project, but this is becoming unmanageable. I think this is a bug in Visual Studio, but does anyone know of a solution?

I have a constructor in the same form, but get an error that it doesn't exist. Yet, it does, and frustratingly, it works in other parts of the same form!

So, for example, I have code that is populating 3 grids. All relying on the same constructor:

private class BugGridImageEditControl : GridImageEditControl
{
public BugGridImageEditControl(
ImageList imageList, ImageSizeMode sizeMode)
{
ImageList = imageList;
ImageSizeMode = sizeMode;
}
}

Two of the grids work properly, the third did until yesterday. Without making any changes to this code, Visual Studio arbitrarily decided that for the third grid it now can't find the constructor that is literally right there...

And Visual Studio sees it there in the designer / code view... Only at compile time / runtime does it not... But only for one of the grids...

System.MissingMethodException: 'Constructor on type 'Shuttle2.FMainRibbon+BugGridImageEditControl' not found.'

I've tried cleaning the project. I've tried removing the bid and obj folders and recompiling. I've tried deleting and replacing the constructor. I've tried creating a new constructor with a new name. Once Visual Studio decides it can't see it, nothing I can do seems to be able to show that it's there...

I'm using Visual Studio 2022 now, but I've experienced this bug in Visual Studio 2019 and 2017 too...

I appreciate any help with this. It's unreasonable to have to redo a project every time Visual Studio gets forgetful...

Thanks Again!

Developer technologies | C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.