LINQPad script fails using lprun, works otherwise, need steps to diagnose the issue - linq

Some environment details:
LINQPad v4.47.02(AnyCPU)
OS Name Microsoft Windows Server 2012 Standard
Version 6.2.9200 Build 9200
System Type x64-based PC
I am trying to figure out how I might diagnose an issue I am encountering when launching a script via the lprun.exe command line utility. When I run the script from the IDE interactively it runs and completes without any exceptions.
When the same script is run under the same user from the command line using: lprun.exe
I get this output.
c:\SQLTasks\Linqpad\Demographics\Demo_GenerateDemographicsSubset.linq(880,20) :
error CS0029: Cannot implicitly convert type 'string' to 'char?'
Due to how LINQPad compiles the script I cant easily locate the area in my script that might be causing this and I'd really like to know if possible what mechanisms might allow it to work interactively and fail from the command line.

Please refer to the discussion on the LINQPad forum: http://forum.linqpad.net/discussion/437/lprun-exe-runtime-error-doesn-t-hapen-when-script-is-run-from-linqpad-ide#latest
Edit: this was due to a bug in how LINQPad reads configuration settings in command-line mode. The bug was fixed as of v4.48.

Related

Execute a file using OS sampler in JMeter on a RHEL 8 Machine

Have a .net core library Linux compatible on a Linux machine. I can execute it locally from terminal and getting the expected result. But while executing from JMeter using a OS sampler it is failing.
From Terminal: Running Fine
JMeter Settings:
Fetching the Response Body: (which should be 352 for example from the above terminal)
JMeter it is failing:
Check the file location and permission, everything is in place. What I have missed here any help ?
After change:
I changed as suggested and still facing the issue,
Error details,
I think you need to invoke a shell instead of trying to execute your command directly, something like:
Also if you open the OS Process Sampler in the View Results Tree listener you will see the output or in case of failure the failure reason
More information: How to Run External Commands and Programs Locally and Remotely from JMeter
I guess you misinterpret both Dimtri and User729 comment, you need to add both places and it should work.

Getting output from from VS WSL build events

Visual Studio has a relatively new way of doing Linux builds, using the local WSL system. This platform toolset is called WSL_1_0
What in a remote build was called "Remote Pre-Build Event" is now called "Wsl Pre-Build Event" (in the UI..still Remote whatever in msbuild, apparently) and it works basically the same, but with execution occurring in WSL on the local machine rather than on a linux machine.
Aaaand...any script output seems to be swallowed (vs. running on a remote machine where it was displayed in the build window):
1>Target RemotePreBuildEvent:
1> Invoking 'echo "me : stuff error 567 HELLO"', working directory: '/mnt/s/buildroot/CoreTech/ThirdPartyTools/Encryption/Rijndael/Project/Linux'
1>Target ClCompile:
1> Starting remote build
If I replace this with a script, it is executed..but the output is swallowed.
I've tried redirecting to stderr both within the script and within the command and it seems to change nothing. I've also adjusted Tools->Options->Project and Solutions->Build and Run output verbosity as high as I'm willing to (Normal) with no changes.
Anyone have any ideas on solving this?
I've also adjusted Tools->Options->Project and Solutions->Build and
Run output verbosity as high as I'm willing to (Normal) with no
changes.
Normally it's recommended to change the Verbosity to Detailed and higher to see more details. And this is the only option I know in latest VS2019 16.3.7 can control the behavior of output log.
So you can change it to Detailed to check if there's more info to be displayed in output window.(For some reason,my configuration fails for the wsl.exe, so I can't test it myself whether this option can work)
And if the echo info is still not shown, I guess this scenario is not be supported for now since it's quite a new feature. Just post your feedback in DC as the Give Us Feedback in this document suggests. The team there would look and consider about supporting that. May it makes some help :)

Windows Script Host JScript Scripting Engine Difficulty

I am attempting to run a JScript script using Windows Script Host 5.8 on a 32-bit Windows 7 PC. This script is part of a larger build effort for an open source software project, where an ActiveXObject is being created as part of the script. This has failed to run, but I suspect that the specific script is not at fault, but rather my local Windows Scripting Host (WSH) setup.
I have inferred this based on the following 'bare bones' tests that I have run with a one line test script:
I prepare a script using Notepad which is saved as 'test.js' and contains the following line:
var strLit = "This is a string literal.";
I then execute the above script using the following command:
cscript /e:jscript test.js
This seems to run successfully, of course returning no output, but critically no error message.
I then change the script to contain just the following line:
print("Hello World!");
When run with the same command as above, the following error message is received:
Microsoft JScript runtime error: Object expected
I then change the script to contain just the following line:
var fso = new ActiveXObject("Scripting.FileSystemObject");
When run with the same command as above, the following error message is received:
Microsoft JScript runtime error: Automation server can't create object
It is this third version of the script that contains the line failing in the open source software script mentioned above. However, based on the creation of a string variable script succeeding, I would infer that WSH is to some extent functioning. However, the fact that the 'hello world' script has failed, as well as the failure of the ActiveXObject would indicate that WSH with the JScript engine may not be correctly set-up on my computer or otherwise functioning.
I would also infer that this likely has nothing to do with Internet Explorer security levels due to this script being run from the command line with no link to Internet Explorer.
I have done the following to try to resolve this problem:
Ensured that Windows associates files with extension '.js' with WSH, although by using the '/e:' switch when calling the script as above, this is not an issue anyway.
Re-registered scripting components on my computer using an administrator elevated command prompt with the following commands:
regsvr32 %systemroot%\system32\vbscript.dll
regsvr32 %systemroot%\system32\jscript.dll
regsvr32 %systemroot%\system32\dispex.dll
regsvr32 %systemroot%\system32\scrobj.dll
regsvr32 %systemroot%\system32\scrrun.dll
regsvr32 %systemroot%\system32\wshext.dll
regsvr32 %systemroot%\system32\wshom.ocx
All of the above commands work successfully, except for the last two, where the following errors are received:
The module "C:\Windows\system32\wshext.dll" was loaded but the call to DllRegisterServer failed with error code 0x80040201
The module "C:\Windows\system32\wshom.ocx" was loaded but the call to DllRegisterServer failed with error code 0x80040201
Attemped to run the script with my virus protection (F-Secure) completely disabled and there being no internet connection.
I would infer the following from the tests above:
Script one: This is a simple script declaring and initializing a variable and doing nothing else, meaning that it is no surprise that it should run and perhaps confirms that the JScript engine is at least present and working fundamentally.
Script two: This is again a simple script but that may make use of additional functionality (I. e. 'print').
Script three: This is a simple script, but seeks to create an object of a specific type, by means of recourse to an application (identified as 'Scripting') to achieve this. This 'Scripting' application is supplied as a parameter when creating a new ActiveXObject which in the Microsoft JScript reference is identified as a 'servername'. Generically, the 'servername' is defined by the Microsoft JScript reference in this context as being 'the name of the application providing the object'. I note that the error message for script three makes reference to an 'automation server' and therefore wonder if there is a link here.
Would anybody have any ideas as to what may be the problem here, specifically with script three? The error message in script three above has been widely discussed online in the context of Internet Explorer security levels, but due to this being a script run on the command line, I cannot see how this solution would relate this problem.
Any ideas would be much appreciated.
Thanks
Jason

VS error when creating new WebAPI project

When I create a new WebAPI project (MVC4) I get the following error.
EntityFramework.5.0.0: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
jQuery.1.7.1.1: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
After Googling I have found a few answers but nothing that works yet.
Error creating new MVC project - EF and JQuery
This answer seems like it should work for me as my last project was a 7z Command Line app and I might have done something daft with 7zip. But I copy pasted the 7-Zip directory from Program Files to Program Files (86) with no luck.
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/c934fed4-e44e-4a06-9e3b-eccb9c8aa8d6
There is an answer here that might work (I haven't tried it) but even if it does work I wouldnt want to do this every time I create a new project.
Is anyone able to help me with this one?
I got around a similar error by running PowerShell as administrator with the command Set-ExecutionPolicy Unrestricted, restarting Visual Studio, and opening the Package Manager Console before what I wanted to do.
Make sure you understand the security implications of doing this first.
http://technet.microsoft.com/en-us/library/ee176961.aspx
Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned - Only scripts signed by a trusted publisher can be run.
RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted - No restrictions; all Windows PowerShell scripts can be run.
I encountered this issue recently, after re-install VS and install the latest VS update 2, things go well. This works for me at least.

Running batch file on remote machine from hudson server using PSEXEC

I am new to Hudson with PSEXEC, i am using hudson in my computer, i want to run batch file on remote computer from hudson build.
I used PSEXEC to run batch file on remote computer,when i executed from command promt it working successfully.But same i did from Hudson build its hanging..it's not doing anything.so please give any suggestions is there any other way we can handle this.
I want to do this quikly...urgent
Anyones help is appreciable
thanks in advance.
Could it be that psexec is waiting for a user entry? In this case hudson will hang.
Does Hudson runs with your user credentials? if not lunch a command Prompt with the credentials Hudson is running with and see what happens if you call psexec. If hudson runs on the local system account, you can't start a command prompt with it. Than try to run Hudson with your credentials and see what happens.
BTW, did you check Hudsons log files (just in case that there might be something)?
I had the same problem where PSEXEC simply hung.
The solution i found (after trawling for AGES) was to add the parameter -accepteula to the PSEXEC called. Hudson stopped hanging after that.
Very frustrating.
maybe it is too late, but I thought I will post it for others who have the same problem.
Psexec has problem running from any CI server, doesn't matter what CI server you have, is it Hudson, Teamcity, ...).
Psexec hangs when run from the build server.
It doesn't hang for all commands, but with some commands , psexec will hang.
The problem resides with how psexec will read the output of the remote running command.
The ultimate solution is to use other tools than psexec.
You can check this blog of this solution.
But if you need a simpler solution, and you don't care about the output of the command, I came up with a simple solution that suppress the output of the psexec.
You can write a small c# program that will run the psexec command, suppressing its output.
I blogged about that here
I thought I would respond to this since I was having the same hanging problem with TeamCity and psExec. Since I believe it is actually an issue with Java executing psexec, it should apply in the case of Hudson as well.
While I ran into the accepteula issue was early on, you only need to agree once and it sets a registry setting. As user327759 indicates the -accepteula switch in the script would cover your basis the first time and for ever after.
If this doesn't fix your problem, which it didn't in my case, you need to add the "-i" command switch. ex: psexec -i \ServerName "C:\folder\file.bat"
For context regarding this solution, I have included my backstory:
I was able to execute this PsExec command just fine via a MsBuild task, via a .Net wrapper and via straight command prompt usage, but TeamCity would just hang on the execution. It seems that Java is expecting some response on standard in, when it invokes the psexec exe. On the remote server I would see the psexecsvc process fire up and register in the services console appropriately, but then it would stop. After reading many posts such as this one, and struggling for far longer than I would care to admit, I eventually tried -i option, despite not needing this in any other execution scenario outside of TeamCity. The psexec documentation indicates that -i will "Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session." It is still unclear to me why this makes all the difference for TeamCity.

Resources