LINQ to SQL DBML fails to build or open
Arrgh. Today I got back to a LINQ to SQL app that’s been sitting idle for some time. It’s a demo app and as I started the app up and compiled the solution I got:
Error 1 Build failed due to validation errors in C:\projects2008\TimeTrakker\TimeTrakkerBusiness\model\TimeTrakker.dbml. Open the file and resolve the issues in the Error List, then try rebuilding the project. C:\projects2008\TimeTrakker\TimeTrakkerBusiness\model\TimeTrakker.dbml
Well, I opened the file and looked at the error list – according to the error list it’s a parsing error at a / with no line number and not even a filename. Swell.
I remember odd parser behavior when upgrading between the beta version and the final release. I think the change at the time was an encoding change from UTF-16 to UTF-8 or something along those lines that caused the document not to be readable. But it turns out that wasn’t the problem. I checked encoding saved the file and validated the XML – no problem there.
I then opened another project with another Linq to SQL model and it too fails with the same error.
So this is a more serious issue. At this point I turned to Google to search and sure enough this has been found on a few occasions (like this post from Michael James).
As Michael points out the fix is to reset the Visual Studio Packages. Apparently at one of the many times that VS starts and complains about a package load failure – you know those failures where you usually have no idea what you’re consenting to exactly :-} - I must have unknowingly unloaded the DBML parsing package.
The fix is to run devenv /ResetSkipPkgs:
This fires up Visual Studio and reloads all packages that were previously skipped.
What’s really odd about this is that this is a fairly new machine that has been running solidly and so I don’t actually remember any package load errors. I sure hope that this problem doesn’t show up like this out of the box after an install of VS 2008 SP1? Anybody seen this on a ‘clean’ machine?
Thankfully we have the Internet to search for stuff like this and I found Michael’s post in short order. This is also a good reminder – at least to me – that quite a few Visual Studio problems can be solved by the various reset flags available via the devenv command line switches. Just a few days ago I got my toolbox mangled by a bad component install that actually cause VS to crash on startup. I was able to get into VS in Safemode and reset the toolbox that way.
Imagine having to deal with this sort of issue without the resources of shared knowledge. So much time is wasted on crap like this that shouldn’t be happening in the first place, and which reduces the productivity that a powerful IDE like VS provides. I’d really hate to total up the hours I spent tracking down some obscure Visual Studio bug or behavior in a year… I’m sure it totals out to a full week of billable time.
Other Posts you might also like
The Voices of Reason
# re: LINQ to SQL DBML fails to build or open
# re: LINQ to SQL DBML fails to build or open
Aloha,
Kevin
# re: LINQ to SQL DBML fails to build or open
If you've not had a look yet it's well worth it and I pretty much guarantee it will save you time!
(Fanboy alert!! ;) )
# re: LINQ to SQL DBML fails to build or open
Unfortunately for many of the things that I do it's not appropriate because of public domain redistribution issues so I'm stuck with using either what comes in the box or using an OSS.
# re: LINQ to SQL DBML fails to build or open
# re: LINQ to SQL DBML fails to build or open
# re: LINQ to SQL DBML fails to build or open
Thank you for this. You probably saved me 2-4 hours of troubleshooting.
Jason
# re: LINQ to SQL DBML fails to build or open
# re: LINQ to SQL DBML fails to build or open
I really want to use Blend but at every stage of its evolution I find that it is almost impossible due to some problem. I don't have time to learn how to code in a Blend-approved way.
Thanks for the tip!
# re: LINQ to SQL DBML fails to build or open
if your dbml is in its own assembly used by a project in a solution with an installer, devenv /ResetSkipPkgs isn't good enough.
You will also have to execute 'Build' (not rebuild) from the innermost assembly with the dbml, and then do Build on other assemblies, then Build again on your installer projects.
# re: LINQ to SQL DBML fails to build or open
Thank you Dan. Sorted my issue
# re: LINQ to SQL DBML fails to build or open
# re: LINQ to SQL DBML fails to build or open
I've read tens of other options, but this is the only thing that works.
# re: LINQ to SQL DBML fails to build or open
I had not gotten any package load errors, so I just restarted all instances of VS. I had recently restarted my computer, and I've no clue what went wrong.
Also, Julie Lerman reported this problem when the coding was inadventently set to utf-16.
# re: LINQ to SQL DBML fails to build or open
# re: LINQ to SQL DBML fails to build or open
I see we get this issue when we have installed VS 2010 and VS 2008 side by side.
# re: LINQ to SQL DBML fails to build or open
Look forward to hearing your talks in Vegas this November. I live on Oahu and met you briefly last year at the last Dev Connections.
BTW, you need to see Styx in concert tonight in Maui, I saw them yesterday on Oahu, they kicked butt!
Aloha,
Kevin