#1
|
|||
|
|||
VBScript code failing
I have been attempting to copy the log file from the build, rename it, and send an email from the vbld_BuildDone script event. I initially tried to do everything with VBScript from within VBP. I continually ran into errors where the code would simply stop executing without any error. I then tried the attached code to dynamically build a batch file and then execute it. It also does not work. The last line that calls the MsgBox never executes. I am beginning to have concern for the reliablity of this tool.
Are there any known restrictions/limitations on the use of VBScript code in VBP? What about on the length of strings? Is there any way to debug the script code? |
#2
|
|||
|
|||
The attached code works fine the the VBP 6 Beta. It does not work with v5.7 or v5.6
|
#3
|
|||
|
|||
I don't see any attachments.
|
#4
|
|||
|
|||
Here is the file.
|
#5
|
|||
|
|||
The messagebox displays here on Windows XP SP2 in VBP 5.7 and 6.0. Which version/SP of Windows are you running on? Which Windows Script version? (use the following VBScript code in a Run Script step to report it:
Builder.LogMessage ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion You can use MsgBox or Builder.LogMessage to aid debugging script code, although in this case, it seems like it would be a lot simpler to replace the script code with a Failure Send Mail step (ala the VStudio.bld sample). |
#6
|
|||
|
|||
Windows XP w/SP2
WSH 5.6 I am attaching the full build script. This uses a slightly different set of code which also didn't work. |
#7
|
|||
|
|||
The On Error Resume Next call at the top of the vbld_BuildDone function can result in errors being silently eaten. Remove or comment out that line of code to determine which line of code is actually failing.
|
#8
|
|||
|
|||
I will try that but it doesn't explain why the project works as is in 6.0 Beta.
|
#9
|
|||
|
|||
I have tried commenting out all references to 'On Error Resume Next' and the code still does not work.
Are there known limitations with the capabilities of VBScript within VBP? When I first started having problems I noticed that a single line of code with many string concatinations would not work. The same code broken up into multiple lines seemed to work more of the time. I also noticed that the function to create a directory tree did not succeed unless a sleep line was inserted or a msgbox. |
#10
|
|||
|
|||
There aren't any such limitations that we're aware of. Script is hosted in VBP in much the same way that other hosts do (cscript/wscript.exe, etc.), and that has not changed between v5 and v6. We have never seen or had any other reports of script that just stops in the middle without any error condition, and both samples you provided display a messagebox as expected at the end of the build when built here. I would suggest adding more logging to narrow down at what line of code it is stopping for you.
|
#11
|
|||
|
|||
The problem that I have had there is that I am trying to copy the log file which means that I have to stop writing to it. Once I stop writing to the log file I have to start using MsgBox. I have discovered that after 4 to 6 successive calls to MsgBox the code will stop executing and if several of the MsgBox calls are commented out then the code will sometimes run further. I also had been using the 'On Error Resume Next' so that if the file copy fails (which it does) the email will still send.
I have not used a failure step as I want to send the email with different messages depending on whether the build succeeded or failed. Could the log file copy operation be failing because the file is still open from VBP? When does the log file get closed? I just tried the project on the our build server here which is running Windows 2000 w/SP 4 and WSH 5.6. It does not work there either. |
#12
|
|||
|
|||
Possibly use a single MsgBox call and keep moving it down to see how far it gets.
It seems that using Send Mail / Copy Files steps at the end of the build (for success) and also in Failure steps would be exactly what you need if you want to send a different message on failure. The only time the VBP logging components open the log file are to actually write something to it, which in the context of the vbld_BuildDone event would only happen due to a Builder.LogMessage call. And they open the file with share for read access, so even if they had it open when copied, I wouldn't expect that to cause the copy to fail. You might check the Event Viewer's application log to see if VBP reported any errors there that it couldn't log for some reason. One other option to avoid copying would be to write the log file directly to the log archive directory. I can't reproduce the problem here, so it's probably dependent on other build processing that doesn't happen here since we don't have everything needed to actually build your entire project. If you can narrow things down to a reproducible test case, that will greatly increase the chances of us being able to debug it. |
#13
|
|||
|
|||
I have tried the attached project on another engineer's computer running XP SP2 w/WSH 5.6. It did not work there either. I have only been executing the script down to the step named 'Delay Public Build'.
|
#14
|
|||
|
|||
The issue is that the build you have provided is not generic enough to be executed as-is without your development environment. When it is stripped down here to the point it can be executed, we can not reproduce the problem.
If you can simplify this build down to a reproduceable case (that can be executed without your build environment), please provide it so we can investigate the issue you report experiencing. |
|
|