Stop Visual Studio from launching a new browser window when starting debug?

[Origin]: https://stackoverflow.com/questions/716494/stop-visual-studio-from-launching-a-new-browser-window-when-starting-debug

I already have a window open with the web site I’m debugging. I don’t need VS to launch another one for me every time I need to debug.

Is there a way to stop this behavior?

shareedit

Open your startup project’s properties (Project->{ProjectName} Properties… from the main menu or right click your project in the Solution Explorer and choose Properties), then navigate to the Webtab and under Start Action choose Don’t open a page. Wait for a request from an external application.

You will still be able to use any browser (or Fiddler, whatever) to access the running application, but it won’t open the browser window automatically, it’ll just start in the background and wait for any requests.

shareedit
Advertisements

Running two projects at once in Visual Studio

[Origin]: https://stackoverflow.com/questions/3850019/running-two-projects-at-once-in-visual-studio

I created a solution in Visual C# 2010 Express that contains two projects: one is the client, the other is the server. I would like to debug both at the same time, but I can only seem to run one of the projects during debugging.

Is there a way to run both at once?

shareedit

Go to Solution properties -> Common properties -> Startup Project and select Multiple startup projects.

solution properties dialog

shareedit

Max has the best solution for when you always want to start both projects, but you can also right click a project and choose Debug > Start New Instance.

This is an option when you only occasionally need to start the second project or when you need to delay the start of the second project (maybe the server needs to get up and running before the client tries to connect, or something).

shareedit

“The breakpoint will not currently be hit. The source code is different from the original version.” What does this mean?

[Origin]: https://stackoverflow.com/questions/2468852/the-breakpoint-will-not-currently-be-hit-the-source-code-is-different-from-the

When debugging in Visual Studio, sometimes I add a breakpoint but it’s hollow and VS says “The breakpoint will not currently be hit. The source code is different from the original version.” Obviously this prevents me from being able to debug.

What on earth does the message mean? What original version? If I’ve just opened up the solution and not made any changes whatsoever to the code, how can there be an ‘original version’?

shareedit

As it says, the “source code is different from the original version”.

Right click on the project folder inside the solution explorer and choose to Clean. Build a new version of the project and the breakpoint will work again!

shareedit

Select Debug in Solution Configurations, instead of Release

screenshot of menu

shareedit

If you have more than one projects in your solution, then make sure that the correct project is set as the StartUp Project. To set a particular project as the Startup Project of your solution, Right-click the project, choose Set As StartUp Project.

After I set my StartUp Project correctly, desired break-point was reached by the thread.

shareedit

VS2015 The breakpoint will not currently be hit. No symbols have been loaded for this document

[Origin]: https://stackoverflow.com/questions/36445717/vs2015-the-breakpoint-will-not-currently-be-hit-no-symbols-have-been-loaded-for

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:

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:

The breakpoint will not currently be hit

What could be the problem? Sorry for my English.

shareimprove this question

Fixing:

  1. Right mouse click your project
  2. Select Properties
  3. Select the Build tab
  4. Make sure Define DEBUG constant and Define TRACE constant are checked
  5. Click the Advanced button at the bottom of the Build tabpage
  6. Make sure that Debug Info: is set to full
  7. Click OK and save changes
  8. 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)

shareimprove this answer

Debugging JavaScript Using Google Chrome

[Origin]: http://www.c-sharpcorner.com/UploadFile/3d39b4/debugging-javascript-using-google-chrome/

We are working with data and data are storing in JavaScript variables. We need to see what value is passed to the function and how the value is manipulated and what result the value is producing so we need to debug the JavaScript function to trace a variable value line by line. In the previous article I explained how to debug a JavaScript function using Visual Studio and Internet Explorer; that article is:

Debugging JavaScript Code Using VS and IE

So now we go through step-by-step to debug a JavaScript function using Google Chrome.

Create UI Design and Develop Functionality for Addition

We create a UI Design that takes two values and calculates the addition of these two values on a button click.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type ="text/javascript">
        function AddNumber()
        {
            var result = document.getElementById("<%=lblResult.ClientID %>");
            var firstNumber = document.getElementById("<%=txtFirstNumber.ClientID %>").value;
            var secondNumber = document.getElementById("<%=txtSecondNumber.ClientID %>").value;
            var addition = parseInt( firstNumber) + parseInt(secondNumber);
            result.innerHTML = "Addition is :" + addition;
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    Enter First Number : <asp:TextBox ID="txtFirstNumber" runat="server"></asp:TextBox><br />
    Enter Second Number : <asp:TextBox ID="txtSecondNumber" runat="server"></asp:TextBox><br />
    <asp:Button ID="btnAdd" runat="server" Text="Addition" OnClientClick="javascript:return AddNumber();" /><br/>
    <asp:Label ID="lblResult" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>

Value Input Window

image1.png

Add Debugger in the JavaScript function so the cursor can hit here whenever the function is called.

image2.png

Setting and Debug In Google Chrome

Go to “Tools” then click on “JavaScript console”.

image3.png
image4.png

Run the application and insert values into the input fields then click on the “Addition” button. The cursor will then reach the debugger in the source tab under the JavaScript console window.

image5.png

In this function we declare several variables and on starting, these variables are #ff0000; check the Scope Variables panel in the Right Pane.

image6.png

Click on F10 and move forward line by line, then check the value of the variables using a mouse move on that variable.

image7.png

We can also check data in the scope variables window.

image8.png

We can also check for an error in the JavaScript code. For example we don’t define a variable and use that variable. I have a variable firstNumber and use the myfirstNumber variable to parse in an int type but instead firstNumber is undefined.

image9.png

We can insert a breakpoint by double-clicking on line number or using right-click of the mouse, then click on “Add breakpoint item”. When we use a breakpoint we don’t need to define the debugger in the JavaScript function and the cursor will hit the breakpoint directly.

image10.png

We have the Breakpoints window where the line with the breakpoint checkbox checked will be shown.

image11.png

Breakpoint not hit when remote debugging on Internet for ASP.NET

[Origin]: http://stackoverflow.com/questions/385826/breakpoint-not-hit-when-remote-debugging-on-internet-for-asp-net

I have sit up remote debugging on a Window 2003 server accessed through the Internet. I have VS 2008 SP1 installed on my XP dev box.

I launched the site on the remote server and attached to all the w3wp.exe processes on the remote server. I noticed that the .dll did not load the symbols file. When I try to load the corresponding .pdb file from my local machine, it says file does not match. I have “Require source files to exactly match the original version” unchecked. The assembly on the remote server is the same as the one on my dev box. The site and .dll was copied from dev boc to remote server and code hasn’t changed since. So I know .dll and .pdb files should match or at least I need to force the matching.

Questions:

  1. How do I get the .pdb file to load? I know breakpoints won’t trigger unless symbols file is loaded. I noticed that the .pdb file does not exist in the “Temporary ASP.NET Files” folder on the remote server. The .dll does.
  2. What’s the proper sequence to start debugging remotely inside VS? (Remote set up is done and I can see remote processes). In VS, I have start page as the url of the remote site. I start without debugging and then attach to w3wp.exe(s) on the remote. Is this all?
shareedit

Are you running a Web Site or a Web Application (is it a compiled project, that you deploy the DLL for, or a collection of aspx and aspx.cs files that you deploy)?

If it’s a Web Application, did you deploy a release build, or a debug build? You won’t be able to hit breakpoints when “debugging” a release build, as the code is fairly heavily optimised.

Have you got “debug=true” set in the web.config compilation section? If not, again, debugging is going to be difficult.

Finally, the steps I use when remote debugging are:

  1. Deploy latest debug build of files
  2. Request page on remote server to start/restart application
  3. Ensure that the VS Remote Debugging Monitor is up and running on the remote server
  4. In VS, go to Tools (or Debug) | Attach to Process…, ensure that the remote server is selected in the Qualifier, and select w3wp.exe for the correct app-pool, etc.
  5. Request page that will fire break point.
  6. Debug!

If the breakpoints are hollow (thin red circles rather than filled disks), I’ll often check the Stack window in VS to see what has and hasn’t been loaded.

shareedit

IIS process w3wp.exe is not showing in Task manager processes?

[Origin]: http://stackoverflow.com/questions/24217446/iis-process-w3wp-exe-is-not-showing-in-task-manager-processes

I am having a very weird issue that I am unable to see w3wp.exe anywhere in my system. I am learning ASP.NET using tutorials. In my computer w3wp.exe process is not showing in the taskmanager. Please help, I got frustrated by searching it throughout the whole day. I have iis7.5installed!

shareedit

Try refreshing or showing all processes – I believe it’s a checkbox option.

Then, refresh your browser and go for the attach to process option.

shareedit

The w3wp.exe will not appear until the first request has entered the pipeline. So if you browse to your site and then open your task manager, you will see the w3wp.exe.

shareedit