Every time I want to profile an application with Visual Studio I have to run vsperfclrenv /globalsampleon as recommended here and here (I have it normally switched off because I love the "edit and continue"-feature). The command prompt then states:
Enabling VSPerf Global Profiling. Allows to 'attaching' to managed services.
You need to restart the service to detect the new settings. This may require a reboot of your machine.
So far I haven't found a way to restart the service (as mentioned in the prompt) without rebooting my computer. Is there another way?
EDIT to add some information from the comments:
I am profiling an application that I start from Visual Studio
I use another instance of Visual Studio to profile the application via "attach profiler"
You do not need to run "vsperfclrenv /globalsampleon" and reboot if an application you profile can be launched from command line. In this case you can invoke "vsperfclrenv /sampleon" from command prompt and then launch you application from the same prompt. This will set proper environment for a process being profiled.
However, if your application cannot be launched from command line (e.g. you profile a managed service) then you need to invoke "vsperfclrenv /globalsampleon" and reboot to apply proper environment changes system-wide. A reboot is recommended because without it in some cases the environment changes are not successfully broadcasted system-wide.
You can find more information here and here.
UPD: Specifically, for your scenario please invoke "vsperfclrenv /sampleon" from VS developer prompt, start VS via invoking "devenv" from that prompt and use that VS instance to start an application. So, your application should have necessary environment set. Another VS instance which you use to attach can be run as usual.
Related
i'm having issues to get a permanent active user-session on my virtual machine to execute gui tests developed with the functional testing tool Ranorex Studio via GitLab-Runner (Windows / Shell). The testsuite is based on a .NET solution which is built via MSBuild.exe and the output (bin/debug/*.exe) will be executed with some parameters via command line.
Procedure:
Start gitlab-runner via PowerShell as administrator with "gitlab-runner run" command
Make some changes in GitLab-Repository to start the pipeline via .yml-File
Ranorex test-project is built successfully and is starting the GUI-tests
In the first run the user session is active and the tests are going to be executed and interacting with the GUI, but when i try to trigger the pipeline again for further runs, the user-session turns to false and there is no interaction with the GUI (black sceenshots in test-report).
Already did:
Screensaver disabled
StandBy-Mode disabled
User-Access-Control on lowest setting
Lock-Screen disabled
Secure-Login disabeld
Remote connections enabeld
Ports openend
Keep Session open via .batch-File, when closing RDP-connection
GitLab-Runner Service => Log on with respective AD-User (equipped with admin-rights)
AD-User is alway logged in on virtual machine
With Jenkins (Master / Slave configuration) everything works fine
Would be grateful for any help!
Does your Ranorex process close down properly with an exit code? Does the Application Under Test also close down properly at the end? I am assuming something has locked - you could try a bit of Powershell to close the processes before a test run. One thing I had to do was keep the screen on - using a utility like 'Caffeine'.
I have the following setup:
Development machine with VS2015 (can be 2017 if it makes a difference).
Embedded device that runs Windows service in .NET. Device has remote debugging service configured and enabled.
Right now to debug the solution I need to:
Build solution on dev machine.
Log in remotely to device and execute deploy script.
Attach debugger to remote process.
However this is quite a lot of manual steps for every code change. Ideally I would just press F5 and debugger would hit my breakpoints.
I can automate executing deploy script (eg. specify program to start as psexec with arguments), but how do I tell VS which debugger it should use, which host to use, which process?
As the configuration steps is needed while remote debugging, to use script to execute it, you can try the shortcut keys of the corresponding tabs of VS. For example, to open Attach to process window you could use Ctrl + Alt + P, for the process, you could find the Process ID in attach to process window which is same as the PID in Task Manger -> Details.
Im working with VS2010 and TFS and the Coded UI tests (CUIT).
I created some CUIT and added them to several Test Cases in Microsoft Test Manager 2010.
These tests are executed in our build-deploy-test steps.
This looks as follows (simplified):
Build application
Deploy
2a. Set snapshot of the Virtual Machine to which the application will be deployed to the snapshot in which the application is not installed
2b. Install application
Run tests
Step 3 contains Coded UI tests, but they cannot be executed (will fail), since there is no active remote desktop connection, which they need to be executed.
Now I would like to add a build step 2c. That automatically connects to the Remote Desktop so that the Coded UI Tests kan be executed.
How should I create this step in the Process Template?
I attempted this myself by running a PowerShell script to connect to a machine via Remote Desktop (see here to see how to use the Remote Desktop command-line utility).
This didn't really work for me personally because I was running this script from the build machine - which I could only connect to via Remote Desktop - and so when I close Remote Desktop it would close the session on the build machine and thus I would not be able to obtain a remote desktop connection with my test environment (plus it wasn't ideal to have to launch Remote Desktop from the build machine).
Therefore, the solution I went with instead was to enable auto-logon on the test environment (there are various ways to do this, I can't remember how I did it, but it's easily Googled).
So in my PowerShell script, which launched from our build machine, I used a command to remotely restart the test environment. With auto-logon enabled, the test environment would start back up with an active session, then I could carry on with Visual Studio Coded UI testing. This worked for me without any issues.
The command I used was something like this:
Shutdown.exe /r \\mytestenvironment
Here is some documentation for it.. If you intend on using this command to remotely restart a computer, don't forget to give your machine permissions on the test environment, otherwise this command won't work.
I then launched a command to sleep for a few minutes, to give time for the remote test environment to start back up again (with an active session), then I launched the tests.
Personally, I used a PowerShell script but you could also use a DOS/Batch script if you are more familiar with that.
Also, are you trying to run the automated tests as part of a build process template?
Let me know if you need any further help.
I have created a BuildProcessTemplate that invokes a custom compiler. This compiler is normally running inside a command shell. It spawns lots of other processes running in a command shell in order to compile the code in parallel.
Now we are migrating to TFS and would like to trigger the build process from TFS. This works fine using the "InvokeProcess" activity. However, when the InvokeProcess activity is started, the command shells are not shown on the agent computer. They are running in the background. We would like them to be displayed.
Is it possible to somehow tell the InvokeProcess that it should interactively start the process?
Thanks for your help,
Christian
I found the solution...
The Build service on the agent machine needs to be run as an interactive process, not as a service. This can be configured from the TFS Administration Console:
Just tick the "Interactive Process" radio button.
(On this Image both TFS application tier and Build service is on the same machine, which should not be done by the way!)
I have a console app that I am trying to debug using remote debugger.
Clearly it seems you need to first run the application on the remote server, then attach to process.
My question is, whats the preferred method to catch the code at the start of execution, so it won't run away by the time you've managed to hookup the debugger.
Is there an industry standard best practice way to hook in and pause execution at a certain point till the debugger is attached?
There is a way to launch the remote app from Visual Studio.
Go to the Debug tab in project properties window.
Select Start external program and specify the exe path. (e.g. C:\MyTestApp\MyTestApp.exe)
Check Use remote machine and enter the name of the remote machine.
Detailed explanation here.
I couldn't think of a way to attach to a process in remote machine before the process starts. But , have you considered using Intellitrace to see the events and state of your program?
There is a way to attach a debugger to a Application automatically when the application launches. But I am not sure if it would work on remote debugging.
Similarly the System.Diagnostics.Debugger.Launch() would launch a process and start a Debugger attached to it. Again it doesn't support Remote launching and debugging.