bitcycle
bitcycle

Reputation: 7792

.NET framework execution aborted while executing CLR stored procedure?

I constructed a stored procedure that does the equivalent of FOR XML AUTO in SQL Server 2008. Now that I'm testing it, it gives me a really unhelpful error message. What does this error mean?

Msg 10329, Level 16, State 49, Procedure ForXML, Line 0 .NET Framework execution was aborted.

System.Threading.ThreadAbortException: Thread was being aborted.

System.Threading.ThreadAbortException:

  at System.Runtime.InteropServices.Marshal.PtrToStringUni(IntPtr ptr, Int32 len)
  at System.Data.SqlServer.Internal.CXVariantBase.WSTRToString()
  at System.Data.SqlServer.Internal.SqlWSTRLimitedBuffer.GetString(SmiEventSink sink)
  at System.Data.SqlServer.Internal.RowData.GetString(SmiEventSink sink, Int32 i)
  at Microsoft.SqlServer.Server.ValueUtilsSmi.GetValue(SmiEventSink_Default sink, ITypedGettersV3 getters, Int32 ordinal, SmiMetaData metaData, SmiContext context)
  at Microsoft.SqlServer.Server.ValueUtilsSmi.GetValue200(SmiEventSink_Default sink, SmiTypedGetterSetter getters, Int32 ordinal, SmiMetaData metaData, SmiContext context)
  at System.Data.SqlClient.SqlDataReaderSmi.GetValue(Int32 ordinal)
  at System.Data.SqlClient.SqlDataReaderSmi.GetValues(Object[] values)
  at System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)
  at System.Data.ProviderBase.SchemaMapping.LoadDataRow()
  at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
  at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
  at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
  at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
  at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
  at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
  at ForXML.GetXML...

Upvotes: 1

Views: 2089

Answers (2)

Randolpho
Randolpho

Reputation: 56391

Typically Thread Abort exceptions occurring during ADO.NET DataSet/Table/Adapter filling happen because the query ran longer than the timeout of whatever means was used to retrieve the data.

In your case it looks like you're using a direct SQL Server connection, so I'd say try setting the CommandTimeout property for your SQL command to a sufficiently large value to accommodate your query. That, or fine-tune the query or even the application architecture for better performance.

Upvotes: 4

ChrisLively
ChrisLively

Reputation: 88074

I'm pretty sure it means you did it wrong...

On another note: It looks like you are filling a datatable. during the call it's trying to convert something into a string value.. and failing.

You're going to have to look at the columns that are coming back to see if there is one that can't convert to a string representation. Maybe a binary or null value, or something like that.

Upvotes: 3

Related Questions