Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

Commented Unassigned: IndexOutOfRangeException thrown inside GetCurrentProject [85]

$
0
0
1. Load a solution with the .tt file previously open in a project in Visual Studio
2. Save the .tt file
3. An error appears in the Visual Studio error list:

> Error 1 Running transformation: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
at System.Array.GetValue(Int32 index)
at Microsoft.VisualStudio.TextTemplating1F0C652DA016339F850EBF44D6BFA48C2842D868FAFFFEC1AD8A09A6227AB2231623BFF7B5E44CC74234FA005B8E111A714A96A462A39393BFCA8879FFF6A021.GeneratedTextTransformation.GetCurrentProject()
at Microsoft.VisualStudio.TextTemplating1F0C652DA016339F850EBF44D6BFA48C2842D868FAFFFEC1AD8A09A6227AB2231623BFF7B5E44CC74234FA005B8E111A714A96A462A39393BFCA8879FFF6A021.GeneratedTextTransformation.GetConfigPaths()
at Microsoft.VisualStudio.TextTemplating1F0C652DA016339F850EBF44D6BFA48C2842D868FAFFFEC1AD8A09A6227AB2231623BFF7B5E44CC74234FA005B8E111A714A96A462A39393BFCA8879FFF6A021.GeneratedTextTransformation.GetConnectionString(String& connectionStringName, String& providerName, String& configFilePath)
at Microsoft.VisualStudio.TextTemplating1F0C652DA016339F850EBF44D6BFA48C2842D868FAFFFEC1AD8A09A6227AB2231623BFF7B5E44CC74234FA005B8E111A714A96A462A39393BFCA8879FFF6A021.GeneratedTextTransformation.InitConnectionString()
at Microsoft.VisualStudio.TextTemplating1F0C652DA016339F850EBF44D6BFA48C2842D868FAFFFEC1AD8A09A6227AB2231623BFF7B5E44CC74234FA005B8E111A714A96A462A39393BFCA8879FFF6A021.GeneratedTextTransformation.LoadTables()
at Microsoft.VisualStudio.TextTemplating1F0C652DA016339F850EBF44D6BFA48C2842D868FAFFFEC1AD8A09A6227AB2231623BFF7B5E44CC74234FA005B8E111A714A96A462A39393BFCA8879FFF6A021.GeneratedTextTransformation.TransformText() C:\Dev\Sandbox\EfTest\EfTest\Testing.tt 1 1


This appears to be caused by the dte.ActiveSolutionProjects array being empty. The workaround is to click on the project in Solution Explorer - then the array seems to get populated.

A better fix would be to replace the code in GetCurrentProject with logic similar to Thomas Levesque's answer in https://social.msdn.microsoft.com/Forums/vstudio/en-US/9816f4b5-cb16-457d-9e99-787ad6cb34cf/vs2010-t4-any-way-to-obtain-name-of-the-current-project?forum=vsx. I've tested this locally and it seems to do the trick.
Comments: This has been implemented, and will be in the next release. Thanks!

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>