AssemblyInfo updater doesn't update attribute with concat string when run twice

I am updating an AssemblyInfo.cpp

Setting AssemblyDescription = "ProductX was built in " + @"%FBPROJECTDIR%"

Updates correctly the first time.  Running it twice I get this:

[assembly: AssemblyDescription("ProductX was built in " + @"H:\temp\AssemblyInfoBug2") @"H:\temp\AssemblyInfoBug2")]
 

Example attached

-Nelson

AssemblyInfoBug2.zip (3.574 KB)

Hi Nelson

Thanks again for a great test case, made it easy to reproduce and fix. I wish all bug reports were this good

Hey Vincent,

I'm glad my samples have been helpful!

The official build fixed the above problem, but I hit one more snag on a different file.

In an AssemblyInfo.cpp I have:

[assembly:AssemblyCopyrightAttribute("Copyright (c) MyCompany 2008")];

and when AssemblyInfo tries to update this, it stops at the first closing parenthesis. 

After update:

[assembly: AssemblyCopyrightAttribute("2009 MyCompany All rights reserved.") Philips 2008")];

 Sample attached (3.625 KB)

Hi Nelson

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!

For now you will have to modifiy your copyright attribute to use the copright symbol © symbol rather than (c).

 

Hi Nelson

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.

This build has the change :

https://www.finalbuilder.com/downloads/finalbuilder/630/FB630_1717.exe

Hi Vincent,

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

Sample attached. 

-Nelson

AssemblyInfoBug4.zip (25.415 KB)

This build should deal with the CPP issue :

https://www.finalbuilder.com/downloads/finalbuilder/630/FB630_1719.exe