mganss / HtmlSanitizer

Cleans HTML to avoid XSS attacks
MIT License
1.52k stars 198 forks source link

The class Ganss.Xss.HtmlSanitizer has no constructors defined. #479

Closed nathfn closed 8 months ago

nathfn commented 8 months ago

Hi. I have deliberately avoided updating the NuGet package for quite some time now. Everytime I update the package my build fails with the error message "The class Ganss.Xss.HtmlSanitizer has no constructors defined." I have scanned the documentation and everywhere the usage of this project is straightforward: install the package, create a new instance of HtmlSanitizer and then call Sanitize. What am I doing wrong here? This is with the latest version of the package.

mganss commented 8 months ago

Hmm, strange. I have no idea why this would happen. Have you tried creating a fresh console application to see if it occurs there also?

Which framework are you targeting?

nathfn commented 8 months ago

This is just weird. The project will now build, however the syntax highlighting in Visual Studio continues to complain "Cannot resolve symbol 'Ganss'". It is probably my solution that is broken somehow. Sorry for the inconvenience.

mganss commented 8 months ago

A few things you can try if you haven't already: delete bin and obj folders, rebuild solution.

tiesont commented 8 months ago

This is just weird. The project will now build, however the syntax highlighting in Visual Studio continues to complain "Cannot resolve symbol 'Ganss'". It is probably my solution that is broken somehow. Sorry for the inconvenience.

The namespace did change a while back, so that's likely what you're seeing. Depending on how you're managing your packages and what version of Visual Studio you use (especially if you're using Visual Studio Code or Visual Studio for Mac), it can take a while for Intellisense to catch up. I've also had to delete the hidden .vs folder before, although doing so clears the "state" of your solution (which is what I usually want) so nothing will be open and the "startup" project reverts back to the default.