Debugging different projects in VS6 - visual-studio

I have 3 projects in a VS6 workspace.
One is the main program, which calls - depending on configuration - one or both other progams. To call the other programs a exe is executed.
If I want to debug and set breakpoints in one of the subsequent programs, I get an error that breakpoints could not be set and have been deactivated.
Are there any VS6 settings I can check?
This is a legacy tool and neither the architecture nor VS6 can be changed. To make things worse I am not very familiar with VS6.

I don't remember exactly the behavior of VC6, but i think you can start 3 instances of Visual Studio, each containing one of the projects (you'll have to create 3 different workspaces). Within each instance you can debug one program. This at least worked with later Visual Studio 2005.

A common reason for that error is if you have set one or more of the components to build in Release mode. Make sure that they're all set to build in Debug mode.
Can't remember where those settings are I'm afraid, but I think they're fairly easy to find (under some project menu?).

Related

Debug Multiple Microservices in Visual Studio

I have a solution which contains two microservices and an API gateway. While debugging, the solution requires to run again and again to get insights or fix bugs.
I have tried dotnet watch run but with this I can attach debugger to one project at a time.
Hosting applications on IIS also requires to copy the files to folder every time for small changes as compared to in .NET Framework where it was easier to host applications on localhost and attach to process.
Currently, I have been debugging it using visual studio with multiple startup projects.
Since pressing F5 constantly is repetitive and hectic so is there any other way around to debug multiple projects using dotnet watch or IIS or anything else?
ctrl+F5 can run multiple, but it will not debug. Other solution try run multiple VS studio, but I'm not sure
There is possibly another way. I was also had issues running multiple projects to debug microservices.
I explored a few possibilities:
Docker - didn't help and ate more memory (if our whole stack was .net core this might be the goto)
Auto starting VS projects with a script (better but not quiet the level of control we needed)
Researched all the things that people said (use logging, do tests etc, all of which ignore the fact that we don't all have perfect codebases to work in)
Finally I created something that works well for our team, and maybe it'd work for you?
Dev Launcher is a simple command line utility that you configure with your project information. It's currently aimed at handling .net full framework, runs in (Visual Studio) and .net core runs with (Visual Studio or dotnet run). It is configurable and I'm guessing a person could get it to work with other IDE's such as VS Code, though I haven't tried it.
The main concept is you first choose the projects you'd like to open for debugging. These projects will open in the IDE which is configured (Defaults to Visual Studio). Then you choose the supporting microservices that you'd like to run in the background. If these are written in .net core they will run in a console window, freeing the memory that would normally be consumed by the IDE and debugger.
Curious to see if that'd be helpful for your situation. Also curious what other ideas people have to make debugging multiple microservices better...

Multiple projects: symbols seem to be unloaded

I have a WebApi project, and an MVC project that consumes the WebApi project through RESTful calls.
I set my VS 2013 Professional system to start both projects at the same time.
If I run either project alone, I can set and capture breakpoints. If I run both projects, only breakpoints in the WebApi project are available. How do I fix this? As far as I can tell, there are no version issues with any common assemblies, and the multitude of answers on SO do not seem to apply.
So apparently the answer is shouting curse words at your monitor. After restarting IIS Express, Visual Studio, and my machine multiple times, Cleaning the solution multiple times, changing the build config back and forth multiple times, it just started working all of a sudden. No code or configuration changes. Whoever said insanity is doing the same thing repeatedly and expecting a different result was clearly not a developer. Either that or I'm insane. (could be both)

Visual Studio hangs constantly during build

Probably between 25 and 50% of the times I build my solution, I see this:
"The operation you requested is taking longer than expected to complete. This dialog will close when the action completes."
I hate this window in ways I can't describe. It never resolves, the Cancel button is never enabled, and the only way to remedy it is to kill the devenv process and load up my entire solution again, knowing full well that I've fixed nothing and I'm equally liable to see the same thing when I attempt my build.
My solution is about 60 projects in total, which are mostly C# class libraries, with a few each of web applications, web services, and console applications. However, the problem persists even when building one slice of the codebase with the majority (50) of the projects unloaded.
My problem is that the output windows doesn't tell me anything at the point at which it freezes, and I don't know how else to determine the cause of this lockup. If I were to guess, I would assume that it's a deadlock in the filesystem or something, but I don't know how to go about proving this--much less how to prevent it.
What can I do to diagnose and eliminate this from my solution so that I never see it again? In general, how can I diagnose problems that occur during a build?
Had a similar issue, VS would hang for 45 or so seconds then build for 4 seconds and complete. The 45 seconds of hang would not produce any output to GUI and VS would hang.
Using ProcMon I could see 3 million+ file operations on the /packages/ folder via devenv.exe when I would build this project (and would continue for some time after)!! The first steps of the build you can see that it was checking EVERY PACKAGE to see if it needed to do a package restore (it did not).
Since I tend to blame NuGet for everything, I disabled NuGet Package Restore "allow NuGet to download missing packages" checkbox under Visual Studio -> Options -> Nuget Package Manager -> General. To my delight, the build was very fast. 5 seconds total!
Turns out that we had enable package restore on build enabled (I think this is on by default now in VS) AND we also had the packages checked into source control. It seems this causes TFS to thrash in some way... Checking for restoring packages must trigger TFS to do some source control operation checks.
FYI this was VS2013 UPDATE 4 - Nuget version: 2.8.50926.663, on a sln with NumberOfProjects = 38, but I could recreate this hang just building a single csproj with 2 dependencies.
Update:
Localhost "Rebuild All" on Sln with SccNumberOfProjects = 53 was taking 7:05 with 2 minutes of visual studio frozen / unresponsive
down to 4:14 on a 2 core i5 with no freezing
down to 2:44 on a 4 core i7
Also: This was on a machine with various file watcher security tools, likely not adding any speed to this whole process... and possibly to blame.
Update in 2021:
If you are looking for a paradigm shift, the new SDK style csproj format (see migration tool) + nuget PackageReference makes updates almost instant (< 20 SECONDS for same projects in scenarios above) - highly recommend you upgrade any legacy projects.
** Known incompatibility - website package references do not support static file references via nuget ( checkout LibMan)
I have seen this happen on large projects when MSBuild is running with the diagnostic switch turned on. In Visual Studio, go to Tools / Options / Projects & Solutions / Build And Run, then check the MSBuild project build output verbosity value. If its not set to Minimal, try setting to minimal and see if your builds are able to complete.
I did not try any of the above solution as by the time I tried my approach - all was well again.
My steps are as following:
Close VS
Delete the .vs folder
Open my solution
Clean Solution OK
Build Solution OK
Optional Rebuild OK
In my case setting "maximum number of parallel project builds" to 1 kinda helped (i.e. building a project from clean state causes 1 min freeze followed by normal build and every subsequent build works fine).
Aforementioned setting can be set in Tool -> Options -> Projects and Solutions -> Build and Run.
Seems like running Visual Studio as Administrator solved the problem for me! (For always running a program as Administrator see How to Run Visual Studio as Administrator by default)
I've found Visual Studio hanging a lot on building larger projects. Turns out it was ReSharper. After I turned it off: Tools -> Options -> ReSharper -> Suspend Now, everything built fine no issues (even on very large solutions, 100+ projects)
There was a suggestion on Microsoft Connect that Modelling project was responsible for the freezes. I removed a Modelling project from our solution and have experienced no freeze since then (about a week).
For me it was something to do with npm package install that ran automatically. I went to Tools > Options > Project and Solutions > External Web Tools and unchecked all external tools and restarted VS. After that, I was able to build it again. I know I need them to be checked but I need to figure out what's triggering them and what's wrong with this solution file.
VS2019 exhibits this issue as well for me, in my case, the problem was because of dependencies stored on a network share. I have a hunch that Windows Defender Antivirus was scanning a lot of extra stuff that was in the network share, which is only accessible when connected to a fairly slow VPN.
For me the issue was witch an extension that automatically runs T4 templates on build (AutoT4). Disabling it when working with solutions with EF fixed the issue.
I moved my VS 2008 development platform from Windows 7 to Windows 10 and encountered a situation where Visual Studio would hang up every time I tried to build a large project. I had to build the project, then use the Task Manager to kill VS and then restart. Needless to say, this made debugging really difficult! Anyhow, the problem was that in moving to Win 10, VS was no longer running as administrator (and perhaps Win 10 is more particular about privileges). Changing the properties so that the program ran as administrator resolved the problem. (IngoB -- I don't have enough status to comment on your post, but thanks for pointing this out!)
Just try below command with admin mode. Before running this command make sure to close all VS instance.
devenv /resetuserdata
Note: devenv is located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
In addition to the felickz's answer which solves (or almost solves) this problem for builds:
Except the problem during a build I also had problem with the Package Management Console. It took about a minute to wait for it. Using the procmon I found that the NuGet repository folder was parsed each time this window is opened (very smart, Microsoft!). There were about 1000 packages in this folder. After removing everything from the above folder the performance problem diapered.
Note that my answer relates to the VS 2015 (and may be below). I didn't tested, but suspect in VS 2017 it should be ok.
Visual Studio 2017
Removing Anaconda3 from the installation fixed it. In procmon I saw hundreds of thousands of calls looking for files in the Anaconda3 folder from hundreds of instances of powershell spawned by msbuild.
I had this problem because of an issue restoring nuget packages. There was a duplicate entry in the packages.config file. Rather than report it as an error, the build would just hang forever.
I didn't discover the problem until I tried to restore the nuget package through the "Manage Nuget Packages..." option in the menu. After removing the duplicate, the build completes properly.

Disabling the *.vshost.exe and miscellaneous files from being created on build

I found the following information about the Microsoft Visual Studio "extra" files:
What is the purpose of the vshost.exe file?
My question is, is there a way that I can NOT have the .pdb, .manifest and vshost.exe files from being made? Or are they absolutely necessary?
I just noticed that after debugging it, it's still showing up as a running process in my machine which worries me since I already closed it.
Switch to the Release configuration. Then Project + Properties, Debug tab, untick the "Enable the Visual Studio hosting process" option. Build + Clean, you can delete anything that's left and it won't come back. That this option is turned on by default for the Release build is, arguably, a bit of a flaw but defensible.
The hosting process is a custom hosted version of the CLR. Exactly what it does is not well documented but it is related to configuring the security settings of the primary AppDomain. I've never heard anybody complain about battling CAS problems without it, but then it is unusual to turn it off and your app almost always runs in full trust when debugging from the IDE. It would matter if you build to a network share on early versions of .NET. The only thing that's obvious from disabling it is that anything you write with Console.Write in a gui style app will no longer appear in the Output window. It has nothing to do with speed as claimed in the highly upvoted answer in the link, the core framework DLLs are already resident in RAM since VS and MSBuild uses them.
Best thing to do is just not worry about it too much. A Setup and Deployment project will ignore it.
Regarding vshost files, at least in VS2010:
They are not generated on build, but on selection of build configuration (it will be generated in release when we select release for the first time) and on setting "Enable the Visual Studio hosting process" to true. (As configuration debug and this option set to true are defaults, vshost.exe will be created in bin/debug on opening VS with target project by default.)
They are not cleaned on rebuilding or cleaning the project, but only manually when "Enable the Visual Studio hosting process" is false if VS with that project is open. (And it won't be generated anymore when opening this project.)
If this flag option is true and VS with target project is opened, this file cannot be deleted as being used. Once when it is unchecked, vshost.exe can be immediately deleted.
Summary: Generating and removing these files is not related to build process.
Also, I may add that option "Enable the Visual Studio hosting process" in referenced projects which are class libraries is not considered. This option is only considered for target project which generates executable file.

Visual Studio 2010 Debugger jumps around

I have a simple C# Winforms application. It isn't multi-threaded (yet). When I debug it and step through the code at work, it debugs just as expected with the debug cursor moving line by line. But when I try doing this at my home computer, it behaves very erratic. The cursor will randomly jump to an unrelated line of code in the middle of another method that hasn't even been called yet etc.
The differences are:
At work I use VS2010 Professional, at home I have VS2010 Ultimate
At work, I use Win XP, at home I use Win 7 Ultimate
At work, its a dual core Athlon, at home a quad core Phenom II
Your symbols file might not match your source. Try deleteing your /bin folder and rebuilding the solution.
Make sure that the project configuration is set on Debug (not on Release!):
If you use other Projects too, make sure to go to Build => Batch Build and check if you build those other projects that you run as well
I'm not sure which one will work for you but you should either tick the Build option or by Modifying Solution Config from Release to build,also you might need to delete your Bin Folder and Build from scratch.Then eiter click on build or do it from Solution Explorer. As shown you can Build other parts of the project and Debugger works rationally again.

Resources