When trying to add an Licenseheader to a .py file in a Folder in a Python Tools Project, an InvalidOperationException gets thrown with Error message "Operation is not valid due to the current state of the object":

This is due to us trying to access projectItem.Collection. Collection is not implemented by Python Tools in OAFileItem. While the Base class provides an implementation for the root directory, it throws an InvalidOperationException in other cases (see Base Class Implementation, Line 157: https://github.com/Microsoft/PTVS/blob/master/Common/Product/SharedProject/Automation/OAProjectItem.cs ).
This can be fixed by accessing the Parent "Microsoft.VisualStudioTools.Project.Automation.OAFileItem" via the supplied object with reflection - the same fashion as #36 .