Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-26-2004, 04:12 AM
Kim Kim is online now
Registered User
 
Join Date: 04-03-2003
Location: Norway
Posts: 26
Unhappy Illegal macro value

Hi,
I'm using the FAILSTEP_OUTPUT macro when sending an email to developers when build fails.

When running NUnit tests, one of my projects failed and gave the following output (only included the failing text) : WaitMultiple(WaitHandle[] waitHandles)

When using this macro in the body of the send email step, the following error is returned: Error expanding macros in property Message: <Error parsing scripts: Unrecoverable Parse Error at position 301 - expecting section>

If the [] characters are manually removed from the macro value, no errors are generated. Are [] characters not allowed in macros? Is this a bug in VisBuildPro? Are there any workarounds?

I'm currently using version 5.5 of VisBuildPro.
Reply With Quote
  #2  
Old 10-26-2004, 09:00 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,003
Any special characters ([ ] %) in output captured from a step and stored in the LASTSTEP_OUTPUT/FAILSTEP_OUTPUT macros are normally doubled so that they will be treated as literals by VBP, rather than as script/macro markers. I've attached a sample that works as expected here (it creates a batch file which echos that string and the fails, calls the batch file, and then logs and send the failed step output in the failure steps). What is different about your scenario?
Attached Files
File Type: bld fail_output.bld (1.1 KB, 1242 views)
Reply With Quote
  #3  
Old 10-26-2004, 11:20 AM
Kim Kim is online now
Registered User
 
Join Date: 04-03-2003
Location: Norway
Posts: 26
My NUnit output only contain a single [ char or ] char - no double [[ chars. The FAILSTEP_OUTPUT macro only contain single [ char. VBP do not double the special characters to [[ or ]].
Reply With Quote
  #4  
Old 10-26-2004, 11:28 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,003
Can you post a reproducible case for this? Any program output that is captured is treated as described above, so it's unclear how the macro could end up with such a value.
Reply With Quote
  #5  
Old 10-27-2004, 03:33 PM
Kim Kim is online now
Registered User
 
Join Date: 04-03-2003
Location: Norway
Posts: 26
The case is 100% reproducable in my build environment (but you need my source code...). I have attached a screendump that shows the output with single [ and ] chars. This output is identical with the FAILSTEP_OUTPUT macro (since the build failed).
Attached Images
 
Reply With Quote
  #6  
Old 10-27-2004, 04:26 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,003
By the time the output is logged (as shown in the screenshot), the double chars have already been evaluated as a single literal bracket and just the single literal bracket chars are shown, which is the expected behavior. I don't see any macro expansion errors here. Please narrow your code down to a reproducible case that we can run here and also send the full log file of the build.
Reply With Quote
  #7  
Old 10-28-2004, 04:40 AM
Kim Kim is online now
Registered User
 
Join Date: 04-03-2003
Location: Norway
Posts: 26
You are right - the problem is not the original FAILSTEP_OUTPUT macro. When a failure arise, my first failure step is to copy the FAILSTEP_OUTPUT macro to a temporary macro for safe keeping (another step failing and overwrite the original FAILSTEP_OUTPUT macro).

Original FAILSTEP_OUTPUT macro value:
System.Threading.WaitHandle.WaitAll(WaitHandle[[]] waitHandles)

Copy made: LAST_ERROR_MESSAGE temporary macro value:
System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles)

The copy step is the first job in the failure steps, and is using a "Set Macro". The value of this step is %FAILSTEP_OUTPUT% which deletes the extra [ and ] chars. When using the copy in a send email step, an error arise.

Attached is a build script that can reproduce this failure
Attached Files
File Type: bld failurestepmacro.bld (856 Bytes, 1011 views)
Reply With Quote
  #8  
Old 10-28-2004, 06:58 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,003
You need to check the 'Don't expand macros in value when setting' checkbox on the Macro tab of the Set Macro action. The expand logic also applies to script and doubled (literal) characters (we'll update the docs because this could be stated more clearly).
Reply With Quote
  #9  
Old 10-28-2004, 07:48 AM
Kim Kim is online now
Registered User
 
Join Date: 04-03-2003
Location: Norway
Posts: 26
Question

OK - but then I'm back where I started. The new temporary macro is pointing to the original macro. If the original macro change its value, the value inside the temporary macro will also change.

I need a backup of a macro value (in case the original macro change its value) and not a reference/pointer to the original macro value. How do I do that?
Reply With Quote
  #10  
Old 10-28-2004, 07:55 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,003
Sorry, duh! To copy the macro, you need to replace the Set Macro step with a Run Script step with the following (VBScript) code:

Application.Macros(vbldMacroTemporary).Add "LAST_ERROR_MESSAGE", Application.Macros(vbldMacroSystem)("FAILSTEP_OUTP UT").Value

to get the actual macro value without anything within *it* expanded/evaluated.
Reply With Quote
  #11  
Old 10-28-2004, 08:18 AM
Kim Kim is online now
Registered User
 
Join Date: 04-03-2003
Location: Norway
Posts: 26
Thumbs up

Thx - this code solved my problem
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 11:19 AM.


Copyright © 1999-2023 Kinook Software, Inc.