Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"The type does not include any accessible constructors" - has parameterless constructor

Tags:

c#

wpf

I'm trying to load a class as a static resource:

<UserControl.Resources>
    <myControls:HelpTip x:Key="NavagationHT" Message="Test help tip message for navagation" />
</UserControl.Resources>

And I'm getting the error "The type HelpTip does not include any accessible constructors". However, the class is public, and has a parameterless constructor that should be accessible:

public class HelpTip : PropertyChangedBase
{
    ...

    public HelpTip()
    {
        ID = Guid.NewGuid();
        HelpTipManager.AddHelpTip(this);
    }
}

Does anyone know of anything else that could be causing this error?

Edit: It's resolved now. I'm not sure how or why, maybe there were some problems elsewhere that was causing the code to be looking up an old version where there was no parameterless constructor?

like image 868
Joe Avatar asked May 02 '16 11:05

Joe


2 Answers

As mentioned in my comment on the question, I run into this, as well, on a regular basis. I am using Visual Studio 2015, Update 3.

I just resolved this (for now) by closing the solution, and Visual Studio, then removing the bin and obj folders from the project my XAML file was in, then re-opening VS, the solution and doing a Clean All and Rebuild All (something I generally do anyway, as I've been burned by stale project builds in the past.

Not a great answer, per se, but it allowed me to continue working, so at least it's a viable workaround. Hopefully it'll work for other people as well.

like image 114
Mike Loux Avatar answered Nov 11 '22 11:11

Mike Loux


Restart VS works for me, without cleaning. rebuilding and bin removing.

I'm using VS v. 15.5.7

like image 34
Max Zaikin Avatar answered Nov 11 '22 11:11

Max Zaikin