I have a lobby application which invokes a client-application (think: League of Legends). They're two separate applications and the first invokes the second from itself - how can I get Visual Studio to debug this application as well?
You simply need to launch a separate Visual Studio, and then use Debug | Attach to Process to attach to the other process. The trick is using two Visual Studios.
Debug -> Attach to process
Select the executable from the list.
Make sure to select the right code type with the Select.. button.
Have you tried Debug -> Attach to Process?
Ref: http://msdn.microsoft.com/en-gb/library/vstudio/3s68z0b3.aspx
Like Matthew said Debug|Attach to process. If the other application is in a different service you might also want to look into remote debugging
The other answers are correct, but I just wanted to add another approach:
If you add both projects to a single Visual Studio Solution, you could:
Right-click the solution -> Properties -> Common Properties -> Startup Project
There you would select Multiple startup projects and select both the Lobby and the Client applications.
That way you can debug several VS projects without having to run several VS instances.
Related
I have solution with 3 projects. Project one - Library. Project two - Service (asmx). Project three - Test. In my service I have two config transform: PRODUCTION and TEST. They are equals, but name of databases is different. My solution:
If I Debug Test with PRODUCTION.config then all right - my breakpoints is active. If I Debug Test with TEST.config then bad. I get this:
What could be the problem? Sorry for my English.
Fixing:
Right mouse click your project
Select Properties
Select the Build tab
Make sure Define DEBUG constant and Define TRACE constant are
checked
Click the Advanced button at the bottom of the Build tabpage
Make sure that Debug Info: is set to Full
Click OK and save changes
Clean solution and rebuild the project
Link to source Fixing “The breakpoint will not currently be hit. No symbols have been loaded for this document.”.
(step 6 generates the .pdb files, these are the debugging symbols)
For more information see next screenshots. Build settings:
Advanced settings of build:
Checked for Microsoft Visual Studio Enterprise 2015 and Microsoft Visual Studio Professional 2017.
I had similar issue and I did the following simply:
Go to Debug => Options => General => Remove the check mark for "Enable Just My Code"
This worked for me.
Another reason this can happen is that if you are sharing multiple projects between solutions and you have set up custom build configurations then simply changing from release to debug on the toolbar (or other shortcuts) can mess up the active build configuration and create all sorts of random consequences.
Make sure that Solution > Properties > Active Config is what you expect ('Mixed' is usually bad) and use Solution > Configuration Manager if in doubt.
I forgot again and the tactics popular on the intertubes did not, of course, work so this is partly a note to self...
Require source files to exactly match the original version
This has to be unchecked.
As a future reference, the same issue can happen when you have the same assembly both in GAC and bin\Debug folder. Just deleting the assembly from the GAC and it works again.
If you're doing multiple startup projects, make sure you have all your services your want to debug set to Start
First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)
I had similar issue and I did the following:
Debug=>Options=>General => Remove the check mark for "Enable Just My Code"
This worked for my vs
Try adding or updating your .csproj file with the tag <DebugType>full</DebugType> inside <PropertyGroup>. This solved my problem.
I am using a solution with several projects (Visual Studio 2015).
In my case, the problem was solved when I realized that one of the projects was being defined with another URL in: Project properties - Web - Servers - Project Url.
After changing to use the same URL as the other projects, the problem was solved.
Image
I am using a solution with several projects (Visual Studio 2015).
I tried several approach. This one worked for me.
In my case, the problem was solved when I realized that one of the projects was being defined with another URL in: Project properties - Web - Servers - Project Url.
After changing to use the same URL as the other projects, the problem was solved.
Image
In my case the project under which the debug breakpoints were not getting hit was also referenced by another solution which was at the time running.
When I stopped that solution the breakpoints started hitting.
If the library happens to be c++ with a C# consumer project actually doing the calling into it, you need to go to Properties -> Enable Native Debugging in the consumer project, and make sure this box is checked.
This can happen if you haven't set the current project as the startup project. In the solution explorer navigate to your project right click and select set as startup project.
This question ...and the answer shows how to start another instance of a console app in Visual Studio when you already have one running.
I want to do the same BUT passing different args[]. For example, when debugging I want to start up 2 instances of MyConsoleApp.exe as follows...
"MyConsoleApp.exe Agent1"
"MyConsoleApp.exe Agent2"
Does anyone know how to do this?
(Using Visual Studio 2015 Pro)
As far as I know you can't. What I'd do is open the solution in two VS instances and run it. Or else you can give it a go the following way too ( haven't tried this but ideally it should work)
Create two console projects and add all your files as 'linked' files on both projects ( the same .cs files being used on both projects)
Go to the solution and set one project as 'Start with Debugging' and other as start without debugging. ( or may be both as Start with Debugging- depending on your scenario) here is how you could do this.
I have a Visual studio solution containing multiple programs, each of which contains it's own Class and Main Method. I need to set these programs up to run one after the other, as some of them access the same database tables, and I do not want there to be conflicts.
I have tried setting up dependencies and creating a new program with class dependencies, however, this does not seem to have worked, does anyone have an idea?
Right click on your solution > Properties > Common Properties > Startup project
Select "Multiple startup Projects" and change the value of the Action column from "None" to "Start" or "Start without debugging"
Visual Studio is a development tool. It is not a tool to orchestrate how your application should execute. Your application should also function when executed outside Visual Studio.
With that in mind you need to decide how to partition your application. Right now you seem to have several applications (console programs?) that need to execute one after the other. An easy solution is to create a batch file that executes each in turn. You can also create a separate application that execute each "child" application in sequence using the Process.Start method but why bother when you can create a batch file?
You might also consider merging your different applications into a single application that has a Main method that executes each task in sequence.
Without more information about your problem it is hard to give you specific advice.
You mentioned you have tried "Multiple Startup Projects" approach but did you set the order in which multiple projects run when you start the debugger?
To set the order in which multiple projects run when you start the debugger
Open the Solution Property Pages dialog box.
Select the Startup Project set under Common Properties.
In the pane on the right, select Multiple Startup Project.
Select a project, and then click Move Up to run that project earlier when you start the debugger, or click Move Down to run the project later.
Reference: How to: Modify Project Properties and Configuration Settings
You need run each program in separate Visual Studio instances.
I have two web applications in the same solution. I put break points in both of them and when debug I can't access but the start up one. How to debug both of them?
Just right click on your project solution in visual studio then go to properties and in Common Properties > Startup Project select Multiple startup projects. Then choose the appropriate action.
That way you will be able to debug both
You can have only one active project at time of compilation/running. By the way, if one active project somehow calls something from another, just press F11 and you will jump into another project and symbols for it will be loaded automatically and you can debug it.
EDIT
If you are asking about debugging 2 projects contemporary in parallel, it's not possible with in one VS. If these are the separate projects that communicate with eash others, let's say chat application, you can naturally, by running two instances of VS and debug communication between them.
Hope this helps.
You should try to open two versions of visual studio, run both solutions, but set the start up project differently for each, and run them both. The two instances of visual studio should catch the break points of their respective start up programs. I know this works for windows/console applications. Although I've never tried it with 2 web applications. You may have to configure the applications to use different ports.
I have multiple projects in one solution. Project A (the starting project) starts Project B using Process.Start.
All the debugging methods work fine in project A, however after A starts B, not only do breakpoints not work, but also the output from calls to System.Diagnostics.Debug.WriteLine is not displayed.
Does anyone know how to debug in this situation?
In this scenario you have 2 processes running and you need to attach Visual Studio to both of them. Visual Studio supports attaching to multiple processes and getting it to do so is the same as attaching to a single process. Once the second process is launched do the following
Tools -> Attach to Process
Select the process
Hit Attach
The new process which is created at runtime will not have the debugger attached hence breakpoints and debug.writeline won't work.
You might be able to select "Debug" menu then "Attach to process" from within Visual Studio once the new process is running.
You are debugging the process that Project A is working and because you are starting a second process for Project B you have not attached your debugger to that process. So you need to attach to the second process.
You could add an call to System.Diagnostics.Debugger.Launch(); in the Main from Project B. So every time you start Project B it will ask you if you want to attach a Debugger.