我们使用 codesmith 和 net 层的组合来为我们的 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).
据我所知,自我们上次生成代码以来,一切都没有改变。但是突然这个错误开始了。
请注意,这是一个旧网站。目前我们只维护这个网站。有人可以帮我理解是什么原因造成的。
谢谢