Joe
Joe

Reputation: 7004

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

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?

Upvotes: 6

Views: 7654

Answers (2)

Maks V. Zaikin
Maks V. Zaikin

Reputation: 87

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

I'm using VS v. 15.5.7

Upvotes: 1

Mike Loux
Mike Loux

Reputation: 706

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.

Upvotes: 2

Related Questions