0
Completed

Improve CSV Connector edge case for empty target file.

Tony Sheehy 11 years ago in CSV connector updated by anonymous 8 years ago 1

The current message thrown when the target CSV file is empty is the following:

Save entities to connector failed.
Save entities [Count:40] to connector Test CSV - C:\log\AurionGeneric.csv failed with reason Non-negative number required.
Parameter name: value. Duration: 00:00:00.0040002
Error details:
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: value
at System.IO.FileStream.set_Position(Int64 value)
at Unify.Product.IdentityBroker.CsvConnector.<>c__DisplayClass2a.<AddEntities>b__28(Stream old, Stream new)
at Unify.Product.IdentityBroker.FileStreamCommunicator.Shift(UpdateFile fileUpdate)
at Unify.Product.IdentityBroker.CsvConnector.AddEntities(IEnumerable`1 entities)
at Unify.Product.IdentityBroker.EventNotifierAddingConnectorDecorator.AddEntities(IEnumerable`1 entities)
at Unify.TestHarness.Connector.ConnectorTestHarness.<>c__DisplayClass6.<Add>b__5(IEntitySchema schema, IEnumerable`1 entities)
at Unify.TestHarness.Connector.ConnectorTestHarness.Shift(Guid sourceId, Action`2 entityHandler)
at Unify.TestHarness.Connector.ConnectorTestHarness.Add(Guid sourceId, Guid targetId)
at Unify.TestHarness.Connector.ConnectorTestHarnessServiceController.Add(StandardPostData postData)

Instead, the schema field names should be written as the header, with an informational event logged stating that the file was updated with the correct heading.