I use the latest version 1.7. The problem occurs when I clone the DataTable of the original feature set to the DataTable of the new feature set. If I add columns one by one, the problem does not occur. I know that the Clone-method for a DataTable has nothing to with DotSpatial. From the example in the MSDN-documentation (http://msdn.microsoft.com/en-us/library/system.data.datatable.clone(v=vs.110).aspx), I suspect it is more complicated to clone a data table than just use the Clone()-method (?). I have not cloned any other featureset datatable, so I do not have an answer on your second question.
The code that failed looked like this:
The code that failed looked like this:
var newFeatureSet = new FeatureSet(FeatureType.Line)
{
Projection = sourceFeatureSet.Projection,
DataTable = sourceFeatureSet.DataTable.Clone()
};
The code that works looks like this:var newFeatureSet = new FeatureSet(FeatureType.Line)
{
Projection = roadFs.Projection,
};
foreach (DataColumn col in sourceFeatureSet.DataTable.Columns)
{
newFeatureSet.DataTable.Columns.Add(new DataColumn(col.ColumnName, col.DataType));
}