Thursday, 12 November 2009

VS2010 Beta 2 – Validation ($SCHEMA$): Element is not supported

Note: Updated advice is now available over in this post explaining how to get around this problem without resetting your configuration.

If you have adopted beta 2 of Visual Studio 2010 then you might have spotted a large amount of green squigglies underneath the tags in your markup. When you have over them you see a message like this:

validation-schema-not-supported

Validation ($SCHEMA$): Element 'div' is not supported

This appears to be a bug in the system. When this is occurring your autocomplete will not have any html element – only asp.net controls and snippets – which makes it pretty hard to do your work.

Unfortunately this is one of the aspects of using beta software. There is a fix but it can be annoying if you customize your environment a lot.

To get rid of the errors temporarily (it seems to come back every time I load VS2010) you have to reset the configuration to factory defaults by doing the following:

1. In Visual Studio 2010 Beta 2 click Tools | Import and Export Settings...

2. You will see a dialog appear with three options, choose Reset all settings and click Next.
validation-schema-reset-all-settings

3. The following window gives you the chance to back up your settings – its your call but personally I don’t bother. Make a choice and click next.
validation-schema-backup-settings

4. The final window lets you decide the default collection of settings you want to apply. This is the choice you are presented with the first time you run visual studio and it includes the new code-focused web development profile which has been added to vs2010. Make a selection and click Finish.
validation-schema-settings-collection

5. Visual studio will now apply the settings you have made and present you with a final results screen. Click the close button to return to your IDE.

6. After a short pause the system will refresh itself and all of the green squigglies will be gone.

For me this error seems to keep coming back - I haven't spotted if this is occurring every time I boot or if it is occurring randomly but if this is happening to you then now you have the solution!

kick it Shout it vote it on WebDevVote.com

10 comments:

brad said...

Or for a less "nuke and pave" approach:

On the Tools menu, click Options.

In the Options dialog box, expand the Text Editor node and the HTML node, and then click Validation.

From the Target list, select the schema that you want to use for validation and then click OK.

Christia said...

same over here. it suddendly started annoying me.. Thanks for the hint!

Cheers, Christian

Anonymous said...

I believe the cause of this issue is due to the HTML validation not beeing automatically set.


To fix this, first open the options dialog of VS2010: Tools > Options...

Within the options dialog, navigate to: Text Editor > HTML > Validation

This is where I found the drop down list labeled 'Target' unset. If you select the html-schema (I use XHTML 1.1) you need and press OK, this issue should no longer come back.

I found my solution a lot better then resetting to factory settings each time ;).

Regards,

Thijs te Paske

Anonymous said...

thanks bro the problam solved nice from

Anonymous said...

Great work. Thanks. How did you manage to find that?

Anonymous said...

Very nice I like found quick and simple solution thanks everyone.

Anonymous said...

And how about .ascx files?

It seems that VS2010 thinks they're .aspx pages and insists on having <asp:Content ...> before any HTML / ASP controls if I have the following line in web.config

<pages masterPageFile="~/App_Master/Default.master">

Seems it's assuming that the Maste page should be used even for .ascx controls - this used to work in VS2008 just fine so Microsoft must have broken it.

If I also add pageBaseType="CustomPage" to it, it complains that it can't load CustomPage so every @Page directive is shown with a blue squigglie and that further breaks other validation and IntelliSense.

This is extremely annoying and I can't find a solution (my Validation is already set to XHTML 1.1 and I've tried other values too - nothing works)

Even with the proper validation, my pages complain about some tags, such as <link>, <style>, <center>, <h1>, <asp:UpdateProgress> and any other <asp: controls, but not about <asp:UpdatePanel or <table> inside of it - go figure.

I'm yet to find a way to disable the annoying "Getting ... file from the server" that's happening in the "background" and keeps on showing my cursor as busy ... same files are being reloaded from the server every few seconds, over and over again and checked even more frequently - at times I can't work as VS is busy and locked up!
This started in VS2008 - when I open ANY XML file and click in it, VS2008 goes into a fetch mode of some sort and insists on loading ALL XML files from the server, including SQL schemas, some files are loaded multiple times over and over again and on a large site with many XML files this can take 15-30 MINUTES !!!! Seriously, fortunately it only happens once, when I open and attempt to edit the first XML file in a session - so I keep VS open for days at a time as I can't waste 1/2 hour each time I open it.

Has anyone figured this out? What's causing this background activity (I know it may be a way to keep some files in sync so validation and intelli sense works, but why do it over and over again if I know the files haven't changed on the server as I'm the only one updating them?)

Anonymous said...

Thanks to Brad and Paske. Worked like a charm!

Anonymous said...

Have filed a Connect bug report for the ascx/masterPageFile issue, since I couldn't find one already listed. See https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=527742.

Anonymous said...

I saw you had a better solution. better link it from here:)

http://runtingsproper.blogspot.com/2009/11/update-vs2010-beta-2-validation-schema.html