Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   VBScript code failing (https://www.kinook.com/Forum/showthread.php?t=1305)

jjaymcdaniel 10-03-2005 01:31 PM

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?

jjaymcdaniel 10-03-2005 03:57 PM

The attached code works fine the the VBP 6 Beta. It does not work with v5.7 or v5.6

kinook 10-03-2005 04:49 PM

I don't see any attachments.

jjaymcdaniel 10-03-2005 04:51 PM

1 Attachment(s)
Here is the file.

kinook 10-03-2005 05:17 PM

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).

jjaymcdaniel 10-03-2005 05:26 PM

1 Attachment(s)
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.

kinook 10-03-2005 06:25 PM

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.

jjaymcdaniel 10-04-2005 09:42 AM

I will try that but it doesn't explain why the project works as is in 6.0 Beta.

jjaymcdaniel 10-04-2005 10:44 AM

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.

kinook 10-04-2005 10:58 AM

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.

jjaymcdaniel 10-04-2005 11:20 AM

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.

kinook 10-04-2005 11:51 AM

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.

jjaymcdaniel 10-06-2005 01:29 PM

1 Attachment(s)
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'.

kevina 10-10-2005 08:31 AM

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.


All times are GMT -5. The time now is 07:48 AM.


Copyright © 1999-2023 Kinook Software, Inc.