Error inserting XML fragment when using CSV settings file

Jun 12, 2014 at 6:53 PM
Edited Jun 12, 2014 at 6:54 PM
Hello,

I have been using the normal Excel file format for a long time, but keep some settings in a CSV as well for a different build/deploy phase. I would like to combine these files and have one master configuration file.

To that end, I was asked if I would replace a token with an XML fragment.
ie. [%XMLFrag%]

replaced with

<test>
    <fragment>This has some test data.</fragment>
</test>
In the Excel file this works fine, when I save this as a CSV I get the following error.
ConfigGen v1.0.4.1 - Configuration file generation tool
Copyright (C)2010-2013 - Rob Levine and other contributors - http://configgen.codeplex.com
--
Index was outside the bounds of the array.
When I remove the column with the xml fragment, the replacement works as expected.

Thanks!
Jun 23, 2014 at 10:21 AM
I may not have understood you correctly: are you saying you can have the above XML fragment specified in the settings spreadsheet and everything works, but when you try and do the same thing using the csv format it fails?

Thanks,

Rob
Jun 23, 2014 at 4:39 PM
Yes, that is correct
Jun 23, 2014 at 7:22 PM
Yes, that is correct.


Jul 21, 2014 at 6:46 PM
Hi, and sorry for the delay in getting back to you.

I can reproduce this issue here.
Unfortunately, the CsvSettingsLoader is not correctly handling the carriage returns, even when the xml fragment is surrounded with quotes (which is how Excel outputs it). This is a bug, as the loader ought to handle this scenario.
I've raised a defect for this (https://configgen.codeplex.com/workitem/29), but haven't got time to fix it at the moment. Feel free to have a look yourself: it is all in the class CsvSettingsLoader.
I'll try and get round to this soon, but am toying with the idea of re-writing significant parts of ConfigGen to make ongoing maintenance simpler. Unfortunately the current code-base is less clear than it should be!

Kind Regards,

Rob