{"action":"closed","issue":{"url":"https://api.github.com/repos/linq2db/t4models/issues/10","labels_url":"https://api.github.com/repos/linq2db/t4models/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/linq2db/t4models/issues/10/comments","events_url":"https://api.github.com/repos/linq2db/t4models/issues/10/events","html_url":"https://github.com/linq2db/t4models/issues/10","id":42707964,"number":10,"title":"NullReferenceException when attempting to use Oracle.Managed.tt to generate my schema","user":{"login":"jshin47","id":1728962,"avatar_url":"https://avatars.githubusercontent.com/u/1728962?v=3","gravatar_id":"","url":"https://api.github.com/users/jshin47","html_url":"https://github.com/jshin47","followers_url":"https://api.github.com/users/jshin47/followers","following_url":"https://api.github.com/users/jshin47/following{/other_user}","gists_url":"https://api.github.com/users/jshin47/gists{/gist_id}","starred_url":"https://api.github.com/users/jshin47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshin47/subscriptions","organizations_url":"https://api.github.com/users/jshin47/orgs","repos_url":"https://api.github.com/users/jshin47/repos","events_url":"https://api.github.com/users/jshin47/events{/privacy}","received_events_url":"https://api.github.com/users/jshin47/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-09-13T23:04:28Z","updated_at":"2015-02-23T01:35:20Z","closed_at":"2015-02-23T01:35:20Z","body":"I am new to LinqToDB and while it seems to work brilliantly for those classes I have manually defined (or generated through my own, crappy code generator) it does not seem to generate the code from the TT as it produces a NullReferenceException. The stack trace is rather long so I have pasted at the end.\r\n\r\nThe exception is generated at LinqToDB.SchemaProvider.SchemaProviderBase.ToValidName(string name) and evidently perhaps it is \"name\" that is null. This is occurring after calling LoadOracleMetadata(string connectionString) and I have verified that I am definitely connecting to the database as when I put in invalid credentials I get a different error. I am unable to step into the \"meat\" of the code generation unfortunately as there are no debug symbols for that part it seems and so I am only left observing that it seems to run for a good 30 to 60 seconds before bombing out. I have reason to think it is doing some work based on that.\r\n\r\nI have tried toying around with the configuration options to no avail. I really want to use your code generator so please help if you can! I've produced my options (which are just the latest iteration... I tried with defaults first) and stack trace below. Thank you in advance!\r\n\r\n```c#\r\n<#@ template language=\"C#\" debug=\"True\" hostSpecific=\"True\"                                #>\r\n<#@ output extension=\".generated.cs\"                                                       #>\r\n<#@ include file=\"$(ProjectDir)LinqToDB\\LinqToDB.Templates\\LinqToDB.Oracle.Managed.Tools.ttinclude\" #>\r\n<#@ include file=\"$(ProjectDir)LinqToDB\\LinqToDB.Templates\\PluralizationService.ttinclude\"          #>\r\n<#\r\n\t/*\r\n\t\t1. Copy this file to a folder where you would like to generate your data model,\r\n\t\t   rename it, and delete .txt extension. For example:\r\n\r\n\t\t\tMyProject\r\n\t\t\t\tDataModels\r\n\t\t\t\t\tMyDatabase.tt\r\n\r\n\t\t2. Modify the connection settings below to connect to your database.\r\n\r\n\t\t3. Add connection string to the web/app.config file:\r\n\r\n\t\t\t<connectionStrings>\r\n\t\t\t\t<add name=\"MyDatabase\" connectionString=\"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyServer)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=MyDatabase)));User Id=MyUser;Password=MyPassword;\" providerName=\"Oracle\" />\r\n\t\t\t</connectionStrings>\r\n\r\n\t\t4. To access your database use the following code:\r\n\r\n\t\t\tusing (var db = new MyDatabaseDB())\r\n\t\t\t{\r\n\t\t\t\tvar q =\r\n\t\t\t\t\tfrom c in db.Customers\r\n\t\t\t\t\tselect c;\r\n\r\n\t\t\t\tforeach (var c in q)\r\n\t\t\t\t\tConsole.WriteLine(c.ContactName);\r\n\t\t\t}\r\n\r\n\t\t5. See more at https://github.com/linq2db/t4models/blob/master/Templates/!ReadMe.LinqToDB.md.\r\n\t*/\r\n\tNamespaceName            = \"DataModels\";       // Namespace of the generated classes.\r\n\r\nDataContextName          = null;               // DataContext class name. If null - database name + \"DB\".\r\nBaseDataContextClass     = null;               // Base DataContext class name. If null - LinqToDB.Data.DataConnection.\r\nGenerateConstructors     = true;               // Enforce generating DataContext constructors.\r\nDefaultConfiguration     = null;               // Defines default configuration for default DataContext constructor.\r\n\r\nBaseEntityClass          = null;               // Base Entity class name. If null - none.\r\nDatabaseName             = \"xxxxx\";               // Table database name - [Table(Database=\"DatabaseName\")].\r\nGenerateDatabaseName     = false;              // Always generate table database name, even though DatabaseName is null.\r\nIncludeDefaultSchema     = false;               // Default schema name is generated - [Table(Database=\"Northwind\", Schema=\"dbo\", Name=\"Customers\")]\r\nOneToManyAssociationType = \"IEnumerable<{0}>\"; // One To Many association type. Change it to \"List<{0}>\" if needed.\r\nGenerateAssociations     = true;               // Enforce generating associations.\r\nGenerateBackReferences   = true;               // Enforce generating backreference associations.\r\n\r\nReplaceSimilarTables     = false;               // Replaces stored procedure result class names with similar to existing table class names.\r\nGenerateFindExtensions   = true;               // Generates find extension methods based on PKs information.\r\nIsCompactColumns         = false;               // If true, column compact view.\r\n\r\nPluralizeClassNames                 = false;   // If true, pluralizes table class names.\r\nSingularizeClassNames               = true;    // If true, singularizes table class names.\r\nPluralizeDataContextPropertyNames   = true;    // If true, pluralizes DataContext property names.\r\nSingularizeDataContextPropertyNames = false;   // If true, singularizes DataContex pProperty names.\r\n\r\nbool GenerateObsoleteAttributeForAliases = false;\r\nIsCompactColumnAliases   = false;               // If true, column alias compact view.\r\n\r\n//GetSchemaOptions.ExcludedSchemas = new[] { \"TestUser\", \"SYSSTAT\" }; // Defines excluded schemas.\r\nGetSchemaOptions.IncludedSchemas = new[] { \"xxxx\" };     // Defines only included schemas.\r\n\r\n//\tLoadOracleMetadata(\"192.168.10.10\", \"1521\", \"DEVC\", \"emeddb\", \"emed1pass\");\r\n\tLoadOracleMetadata(\"USER ID=xxxxxx;PASSWORD=xxxxxxxx;DATA SOURCE=192.168.x.x:1521/xxx;connection lifetime=1200\");\r\n\r\n\tGenerateModel();\r\n#>\r\n```\r\n\r\n```\r\nError\t540\tRunning transformation: System.NullReferenceException: Object reference not set to an instance of an object.\r\n   at LinqToDB.SchemaProvider.SchemaProviderBase.ToValidName(String name)\r\n   at LinqToDB.SchemaProvider.SchemaProviderBase.<GetSchema>b__30(<>f__AnonymousType6`2 <>h__TransparentIdentifier6)\r\n   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at LinqToDB.SchemaProvider.SchemaProviderBase.<GetSchema>b__28(ProcedureInfo sp, IEnumerable`1 gr)\r\n   at System.Linq.Enumerable.<GroupJoinIterator>d__6a`4.MoveNext()\r\n   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at LinqToDB.SchemaProvider.SchemaProviderBase.GetSchema(DataConnection dataConnection, GetSchemaOptions options)\r\n   at Microsoft.VisualStudio.TextTemplating897E1797A7604C7848186AA534BA116FB2E451E743FC7D66BF1E82C3B2F163C7C44083A4D9927042086139782B6614CEA30869A46C55FBEED548B8A0984CF0E5.GeneratedTextTransformation.LoadServerMetadata(DataConnection dataConnection) in c:\\Unmanaged\\Sources\\SHORT\\DevNC\\FFHSPlatform\\Solutions\\EmedFullSuite\\Emed.Net.Data\\LinqToDB\\LinqToDB.Templates\\DataModel.ttinclude:line 53\r\n   at Microsoft.VisualStudio.TextTemplating897E1797A7604C7848186AA534BA116FB2E451E743FC7D66BF1E82C3B2F163C7C44083A4D9927042086139782B6614CEA30869A46C55FBEED548B8A0984CF0E5.GeneratedTextTransformation.LoadMetadata(DataConnection dataConnection) in c:\\Unmanaged\\Sources\\SHORT\\DevNC\\FFHSPlatform\\Solutions\\EmedFullSuite\\Emed.Net.Data\\LinqToDB\\LinqToDB.Templates\\DataModel.ttinclude:line 257\r\n   at Microsoft.VisualStudio.TextTemplating897E1797A7604C7848186AA534BA116FB2E451E743FC7D66BF1E82C3B2F163C7C44083A4D9927042086139782B6614CEA30869A46C55FBEED548B8A0984CF0E5.GeneratedTextTransformation.LoadOracleMetadata(String connectionString) in c:\\Unmanaged\\Sources\\SHORT\\DevNC\\FFHSPlatform\\Solutions\\EmedFullSuite\\Emed.Net.Data\\LinqToDB\\LinqToDB.Templates\\LinqToDB.Oracle.ttinclude:line 19\r\n   at Microsoft.VisualStudio.TextTemplating897E1797A7604C7848186AA534BA116FB2E451E743FC7D66BF1E82C3B2F163C7C44083A4D9927042086139782B6614CEA30869A46C55FBEED548B8A0984CF0E5.GeneratedTextTransformation.TransformText() in c:\\Unmanaged\\Sources\\SHORT\\DevNC\\FFHSPlatform\\Solutions\\EmedFullSuite\\Emed.Net.Data\\ADO\\OracleDB\\Linq\\DataModels\\CopyMe.Oracle.Managed.tt:line 67\tc:\\Unmanaged\\Sources\\SHORT\\DevNC\\FFHSPlatform\\Solutions\\EmedFullSuite\\Emed.Net.Data\\LinqToDB\\LinqToDB.Templates\\DataModel.ttinclude\t53\t1\tEmed.Net.Data\r\n```"}}