I'm stuck on a similar problem using FIT messages to display info on a Garmin Varia Vision. Not sure if this will be helpful to you, but I've been unable to convert Garmin Settings FIT files into CSV using the FITtoCSV and back using the tool provided. There are proprietary fields that the parser will output as "unknown" if you use the -s option, but then it is still unable to put them back together into FIT files because either way, significant data is lost and the device just deletes the file. You should try this with a known working Garmin FIT file, assuming you have one, and see how much of the file size is lost before vs. after the conversion. If you're missing anything, then I think the only conclusion is that the parser provided with the FIT SDK isn't capable of making the file you need for that particular device.
My case my be different through as I'm still working with FIT files that configure an Extended Display, and haven't gotten to the part where I'm pushing workout data.
For troubleshooting your code, maybe start with one of the examples in FIT SDK\examples. See if you can get one, or many working. If you can, then gradually transform the FIT file into one of yours. Not much of a debugging environment, but it should work.
Sorry, I just noticed you said Upload Failed.. What hardware and software are you using for the upload? Have you gotten any files to upload successfully? What I said above might still be relevant, but you should probably spend some time on connection aspect first.