Adapter still not working
(Summary of my newly added post in this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2524723&SiteID=1&mode=1).
I'm having serious problems deploying the adapter. First of all, I've commented all content of MakeDataChanges() method so that it just looks like this now:
public DataChangesResult MakeDataChanges()
{
return DataChangesResult.NoChanges;
}
This is just temporary so it will be easier for me to analyze the errors made. Got some tips on the MSDN forum to add this part to MakeSchemaChanges, just to make sure I'm not adding a Fact twice (the code below is added in the beginning of the method, after getting your warehouse config variable):
//Check if the fact exists
Fact myFact = config.GetFact("Code Metrics");
if (myFact != null)
return SchemaChangesResult.NoChanges;
(After this part, the rest of MakeSchemaChanges() follows). Furthermore I've altered my try-catch statements to look something like this:
try
{
m_dataStore.Add(config);
m_dataStore.CommitTransaction();
}
catch
{
try
{
m_dataStore.RollbackTransaction();
}
catch (Exception ex)
{
m_dataStore.LogEvent(AdapterEventLevel.Error, ex.ToString());
return SchemaChangesResult.NoChanges;
}
throw;
}
That is; rethrowing the same exception that I catch, and not hiding the exception if RollbackTransaction also throws. So far so good. But this is recorded in the Event Viewer when I try running the adapter:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/8/2007 4:17:57 PM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-11-128416042576020816
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2972
Thread Id: 1504
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: TF51209: A run-time error System.Data.SqlClient.SqlException: Invalid column name 'Team Project'.
Invalid column name 'Team Project'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.SqlExecuteNonQuery(SqlCommand cmd)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreatePrc_Fact_X_AddUpdate(SqlConnection cn, SqlTransaction tr)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreateStoredProcedures(SqlConnection cn, SqlTransaction tr)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.ProcessNewConfig(WarehouseConfig config)
at Microsoft.TeamFoundation.Warehouse.AdapterDataStore.Add(WarehouseConfig newConfig)
at CodeMetricsAdapter.CMAdapter.MakeSchemaChanges()
at Microsoft.TeamFoundation.Warehouse.AdapterWrapper.MakeSchemaChanges() occurred on adapter CodeMetricsAdapter.CMAdapter.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
And also this:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/8/2007 4:17:57 PM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-11-128416042576020816
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2972
Thread Id: 1504
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: Schema change failed. \r\nConfig:\r\n<?xml version="1.0" encoding="utf-16"?>
<WarehouseConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Facts>
<Fact>
<Name>Code Churn</Name>
<FriendlyName>Code Churn</FriendlyName>
<PerspectiveName>Code Churn</PerspectiveName>
<IncludeCountMeasure>true</IncludeCountMeasure>
.... [some more of warehouseschema.xml but nothing on code metric]...
<SourceField>_Microsoft_V
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
So I guess the schema change fails, probably because the config.add(...) fails. But why?