Does it work with Roslyn?

Apr 14, 2014 at 12:26 PM
Did anyone test T4MVC with Roslyn?
My T4MVC.tt is tweaked quite a bit so it might be something on my side, but when I try to transform the template in VS 2013 with Roslyn installed (the official preview, no changes in Roslyn from me), I get an Unspecified exception on line
return codeClass.Members.OfType<CodeFunction2>()
    .Where(f => f.FunctionKind == vsCMFunction.vsCMFunctionFunction);
Is it just me?
Coordinator
Apr 14, 2014 at 9:02 PM
I have never tried. To isolate, could you check whether this also happens with a fresh new MVC project and unmodified t4mvc?
Apr 17, 2014 at 1:10 PM
Sorry I had to uninstall Roslyn and even manually delete the files, because it was causing problems with building the solution even after being disabled.
I do plan to experiment with Roslyn some more when I get some spare time, but I'm busy at the moment.
If in the meantime someone tries a T4MVC with Roslyn I'd like to hear how it goes.

Sorry, Jenda
Apr 22, 2014 at 4:01 PM
Hi David,

I can maybe help with some of this. I've got Roslyn installed and I'm running into issues with updating T4MVC in the same place. The error is as follows:
Error   4   Running transformation: System.NotImplementedException: Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeModelProjectCache.GetOrCreateFileCodeModel(String fileName, Object parent)
   at Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.CSharpProjectShimWithServices.CreateFileCodeModel(String fileName, Object parent, FileCodeModel& ppFileCodeModel)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements.ExternalCodeFunction.get_FunctionKind()
   at EnvDTE80.CodeFunction2.get_FunctionKind()
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ResultTypeInfo.<.ctor>b__5a(CodeFunction2 f) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 1827
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ResultTypeInfo..ctor(CodeTypeRef codeType) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 1826
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessControllerActionMethods(ControllerInfo controllerInfo, CodeClass2 current) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 844
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessControllerType(CodeClass2 type, AreaInfo area, DateTime controllerLastWriteTime) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 726
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessControllersRecursive(ProjectItem projectItem, AreaInfo area) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 658
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessControllersRecursive(ProjectItem projectItem, AreaInfo area) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 643
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessAreaControllers(ProjectItems areaFolderItems, AreaInfo area, ProjectItem areaFolder) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 613
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessArea(ProjectItems areaFolderItems, ProjectItem areaFolder) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 591
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.ProcessAreas(Project project) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 556
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.PrepareDataToRender(TextTransformation tt) in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 537
   at Microsoft.VisualStudio.TextTemplating07D0D4760165F129D614BBB18D2FAC8D8EEC2621276B7FB4994B04BEAF126D48DAE40CE949BD8B9980C5FC24473980900CC7A42CE0E2356630EA75EF83BD33AA.GeneratedTextTransformation.TransformText() in c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt:line 40    c:\Users\Matthew\Source\Repos\Core\LedgerscopeWeb\LedgerscopeWeb\T4MVC.tt   1827    1   LedgerscopeWeb
If I had to guess I'd say it's because T4MVC is trying to use a feature of VS that has been replaced by Roslyn but not yet implemented (or not redirected properly).

Regards,
Matthew
Coordinator
Apr 22, 2014 at 6:07 PM
Yes, that's probably exactly what's happening. Specifically, T4MVC is calling CodeFunction.FunctionKind, and that's blowing up as not implemented. Presumably, it could be isolated to a tiny .tt template that could be given to Roslyn team for investigation.

Any chance you can track that with them on https://roslyn.codeplex.com/discussions? Unfortunately, I'm so swamped that I only have a little bit of time to give to T4MVC, so any help is appreciated! :)
Coordinator
May 4, 2015 at 4:08 AM
Now discussed here.