Search

EntityFramework Bug in VS2012 Update 1 CTP by Roman_Ranzmaier

Active

26
1
Sign in
to vote
Type: Bug
ID: 769934
Opened: 11/2/2012 3:19:07 PM
Access Restriction: Public
3
Workaround(s)
15
User(s) can reproduce this bug
Hi
I updated to VS2012 update1 CTP

And now If i try to Add an Entity Framework Model to a solution I get always the same exception during build.
The bug also happen on an empty model. tested on my Workstation and my notebook

Error    1    An Exception was thrown while processing a directive named 'CleanupBehavior'. The transformation will not be run. The following Exception was thrown:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.VisualStudio.TextTemplating.VSHost.Directives.CleanupBehavior.ProcessDirective(String directiveName, IDictionary`2 arguments)
at Microsoft.VisualStudio.TextTemplating.VSHost.Directives.T4VSHostProcessor.ProcessDirective(String directiveName, IDictionary`2 arguments)
at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, IEnumerable`1 directivesToBeProcessed)    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude    1    4    
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

Open VS2012 Update 1 CTP
Create New Class Library Project. (C#)
Add new Entity Framework (Empty)
Build

Product Language

English

Operating System

Windows 8

Operating System Language

English

Actual results

Error    1    An Exception was thrown while processing a directive named 'CleanupBehavior'. The transformation will not be run. The following Exception was thrown:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.VisualStudio.TextTemplating.VSHost.Directives.CleanupBehavior.ProcessDirective(String directiveName, IDictionary`2 arguments)
at Microsoft.VisualStudio.TextTemplating.VSHost.Directives.T4VSHostProcessor.ProcessDirective(String directiveName, IDictionary`2 arguments)
at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, IEnumerable`1 directivesToBeProcessed)    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude    1    4    

Expected results

Build ok
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 4/8/2013 at 3:20 PM
Hi-

Do you have an isolated repro of this issue?

As well, can you please help us with the following questions:
1. Can you confirm that your machine contains either of the following registry keys?
    a.    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\TextTemplating\DirectiveProcessors\T4VSHost.
    b. HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\
11.0_Config\TextTemplating\DirectiveProcessors\T4VSHost.

2. Can you provide us with the version of the following 2 assemblies:
     a. C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Microsoft.Data.Entity.Design.dll
     b. Microsoft.VisualStudio.TextTemplating.VSHost.11.0.dll in the GAC.

Thanks,
Erica Mohler
Microsoft Program Manager
Posted by Rowan Miller on 3/22/2013 at 10:24 AM
You can find more information on this issue (including workarounds) here - http://romiller.com/2013/03/21/processor-named-t4vshost-could-not-be-found-for-the-directive-named-cleanupbehavior/
Posted by Microsoft on 3/5/2013 at 10:39 AM
Hello, thank you for reporting that you are still seeing this issue in the final release of Update 1. We are re-activating the issue and will investigate. ~EF Team
Posted by TimTx1 on 2/27/2013 at 9:17 AM
Just added the final version of Update 1. EF Code-First was working before, now it is not. So, despite what Microsoft has said here, it is NOT fixed in the final version of Update 1. The workaround however works around the Microsoft bug. Perhaps Microsoft should actually fix this bug, rather than just saying it is fixed.
Posted by tofutim on 2/12/2013 at 11:03 AM
I have this issue in 11.0.51106.01 Update 1
Posted by BentleyD on 1/3/2013 at 7:35 AM
I just downloaded the vs2012 Update 1 (not the CTP) as i was prompted to by the system this morning. I never had the update CTP on my machine. I am having the same issue so it looks like it was not fixed in the final version. Is this bug still opened or do I need to report another one on the final version?
Posted by Microsoft on 12/3/2012 at 4:33 PM
Hello,
Thank you for reporting this issue, it was fixed in the final version of Update 1.
~EF Team
Posted by DrZaius2 on 12/3/2012 at 9:01 AM
same problem and workaround worked.
Thanks
Posted by Brian Swiger on 11/29/2012 at 2:06 PM
Saved me! Thanks a bunch.
Posted by ojorma on 11/29/2012 at 3:37 AM
Same thing here. But the workaround worked. Thanks. You're a project saver
Posted by Microsoft on 11/6/2012 at 11:21 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been reproduced and has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 11/2/2012 at 3:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Rowan Miller on 3/22/2013 at 10:25 AM
There are a number of workarounds listed in this post - http://romiller.com/2013/03/21/processor-named-t4vshost-could-not-be-found-for-the-directive-named-cleanupbehavior/
Posted by Yuan Ze on 11/23/2012 at 5:26 AM
Another 2 workarounds
(1) Not to use database name for the edmx file, e.g. for database Northwind, you can use nwin.emdx instead of Northwind.edmx. This way, <#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #> will not be added.

(2). Open generated *.tt files and remove <#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #> from them.

Posted by Roman_Ranzmaier on 11/4/2012 at 11:52 AM
Hi I found a Solution

Open the File
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude (for C#)
or
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.VB.ttinclude (for VB.net)

And Remove the First Line:
<#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #>

After this Change it was possible for me to create new models.