I came to the realisation last night that we need to rethink the AssemblyInfo Updater parser. The problem is it is really just a simple text parser, and unless we implement full language semantic parsing (a mamoth task and overkill) it is never going to deal with every eventuality.
For FB vNext we already re-architected the action and the developer that did the work (Dick) used his favourite sledgehammer, regular expressions. I just plugged your test cases in to his unit tests and they failed, then spent the morning rewriting his regular expressions and then getting all the unit tests passing again. Now I'm looking at how I can back port this work to FB6 so we can stop this parser madness once and for all!
I have removed the custom parser and replaced it with regular expressions. This should be more reliable, I spent the afternoon looking for test cases to break it with and so far so good. I added the cases you provided to the unit tests.
The build corrects both the match count problem and the parenthesis matching problem.
I did find a new problem though.
When updating an AssemblyInfo.cpp with new attributes, the attributes get added without semi-colons.
// Assembly Information Added By FinalBuilder [assembly: AssemblyFileVersionAttribute("1.10.5.3600")] [assembly: RandomAttribute("Random Value")] // End Assembly Information Added By FinalBuilder