TCX Fixer

TCX File Repair

C# projects for repairing corrupted TCX files exported from exercise tracking website Strava.

Problem They Solve

Bulk downloaded tcx files from Strava have leading spaces at the beginning of the file, which Garmin Connect deems as invalid XML with the following error message.

“One of your files was not accepted by the system. Please contact Support for Assistance”

Upon noticing that my Garmin Connect activity history was missing activities that existed in Strava I decided to download the missing activities from Strava.
Downloading activities individually was tedious, so I downloaded all my data.

However, whilst the individually downloaded files uploaded fine to Garmin Connect, the bulk download of activities did not, after some upload tests (To many at once? Already uploaded? Fit, gpx or tcx files?) I finally narrowed it down to the tcx files and compared them to the individually downloaded files.

Using file compare in Notepad++ the only difference was 10 leading spaces at the beginning of the first line.

After deleting the spaces the file uploaded fine to Garmin Connect.

Now I had thousands of files that need fixing, there was no way I was going to do it manually…

TcxFixerGui

This project provides a basic gui interface for selecting .tcx files and displaying the output whilst processing the files.

TcxFixerConsole

This was the initial proof of concept project.
Designed to be placed in the directory where your .tcx files are.
It will find all .tcx files with in the current directory, process them and write updated versions to a new directory.