Code Smith错误 - 无法比较数组中的两个元素

时间:2018-03-16 12:01:40

标签: c# codesmith .nettiers

我们使用codesmith和net tier的组合为我们的asp.net网站生成数据访问层代码。

今天突然尝试生成代码时出现以下错误。

Generating project "C:\Source\Trunk\Project1V1.0\Project1.csp" outputs...
Compiling template "C:\Source\Trunk\Project1V1.0\CodeGenerationTemplates\NetTiers.cst"...
Template compilation succeeded. (405 ms)
Rendering output 'DBMaster.txt'...
Error: Project1.csp(0,0) Failed to compare two elements in the array.
Stack Trace:
   at System.Array.SorterObjectArray.DepthLimitedQuickSort(Int32 left, Int32 right, Int32 depthLimit)
   at System.Array.Sort(Array keys, Array items, Int32 index, Int32 length, IComparer comparer)
   at CodeSmith.Core.Collections.ObservableList`1.Sort(IComparer comparer)
   at _CodeSmith.NetTiers_cst.Go() in c:\Source\Trunk\Project1V1.0\CodeGenerationTemplates\NetTiers.cst:line 982
   at _CodeSmith.NetTiers_cst.__RenderMethod1(TextWriter writer, Control control) in c:\Source\Trunk\Project1V1.0\CodeGenerationTemplates\NetTiers.cst:line 5017
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToString()
   at CodeSmith.Engine.CodeTemplate.RenderToFile(OutputFile outputFile, Boolean overwrite)
   at CodeSmith.Engine.ProjectCodeGenerator.GenerateCode(CodeSmithProject project)
 --> Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Stack Trace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TrySetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at System.Data.SqlClient.SqlDataReader.Read()
   at SchemaExplorer.SqlSchemaProvider.GetTables(String connectionString, DatabaseSchema database)
   at SchemaExplorer.CachedSchemaProviderProxy.GetTables(String connectionString, DatabaseSchema database)
   at SchemaExplorer.DatabaseSchema.#N2f()
   at SchemaExplorer.SqlSchemaProvider.GetKeysFromReader(IDictionary`2 tables, SafeDataReader reader, Boolean populateTable)
   at SchemaExplorer.SqlSchemaProvider.GetTableKeys(String connectionString, TableSchema table)
   at SchemaExplorer.TableSchema.#i3f()
   at SchemaExplorer.TableSchema.get_ForeignKeys()
   at SchemaExplorer.TableSchema.#1fb(ITableSchema #Zdc, ICollection`1 #5yi)
   at SchemaExplorer.TableDependancyComparer.Compare(Object x, Object y)
   at System.Array.SorterObjectArray.SwapIfGreaterWithItems(Int32 a, Int32 b)
   at System.Array.SorterObjectArray.DepthLimitedQuickSort(Int32 left, Int32 right, Int32 depthLimit)
 --> The wait operation timed out
Stack Trace:

Unable to render output DBMaster.txt, skipping...
Skipping output 'DBChild.txt'...
Done rendering outputs: 0 succeeded, 1 failed, 1 skipped (104816ms).

据我所知,自上次生成代码以来,没有任何变化。但突然间这个错误开始了。

请注意,这是一个遗留网站。目前我们只维护这个网站。 有人可以帮助我理解造成这种情况的原因。

由于

1 个答案:

答案 0 :(得分:0)

就这样,我们列出了一个解决方案。

“执行超时到期。在操作完成之前超时的时间或服务器没有响应。堆栈跟踪:我认为您的数据库超时。– mjwills”