This project is read-only.

System.ArgumentNullException: Value cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.Replace

Feb 1, 2013 at 9:55 PM
OK,
I have been working through this and I cannot seem to get past this error.

System.ArgumentNullException: Value cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.Replace(String input, String replacement) at Slam.Activation.SqlDataSynchronizeTypeProcessor.GetTableName(String typeName) at Slam.Activation.SqlDataSynchronizeTypeProcessor.Process(String sharepointSiteLocation, IDictionary`2 parameters) at Slam.Administration.Synchronization.DoSynchronization(String siteCollectionUrl, String typeName, String typeId, String typeSiteCollection, String typeSite)

Is there any way to debug this and see what value is erroring?
Developer
Feb 1, 2013 at 9:58 PM
The regex used is fairly simple. The table name is just the type name stripped of whitespace or an assigned TableName. Do you have a blank value in your slam.config, like Name="" or TableName="" ?
Feb 1, 2013 at 10:02 PM
Edited Feb 4, 2013 at 7:34 PM
I don't see anything I could be doing wrong. Here is my config file.
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
  <ConnectionStrings Default="SLAM">
    <add Name="SLAM" ConnectionString="Data Source=430095-SQL01;Initial Catalog=DB;User Id=xxx;Password=xxx" />
  </ConnectionStrings>

  <TypeIdDefinitions>
    <add Name="Global" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="true" />
    <add Name="GlobalWithSharePointIDs" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="false" />
  </TypeIdDefinitions>

  <DataMapping DataSchema="SLAM" TypeIdDefinition="GlobalWithSharePointIDs" SynchronousUpdates="false" SiteCollection="">

    <List Site="" Name="Clients" ActivationOrder="1">
      <Fields>
        <Field Name="Title" Column="Client" SqlType="varchar(255)" SPType="Text" Required="true"></Field>
      </Fields>
    </List>

    <List Site="" Name="SubCategories" ActivationOrder="2">
      <Fields>
        <Field Name="Title" Column="SubCategory" SqlType="varchar(255)" SPType="Text" Required="false"></Field>
        <Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="false"></Field>
      </Fields>
    </List> 

    <List Site="" Name="SubCategories 2" ActivationOrder="3">
      <Fields>
        <Field Name="Title" Column="SubCategory2" SqlType="varchar(255)" SPType="Text" Required="false"></Field>
        <Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="false"></Field>
      </Fields>
    </List> 
  </DataMapping>
</Configuration>
Rick
Feb 4, 2013 at 1:51 PM
Is there any kind of logging I can turn on to see what record is actually causing this issue?
Feb 4, 2013 at 5:17 PM
Edited Feb 4, 2013 at 5:18 PM
I don't think there's any type of "extra" logging to turn on... a look at the dbo.MessageLog entries when this error occurs might be useful.

Assuming this error is occurs when you're trying to sync the lists up using the SLAM Control Panel, could you please add AssociationTableName attributes to the two Lookup columns you have defined


<Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="false" AssociationTableName="TiltworksClientTOClients" ></Field>


and see if that clears up the problem. It looks like some of the sample configs don't include it but it should be there.
Developer
Feb 4, 2013 at 5:27 PM
If you want the Client column to be a foreign key column instead of an association table try changing it to
<Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="true" AssociationTableName=""></Field>
Feb 4, 2013 at 7:27 PM
brjenkins wrote:
If you want the Client column to be a foreign key column instead of an association table try changing it to
<Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="true" AssociationTableName=""></Field>
I updated my client field to the way you recommended and now it is throwing a new error. It looks like the AssociatedTypeName can not be blank.

Here is the error:
System.Data.SqlClient.SqlException: An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name. at System.Data.SqlClient.SqlConnection.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.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters) at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] parameters) at Slam.Data.SqlDataRepository.DropTableSynchronizationObjects(String tableSchema, String tableName, Boolean deleteItems) at Slam.Activation.SqlDataSynchronizeTypeProcessor.Process(String sharepointSiteLocation, IDictionary`2 parameters) at Slam.Administration.Synchronization.DoSynchronization(String siteCollectionUrl, String typeName, String typeId, String typeSiteCollection, String typeSite)
Developer
Feb 4, 2013 at 7:34 PM
Right, you need an AssociatedTypeName. AssociatonTableName I had blank because you seemed to be getting an error without it. If you intend on having a foreign key column in the TiltworksClient table you should really not have AssociationTableName at all in the node.

<Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="true"></Field>
is basically what you began with, but that is the expected form. The only difference is the Required value. Maybe just try it with Required="true"?
Feb 5, 2013 at 1:48 PM
That didn't seem to fix the problem. I exported the three lists and I am going to set up the solution on a local development environment and see if I can catch where it is erroring.

I will let you know what I find out.
Feb 5, 2013 at 4:08 PM
The GetTableName function is called six times within the method in your originally posted stack trace, SqlDataSynchronizeTypeProcessor.Process The error is occurring because a null string is being passed to it.

The first time it's called with the Name of the list which is clearly specified in your configuration.

The second, third, and fourth times it is called with the AssociationTableName for the Lookup columns. This is not specified in your original configuration but that' OK because it's checked for null before being called.

The fifth and sixth times it is called, AssociationTableName is again passed to it. However, this time it is not checked for null. This is the place where it is failing.

Did you try actually specifying a AssociationTableName instead of leaving it blank and changing Required="true" ?

e.g.
<Field Name="TiltworksClient" Column="Client" SPType="Lookup" AssociatedTypeName="Clients" Required="false" AssociationTableName="TiltworksClientTOClients" ></Field>
Feb 5, 2013 at 4:26 PM
I did try defining the TableName and it is still erroring,
Feb 5, 2013 at 4:44 PM
OK,
I have tracked the error down to File SLAM_2_1_Source\Slam\Core\Activation\SqlDataSynchronizeTypeProcessor.cs
Line 485
deleted = _database.DropTableSynchronizationObjects(schemaName, GetTableName(association.AssociationName), clearItemsOnSynchFinish);
It is passing a Null table name.
Feb 5, 2013 at 6:11 PM
Edited Feb 5, 2013 at 6:16 PM
That and the next line are the 5th and 6th occurrences I mentioned. That value comes from the AssociationTableName attribute. (See XmlSqlDataMapping.cs ln 213)

Please try to be a little more precise... Did you define an attribute named TableName or did you define an attribute named AssociationTableName? Did you add them to both Lookup fields? With different values?
Developer
Feb 5, 2013 at 6:24 PM
rtonerii wrote:
OK,
I have tracked the error down to File SLAM_2_1_Source\Slam\Core\Activation\SqlDataSynchronizeTypeProcessor.cs
Line 485
deleted = _database.DropTableSynchronizationObjects(schemaName, GetTableName(association.AssociationName), clearItemsOnSynchFinish);
It is passing a Null table name.
You are right. There should be a check on each returned association from GeTypeAssociations whether AssociationName is empty. When it is empty there is not a corresponding table.

An update with that check is checked in now.
Feb 5, 2013 at 6:31 PM
mmedrano wrote:
That and the next line are the 5th and 6th occurrences I mentioned. That value comes from the AssociationTableName attribute. (See XmlSqlDataMapping.cs ln 213)

Please try to be a little more precise... Did you define an attribute named TableName or did you define an attribute named AssociationTableName? Did you add them to both Lookup fields? With different values?
I am sorry if I was not descriptive enough. I thought I left enough information above. I did try defining the AssociationTableName like advised above. I also made sure to set requited to try and I was still seeing the issue.

Once I was able to dig into the code I was able to step through the error. I thought that might be more helpful.

I did see you mentioned that you knew about the error, which really doesn't make much of a difference. If it is an error, I would either look to see it fixed or I would compile my own version with the error corrected. I am not much of a "I know about that", I was looking to find a solution.

It looks like brjenkins found the same error and has fixed it. I am about to grab that and give it a shot.
Feb 5, 2013 at 6:37 PM
brjenkins wrote:
rtonerii wrote:
OK,
I have tracked the error down to File SLAM_2_1_Source\Slam\Core\Activation\SqlDataSynchronizeTypeProcessor.cs
Line 485
deleted = _database.DropTableSynchronizationObjects(schemaName, GetTableName(association.AssociationName), clearItemsOnSynchFinish);
It is passing a Null table name.
You are right. There should be a check on each returned association from GeTypeAssociations whether AssociationName is empty. When it is empty there is not a corresponding table.

An update with that check is checked in now.
OK,
How should l grab that? Is it a wsp or the solution. I just normally grab the source zipped up.

Sorry,
Not trying to be a pain, just trying to get the changes.
Developer
Feb 5, 2013 at 6:50 PM
No problem. The setup download, containing the WSP, is updated as well.
Feb 5, 2013 at 7:10 PM
WOW!
That was an awesome fix, the sync is running much faster and no errors.

Now I need to keep adding lists and complexity. We will see how things go!

Thanks for all of your help guys!