Best practices remote debugging using VS2010 under VS2013 - visual-studio-2010

I'm looking for tips for those who to develop for Windows XP embedded in Visual Studio2013, then debug in Visual Studio 2010.
The reasons for this are discussed in this Stack Overflow Link on the topic.
Essentially the remote debug protocol changed after VS2010, and the new msvsmon.exe which uses the new VS2013 protocol doesn't support XP embedded debugging. So we are forced into a TWO IDE solution, one for builds, another for debug. VS2013 is used for builds, and VS2010 is used to launch remote debug sessions.
There is some misinformation about the requirement to purchase both VS2013 and VS2010. It appears from the previously mentioned link, that it's possible to obtain the VS2010 debug environment for free. I was able to verify the free download of the components, but haven't had time to validate that the debug environment works. The environment I use consists of a licensed copy of VS2013 and a licensed copy of VS2010.
Here are two initial problems which I haven't seen doing remote debug in the former VS6 msvsmon.exe environment:
1) With VS2013 build projects, VS2010 does not want to open the *.sln file. If I open the VS6 .dsp/.dsw we ported from VS2010 does a "ONE TIME CONVERSION" which destroys my painstakenly built VS2013 build project.
It seems I will have to build TWO different solution spaces, one named SOLUTION_NAME_VS2013 and another SOLUTION_NAME_VS2010. I'm interested to know if there is a more elegant solution to manage 1 set of BUILD files with two different "Highlander" (there can be only one) IDE's.
2) When starting up the project remotely, if it crashes I get one of those annoying "Your program has crashed" dialogs on the Win2012 debug host (running VS2010), which is trapping the crash signal from the debugger. About 30% of the time, it detects the running instance of VS2010, 70% of the time it doesn't.
3) msvmon times out (needs restarting) and requires extra time/mouse clicks to setup over the old vs6 msvcmon.exe
I'm wondering if other Windows Embedded developers have discovered elegant solutions for these issues. I'll post what I find here if I find any more tips moving forward.

For Issue #1: Unable to read VS2013 *.sln file in VS2010.
The problem was that the VERSION of Visual Studio 2010 must be at least SERVICE PACK1. Earlier versions of Visual Studio 2010 cannot read the VS2012/VS2013/VS2015 solution files.
For Issue #2: Your program has crashed dialog preventing signals from reaching debugger.
This Stack Overflow link was helpful. There are multiple ways to suppress the "Your program has crashed" dialog. In my case, users may need to debug new applications on a production system, so changing the setting globally is not ideal.
I choose the solution from this Raymond Chen link it allows me to disable the dialog box on an application by application basis. Since I typically have access to source code I'm debugging this was the best solution for me.
DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX);
I still see an issue occasionally with the Windows runtime not seeing the running debugger instance on a crash and wanting to initiate a new one. This seems to happen ~30% of the time. When I figure out what is causing that I will update it here.
Finally, the new remote debug client changed to msvmon.exe which has improved security. To save the extra mouse clicks, the following command is usefull to run on the remote Windows Embedded XP client:
"Path\to\msvsmon.exe" /anyuser /noauth /nosecuritywarn /timeout:2147483646
The /noauth and /anyuser require /nosecuritywarn. /timeout max value keeps the debugger client from terminating after ~ hour of idle time. If your workday is to be spent debugging you don't want it timing out after a coffee/rebuild all break.

Related

Windows Forms application responds very slowly when Visual Studio debugger is attached

I recently changed my work computer and I'm struggling developing with Visual Studio 2019.
This is a simple operation that highlights the problem. This happens when application is in debug mode with debugger attached.
As soon as I detach the debugger (Debug > Detach all in VS) the speed returns to normal. Speed is OK also with the installed version of the software. I tried using the Performance Profiler to see where the time is going but since the debugger is not attached in that configuration speed is fine there too.
I must add that only some operations, like the one pictured, are incredibly slow. In many cases the application runs as smooth as the installed version.
I've compared every option under Tools > Options > Debugging with my previous computer and one colleague and they match perfectly. The operating system is the same, Windows 10, and the installed version of VS is the same.
I tried cleaning the build, removing the .vs folder, repairing Visual Studio with no luck. I've always used a desktop PC (my last one was an I7 8xxx), the new one is a laptop with Ryzen 7. Other colleagues have a laptop with Intel processors and they show no issue.
Any help would be greatly appreciated.
As pointed out by Hans Passant in a comment, this was due to an excessive amount of lines written in the debug window. Lines of log written to an external file (via an Enterprise Library logger) were echoed in the debug window, so I think the whole process was waiting for that window to be constantly updated.

Windows Defender Real Time Protection Service slowing down Visual Studio etc

Since past two months or so I have been observing a strange phenomenon with the Real Time Protection Service that comes bundled in as a part of Windows Defender on Windows 10.
When this service is set to ON Visual Studio builds take an excruciatingly long time to complete. Visual Studio itself takes forever to launch. Further if there are managed add-ins (written using Visual Studio Tools For Office, VSTO) installed in Outlook, Outlook takes 13-14 seconds to launch! When this service is disabled Outlook again launches within two seconds or so.
I have raised this on Twitter with Windows Support and tried discussing this online with Microsoft Support for an hour without any resolution. Looking around the internet I can see there are users who are reporting same problems such as
http://ardalis.com/speed-up-visual-studio-build-times
Slow page refresh times during development
I have been noticing this for only two months or so. I have tried spinning up new VMs in Azure etc. to test this and in every instance I have noticed this Real TIme Protection Service to be the culprit. My main issue is the Outlook Add In load time to be honest.
I tried posting this on Microsoft answer's site here but so far no luck. I was hoping if anyone here knows how to get this resolved without adding exception for Outlook in Real Time Protection Service (after which the add-ins load as expected within 200 milliseconds).
I had the same symptoms and my problem was fixed by disabling logs in Microsoft .Net Framework Assembly Binding Log Viewer (FUSLOGVW.exe). I forgot that I was running a test and left logging on.
Run the viewer as administrator.
Click Settings button.
Check Log Disabled
Try excluding Visual Studio related file types from Windows Defender like this person did for Delphi:
If you are cool with no protection at all you could disable Windows Defender, but I wouldn't recommend it.
Another answer to this problem, rather than excluding certain file extensions from Real Tme Scanning, is to exclude certain directories. Then you can exclude your Delphi/Visual Studio/Eclipse workspace.
I also found that certain apps during development make heavy use of the tmp dir. You can create a specific temp dir for your dev work and then configure your IDE/dev tools to use that temp dir instead of the system one, and then exclude that temp dir from real-time scanning.
Here are two links to fix performance issues caused by Real-Time scanning, by excluding VS processes and Folders,
thus improving the performance of VS in general but especially when Building.
1- Ready PowerShell script:
Adds Windows Defender exclusions for Visual Studio 2019 by Ryan-Efendy
PS: by default executing scripts is disabled, just enable before executing, and disable after executing
Set-ExecutionPolicy unrestricted
run command
Set-ExecutionPolicy restricted
2- Same but you have to do the steps manually.
Tweaking the environment to speed up Visual Studio by Burak Tasci

Visual Studio 2010 (devenv) Hung Process After Closing

I have problem with Visual Studio 2010 on Windows 7 64-bit. After some time of work VS starts consuming ~50% CPU and UI responding slows down. When I close VS then UI disappear but process stay.
When I forgot to kill those hung processes at the end of day, I will end up with numerous devenv.exe processes.
I have reinstall Visual Studio and reinstall Windows and ended up with the same problem... doesn't change anything. Please help. :/
Remove and/or uninstall all third-party Visual Studio add-ins and extensions. Disabling is not good enough.
Visual Studio 2010 relies heavily on graphics. Therefore:
Update your video driver.
Turn off "Enable rich client visual
experience"
Turn off "Use Hardware graphics acceleration if
available"
There are also temporary files that Visual Studio uses that may need to be cleared out.
Clear out your %temp% folder.
Clear out %AppData%\Local\Microsoft\WebsiteCache
Clear out %AppData%\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies
Your project and solution user settings may be corrupt due to so many "crashes".
Delete .user and .suo files (you will lose the startup project, bookmarks, breakpoints, and other user settings specific to projects and solutions.)
Begin where you began before - it may seem overkill but this is the only way to be sure we are addressing everything short of hardware issues.
Reinstall Windows - make sure you are using a validly licensed copy, and patch the hell out of it before installing Visual Studio.
Note: I doubt it is a GPU driver issue, but it never hurts to use the most up to date driver and this is the place to do it right after a fresh OS install.
Install Visual Studio .Net 2010 but do not start it up. Let it get the frameworks installed fresh.
Use Windows Update to install the VS 2010 SP1 patch, and any/all patches for .Net frameworks.
Make an images for yourself right here so you have something to build from if you need to try this again. It will save you lots of time.
Fire up Visual Studio, and test your closing before installing anything else.
If it does not work here, there's likely some conflict between PC hardware and window OS, and you should try to find this symptom in other applications to get more info.
Here's what i would be looking for:
Does it happen EVERY TIME?
Does it happen after you debug your project ? does it happen for ALL projects?
Does it also happen when you don't load any projects? (simply start the IDE and wait).
Does it happen after a debug session of your application? maybe the application is not closed properly?
Do you have any other apps running at the same time that may cause this? try reproducing with a minimal set of apps/services running.
What are you doing exactly when it starts freezing ? anything in particular?
I would try to get 2-3 memory dumps at the time of hanging, post it here as well as to MSFT people. That would be a good start.

Debugging Classic ASP causes Visual Studio 2008 to crash - how can I fix this?

I'm debugging classic asp code using VS 2008 sp1 on windows 7. Everything works great, I attach to the process and can debug. However, If I stop debugging visual studio will crash.
I read the recycling the app pool would help, but it has not helped me end a debugging session with out crashing. I have hunted through Google and stack overflow for a solution, but so far I've mainly found complaints.
Has anyone figured this out?
Coworker found answer:
http://code.msdn.microsoft.com/KB967631
This QFE fixes three complete separate issues in the VS2008 SP1 Debugger:
Debugger can hang the IDE after setting a breakpoint when working with a large C++ project
Breakpoints do not bind correctly when an MSIL file is built containing .line directives
VS crashes when debugging a classic ASP web and debugging is stopped.
I have had this same problem and the conclusion I came too after scouring the web and reading other user's stories is that VS 2008 has a bug when debugging classic asp! It crashes when you stop debugging. Sort of a time killer to have to restart VS every time you debug.
I have had to resort to using VS2005 to open classic ASP projects and debug them there. If I need to have the ability to work on an app in both 2005 and 2008 I've found that you can have 2 separate solution files, each created by the applicable app (for example I've got appName.sln that I open in VS2008 and then appName2005.sln that I open in VS2005). You will need to create a new solution in VS2005 and add the files, then save that solution with the slightly different .sln filename. This works, it just takes a bit of time to setup.
Supposedly MS is going to resolve this issue in VS2010 but they didn't consider it an important enough problem to issue a patch for VS2008.

Browser keep stopping with user breakpoint and opens visual studio 6 in debug mode

Following my last question (see: Problem in hosting ActiveX on Vista (in a Visual Studio 6 C++ application)) I ran into a strange problem. I hope this’ll be a simpler issue to the experts here:
Each time I run certain application like iexplorer or firefox, the Visual Studio 6 suddenly opens up in debug mode with a message “User breakpoint called from code at 0xSOMETHING”.
I can press F5 to continue but the applications run slowly and needless to say I have no wish to debug these applications…
My guess is that when I worked on my VC++ application I placed breakpoints at windows methods like CAxDialogImpl::Create(), AtlAxCreateDialogA() etc’, and for some reason it was kept somewhere.
Of course I now removed all the breakpoints and re-compiled the project but still this keeps happening!
I checked in the tools->options but the “Just-in–time debugging” is not marked.
Any idea?
(I use Visual Studio 6 which I installed on Vista)
Thanks a lot,
Erik
Not sure this helps but anyways:
Try disbaling the default debugger option. (It says Dr. Watson but it depends what you have set as the default debugger)
http://www.bridgetonova.com/2007/09/how-to-disableenable-windows-default.html
Also as per this post Visual Studio 6 is not supported on Vista. Only Visual Basic is.
http://www.itwriting.com/blog/167-visual-studio-6-on-vista.html
You should probably re-ensure yourself that you have removed all calls to DebugBreak() and manual break-points. Also try to ensure that when you recompile you re-register everything to point to the right places (i.e. the activex pointed to by the guid in the registry is actually the latest recompile).

Resources