Answered by:
LINQ to SQL dbml file not generating a DataContext class

Question
-
I know there has to be a simple answer to this, but I can't find it after two hours of googling. I have a asp.net web application in vs2008 Prof (version 9.0.21022.8 RTM) in vb.net.
I have created the dbml file after connecting to my SQL server database through Server Explorer.
I saved the dbml file and built the project. From what I read this was supposed to create a DataContext class that I can use to code with LINQ inside my app. However no class is being created.
When I right click my dbml file and choose 'Run Custom Tool' I get the error "The custom tool 'MSLinqToSQLGenerator' failed. Object reference not set to an instance of an object."
I then looked that up and only found something about changing registry keys which I do not want to do.
Please help. Thanks- Moved by eryang Thursday, September 3, 2009 2:34 AM (From:.NET Base Class Library)
Tuesday, September 1, 2009 10:24 PM
Answers
-
You may also want to take a look at this thread where a couple of potential reasons and workarounds are mentioned:
http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/0c0f77a6-d712-43d2-a990-555df7960123
...and this connect item:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361577
Kristofer - Huagati Systems Co., Ltd. - Cool tools for Linq-to-SQL and Entity Framework: www.huagati.com/dbmltools (VS designer add-in), www.huagati.com/L2SProfiler (query profiler for L2S)- Proposed as answer by Michael Sun [MSFT]Microsoft employee Thursday, September 3, 2009 8:06 AM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Wednesday, September 9, 2009 9:31 AM
Thursday, September 3, 2009 7:57 AMAnswerer -
Hi Gehrigsranch,
Welcome to MSDN Forums!
Is there any tables on the .dbml O/R designer? Please Show All Files in the Solution Explorer, and check whether there are any codes the .dbml's .designer.vb file. By default, the DataContext class name should be "DBMLFileNameDataContext".
If the codes are not generated or generated incorrectly, please refer to the method in this thread to reset the Visual Studio's packages, http://social.msdn.microsoft.com/Forums/en-US/linqprojectgeneral/thread/af45e2b7-98c5-4e12-9bc9-890ae4d03542.Have a nice day!
Best Regards,
Lingzhi Sun
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked as answer by Michael Sun [MSFT]Microsoft employee Wednesday, September 9, 2009 9:31 AM
Thursday, September 3, 2009 7:50 AM
All replies
-
Hi Gehrigsranch,
Welcome to MSDN Forums!
Is there any tables on the .dbml O/R designer? Please Show All Files in the Solution Explorer, and check whether there are any codes the .dbml's .designer.vb file. By default, the DataContext class name should be "DBMLFileNameDataContext".
If the codes are not generated or generated incorrectly, please refer to the method in this thread to reset the Visual Studio's packages, http://social.msdn.microsoft.com/Forums/en-US/linqprojectgeneral/thread/af45e2b7-98c5-4e12-9bc9-890ae4d03542.Have a nice day!
Best Regards,
Lingzhi Sun
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked as answer by Michael Sun [MSFT]Microsoft employee Wednesday, September 9, 2009 9:31 AM
Thursday, September 3, 2009 7:50 AM -
You may also want to take a look at this thread where a couple of potential reasons and workarounds are mentioned:
http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/0c0f77a6-d712-43d2-a990-555df7960123
...and this connect item:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361577
Kristofer - Huagati Systems Co., Ltd. - Cool tools for Linq-to-SQL and Entity Framework: www.huagati.com/dbmltools (VS designer add-in), www.huagati.com/L2SProfiler (query profiler for L2S)- Proposed as answer by Michael Sun [MSFT]Microsoft employee Thursday, September 3, 2009 8:06 AM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Wednesday, September 9, 2009 9:31 AM
Thursday, September 3, 2009 7:57 AMAnswerer