This is a migrated thread and some comments may be shown as answers.

MetaModelGenerator error

8 Answers 219 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
DSamani
Top achievements
Rank 1
DSamani asked on 21 May 2010, 01:38 PM
I am trying to reverse map a legacy SQL database with around 700 tables by creating a OA Domain Model  (I think this code needs to be looked at for performance on large DB schemas).  After several attempts I was finally able to get the .rlinq file created.

However, the code generation will not work for some reason.  When I right click on the OA Domain model and choose 'Run Custom Tool' I get the following error...

The custom tool 'MetaModelCodeGenerator' failed. Specified cast is not valid.

Any ideas what might be causing this?

Thanks,
Byron

8 Answers, 1 is accepted

Sort by
0
Dimitar Kapitanov
Telerik team
answered on 25 May 2010, 11:45 AM
Hi Byron Blattel,
On some machines the customers experience such a strange behavior, we are still not able to reproduce the exact behavior. My advice to you is that you upgrade to the next version when it is available (I hope tomorrow). We solved really a lot of issues plus we will introduce VS2010 support and I think your problems will not be available in the newer version.

All the best,
Dimitar Kapitanov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Mark Dawson
Top achievements
Rank 1
answered on 01 Jul 2010, 06:30 PM
HI,

Im just wondering if there has been any update on this problem.  I've installed the very latest ORM (2010.1.623.5) and created a Model but hit the "Specified cast is not valid" error.

I've even tried deleting everything from the model and running the custom tool (from the menu), but get the same result.

Interestingly, the project is part of a solution with several other projects. If I open JUST the project in question then it works fine. As part of the solution it wont work, even if I remove all other projects from the solution.

The full error on running the Custom Tool is shown below:

Error 13 Running transformation: System.InvalidCastException: Specified cast is not valid.

Server stack trace:
   at System.StubHelpers.InterfaceMarshaler.ConvertToNative(Object objSrc, IntPtr itfMT, IntPtr classMT, Int32 flags)
   at EnvDTE.ProjectItem.get_Object()
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProjectInternal(ProjectItems items, Predicate`1 match)
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProjectInternal(ProjectItems items, Predicate`1 match)
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProject(_DTE vs, Predicate`1 match)
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProjectByName(_DTE vs, String name)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.ResolveProjectContext(ProjectItem templateProjectItem)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.ProjectSynchronization(ProjectItem templateProjectItem, IEnumerable`1 keepFileNames)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.<.ctor>b__2(IEnumerable`1 keepFileNames)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at System.Action`1.EndInvoke(IAsyncResult result)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.Process(Boolean split, String outputPath)
   at Microsoft.VisualStudio.TextTemplating9B7F2E5191EE1990E2F147F8F2558603.GeneratedTextTransformation.TransformText() in d:\Development\Night Noise\Affiliates\FrontEnd\Affliates.Core\AffiliatesDiagram.rlinq:line 75
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)  1 1 



Thanks,
Mark.
0
Mark Dawson
Top achievements
Rank 1
answered on 02 Jul 2010, 10:55 AM
Update: I spoke too soon about opening the project without the rest of the solution. That's now not working either.

As this seems to be related to the template compiler finding the project so it can add the generated code files, I noticed the following:

1) The code is been generated without any problems.
2) On the diagram, clicking Model Settings, then  Code Generation > Output, selecting Project Folder and clicking Browse results in a pop up box containing my solution name, but none of the projects are listed.
3) Using File Folder or Nested Namespace still results in the error when the tool is run.

I am using Solution Folders within my solution, but removing them doesn't make a difference.
0
Dimitar Kapitanov
Telerik team
answered on 06 Jul 2010, 09:04 AM
Hi Mark Dawson,
Can you send us a sample (stripped-out) version of the solution in question? Or a new sample solution that verifies the behavior. We would like to see what is going on as the described behavior should not occur and was never before observed.

Greetings,
Dimitar Kapitanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark Dawson
Top achievements
Rank 1
answered on 20 Jul 2010, 11:44 AM
Hi,

Sorry I've not been able to get the sample solution to you - I had a deadline to meet which meant I had to just work around the problem by manually adding the generated source files to my solution and then ignoring the Invalid Cast Exception generated by the custom tool - it didn't stop the build of the solution.

I've since upgraded to the Q2 release of OpenAccess and recreated my project from scratch and that has taken care of the errors.

I suspect the problem might have been caused by conflicts between versions. I originally copied the project from another project (lots of common source), stripped out the things I didn't need and then started building up the new project.  The old project used the 2009.Q3 version of OpenAccess and I think there might have been something left behind from the old version when I upgraded the project to use the 2010.Q1 version.  I'm guessing something gets left in the .csproj file that causes a conflict.


On upgrading this project to 2010.Q2, I started receiving a circular base class reference and will open a support ticket with a copy of the project for you to look at.

Regards,
Mark.
0
Dimitar Kapitanov
Telerik team
answered on 20 Jul 2010, 01:52 PM
Hello Mark Dawson,
Maybe this was the problem in the first place? Such a circular reference means, the class hierarchy you developed is somewhat wrong from VIsual Designers perspective? I will continue answering that in your support thread.

Best wishes,
Dimitar Kapitanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Franck
Top achievements
Rank 1
answered on 04 Aug 2010, 01:39 PM
Hi,

I have the same issue with my testing project. I may provide you the source code if you want.

My solution has two project :
  - a library containing OpenAccess schema and generated classes
  - a visual studio database project for Sql Server 2008, containing the database structure and stored procedures defintions

When I tried to generate the classes from the OpenAccess schema, I've got the following error :
Error   5   Running transformation: System.InvalidCastException: Specified cast is not valid.
  
Server stack trace: 
   at System.StubHelpers.InterfaceMarshaler.ConvertToNative(Object objSrc, IntPtr itfMT, IntPtr classMT, Int32 flags)
   at EnvDTE.ProjectItem.get_Object()
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProjectInternal(ProjectItems items, Predicate`1 match)
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProject(_DTE vs, Predicate`1 match)
   at Telerik.OpenAccess.CodeGeneration.DteHelper2.FindProjectByName(_DTE vs, String name)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.ResolveProjectContext(ProjectItem templateProjectItem)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.ProjectSynchronization(ProjectItem templateProjectItem, IEnumerable`1 keepFileNames)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.<.ctor>b__2(IEnumerable`1 keepFileNames)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
  
Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at System.Action`1.EndInvoke(IAsyncResult result)
   at Telerik.OpenAccess.CodeGeneration.ServiceProviderTemplateContext.Process(Boolean split, String outputPath)
   at Microsoft.VisualStudio.TextTemplating491150620230F85AF0C0FDB03605E3DF.GeneratedTextTransformation.TransformText() in d:\Projects RD\MesComptesPerso\AccountingModuleDal\AccountingDomainModel.rlinq:line 75
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)        1   1

If the database project is removed from the solution, the entities are generated without error.

For your information, I used Visual Studio 2010 Ultimate Edition. All IDE environment data are provided below :
Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
Microsoft .NET Framework
Version 4.0.30319 RTMRel
  
Installed Version: Ultimate
  
Microsoft Office Developer Tools   01019-532-2002102-70606
Microsoft Office Developer Tools
  
Microsoft Visual C# 2010   01019-532-2002102-70606
Microsoft Visual C# 2010
  
Microsoft Visual Studio 2010 Architecture and Modeling Tools   01019-532-2002102-70606
Microsoft Visual Studio 2010 Architecture and Modeling Tools
      
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.
  
Microsoft Visual Studio 2010 Code Analysis Spell Checker   01019-532-2002102-70606
Microsoft Visual Studio 2010 Code Analysis Spell Checker
  
Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.
  
The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.
  
Microsoft Visual Studio 2010 Team Explorer   01019-532-2002102-70606
Microsoft Visual Studio 2010 Team Explorer
  
Microsoft Visual Web Developer 2010   01019-532-2002102-70606
Microsoft Visual Web Developer 2010
  
Crystal Reports Templates for Microsoft Visual Studio 2010   
Crystal Reports Templates for Microsoft Visual Studio 2010
  
Microsoft Moles   1.0.0.0
Moles generator for Visual Studio
  
Microsoft Pex   0.92.50603.1
Microsoft Pex Visual Studio Extensions
  
Microsoft Team Foundation Server 2010 Power Tools   3.0.30423.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.
  
Microsoft Visual Studio 2010 SharePoint Developer Tools   10.0.30319
Microsoft Visual Studio 2010 SharePoint Developer Tools
  
Microsoft Visual Studio Process Editor   1.0
Process Editor for Microsoft Visual Studio Team Foundation Server
  
Team Foundation Sidekicks   3.0
Team Foundation Sidekicks utilities
  
Telerik OpenAccess ORM   2010.2.714.1
Telerik OpenAccess ORM Copyright (C) 1996-2010 Telerik; OpenAccess is the Object-Relational Mapping Tool for the Microsoft .NET Platform. www.telerik.com
  
Windows Azure Tools   Version 1.2
Windows Azure Tools for Microsoft Visual Studio 2010 v1.2.30517.1601 (5/2010)
  
Work Item Visualizer for TFS 2010   1.0
Creates a work item search box in a Visual Studio toolbar that allows the user to enter in a work item ID and visualize all work items linked to that ID in a DGML document.
  
.NET Reflector
Visual Studio add-in that integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.
Visit www.red-gate.com for more information.
Copyright (c) 2009-2010 Red Gate Software Inc.

I am currently testing OpenAccess and without solving this issue, we won't be able to migrate to OpenAccess. So if I can help you, do not hesitate to contact me back. I'll be happy to help.

Kind regards,

Franck
0
Petko_I
Telerik team
answered on 09 Aug 2010, 03:45 PM
Hello Franck,

We have observed this issue with the 2010.2.714.1 version of OpenAccess. Is it possible that you are working with this or previous versions of the product? If that is the case, please download our latest internal build (version 2010.2.804.5), upgrade your references and rebuild your project. The problem should be gone as we fixed the issue in question for that build.

Do not hesitate to contact us for any further assistance if necessary.

Sincerely yours,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Getting Started
Asked by
DSamani
Top achievements
Rank 1
Answers by
Dimitar Kapitanov
Telerik team
Mark Dawson
Top achievements
Rank 1
Franck
Top achievements
Rank 1
Petko_I
Telerik team
Share this question
or