Closed szienciklf closed 11 months ago
A lot of people ran into this. This was fixed in visual studio 17.6.4. You need to update visual studio. See Reverse POCO issue #804 and here is the Microsoft notification https://developercommunity.visualstudio.com/t/TextTransformationGenerationEnvironment/10369514
Cannot update my db from the tt file. Getting the following error. I have been successfully using the same project for 6+ months. Have not changed anything. Just added a new table to the project and got the following when I updated the tt file. I have tried unistalling and reinstalling the extension. I also have tried restarting VS and the machine, running in admin mode. I am running windows 11, the machine.config has system.data.sqlclient installed. The VS project is using the .NET 4.8 Framework.
I am under a tight project deadline.
Please advise.
Here are the basic TT settings. I removed the connection string.
// For help on the various Types below, please read https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/wiki/Common-Settings.*Types-explained // The following entries are the only required settings. Settings.DatabaseType = DatabaseType.SqlServer; // SqlServer, SqlCe, PostgreSQL. Coming next: MySql, Oracle Settings.TemplateType = TemplateType.Ef6; // EfCore7, EfCore6, EfCore5, EfCore3, EfCore2, Ef6, FileBasedCore2-7. FileBased specify folder using Settings.TemplateFolder Settings.GeneratorType = GeneratorType.Ef6; // EfCore, Ef6, Custom. Custom edit GeneratorCustom class to provide your own implementation
I get the following error in VS error list:
Error Running transformation: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.VisualStudioFileManager.Process(Boolean split) in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude:line 1897 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.FileManagementService.Process(Boolean split) in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude:line 1798 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.TransformText() in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\DCXToolsDb.tt:line 717 Littelfuse.BlockDiagrams.Business C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude 1897
I also get the following added to my XXX.Db.cs file
// ------------------------------------------------------------------------------------------------ // WARNING: Failed to load provider "System.Data.SqlClient" - Object reference not set to an instance of an object. // Allowed providers: // "System.Data.Odbc" // "System.Data.OleDb" // "System.Data.OracleClient" // "System.Data.SqlClient" // "Microsoft.SqlServerCe.Client.4.0" // "Microsoft.Data.SqlClient"
/ at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.DynamicTextTransformation.get_GenerationEnvironment() in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude:line 1928 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.EntityFrameworkTemplateFileManager..ctor(Object textTransformation) in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude:line 1665 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager..ctor(Object textTemplating) in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude:line 1784 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.Create(Object textTransformation) in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude:line 1629 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.VisualStudioFileManager.Init(GeneratedTextTransformation textTransformation) in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude:line 1877 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.FileManagementService.Init(Dictionary`2 filters, Type fileManagerType) in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude:line 1727 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.Generator.Init(DatabaseReader databaseReader, String singleDbContextSubNamespace) in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude:line 4172 at Microsoft.VisualStudio.TextTemplatingB1F8828390E131E68B779BF45AC6EE5BFC51F180D0206C9C4D4115C7236554626A0929F5E659DB6347FBD5399FA5C44FA9DE81361ABD9658E8985DBE54FAD922.GeneratedTextTransformation.GeneratorFactory.Create(FileManagementService fileManagementService, Type fileManagerType, String singleDbContextSubNamespace) in C:\Downloads\Code\Littelfuse.DCXUtils\Littelfuse.DCXUtils\Littelfuse.BlockDiagrams.Business\DAL\Models\EF.Reverse.POCO.v3.ttinclude:line 6351/ // ------------------------------------------------------------------------------------------------