VS2010 C# ASP.NET App won't hit breakpoints during debugging - c#

I have a solution that consists of a Class Library project and a remote web site.
I start the debugging and the page comes up and if I make changes to the source I can see them happen on the page that's in the debugger ... but I can have a breakpoint on the first line of the Page_Load and it still won't hit. Same things goes for any breakpoint in the Class Library's codebase.
I've debugged other applications off this server successfully before ... but have hit a wall with this one.
What am I doing wrong?
Both projects have are .NET Framework 4.

If the breakpoint isn't marked as a full red circle, either no symbols have been loaded for the type or the code you're debugging is different to what you have in your editor.
If the latter, you can right click the breakpoint and select allow source to be different... checkbox

I decided to try a few more things to get this working so I first did a fresh Open >> Web Site ... so that I had a solution with just the remote web site and tried debugging and that worked. So, decided to try living a little dangerously and then added the Class Library project back and tried Debugging again and it worked for both the .aspx.cs files and the .cs ones from the Class Library!
Don't ask me to explain it ... the only thing I did differently is that the first time around I started with the Class Library, added the remote site and then set the Web site as the Startup project. Should work the same, you'd think ... but I'm not gonna question it

Have you tried to use internet explorer ? if your in an different navigator.. you must attach that navigator processus to the debugger in order to debug.

Related

CSS / NavMenu suddenly stopped working on my Blazor App on Chrome

I was working on different apps on my Visual Studio Code, so i was debugging two different applications. However, the CSS effects and NavMenue suddenly disappear from on of them and when I debugged it, I got like the following picture.
In the debugge console i got this :
I've not changed anything in the code. Does anyone know what is the reason and how can I solve it ?
Note: when I open the local host from different browser it works well
I've solved the issue by Clearing the Last hour browsing data from Chrome.
This includes Deleting the following:
Browsing History.
Cookies and Other sites.
Cached Images and Files.
Then everything works well!
Note: Ctrl F5 doesn't work so it is better to delete the above information and then try again.

Visual studio 2013 not hitting breakpoints in a referenced project in debug

I have two solutions, one is my main app and the other is a plugin. I am editing the plugin for my app so I have added the plugins project to my apps solution and referenced it instead of the .dll
I am having problems with the breakpoints in the plugin. I have put some breakpoints where the plugin is waiting for a response. The plugin fires off an event once it has processed the data and my main app is subscribed to the event. The debugger always breaks on the event in the main app but in my plugin the debugger will only hit the breakpoints when I first start of the program. When the breakpoints aren't hit I look at the call stack and it shows me that it has gone past that piece of code with the breakpoint in.
I have no idea what is going on here and it has only just started happening. The last thing that I did was add a task into the plugin which would go off and process results when it has received the data.
Can anyone help me?
My code is running in debug
UPDATE
Basically my problem is I am getting data from a list of objects and am getting one, then processing it in my Task while I get another. This was working fine however when the issue with the break points started I noticed that the data that was being return was exactly the same all the time and is always the first element that I get.
I don't know whether that is of any use or not but it may be a caching problem that I can't identify.
You might be able to put a Debugger.Launch() statement in place of a breakpoint. I have had to use this many times when debugging applications that I don't control the application start and need more of a remote debugging scenario. The Debugger.Launch() will allow you to attach a new or existing VS instance to a running application.
By doing that in your scenario, you can start to inspect the threads (both in your current VS, and any new VS you attach with the Debugger.Launch() to ensure that they are both aware of the same threads. Your original VS may be losing access to the threads that your callback are on and thereby is unable to break.
https://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.launch%28v=vs.110%29.aspx

VS 2012 express debugging another project

I'm using VS 2012 express to build a "multi-tenanted" website with MVC4. The website itself is all going swimmingly.
In order to ensure separation of concerns, I have a plugin type of architecture, whereby I have other projects in my solution, one for each "tenant" so to speak. This means I can have a core website and just plug in a tenant plugin when required.
This appears to work fine. How it works is that on a build, various files get xcopied into the host site. It's a slight nuisance that a change to a .cshtml for example, I have to build to get the latest, but no matter.
I did also have problems trying to connect the database for the host with the database for the tenant through linq (so that I could have user specific data from the tenant, based on the logged in user on the host), but that is working now.
However, I am now hitting a bit of a road block and it is drastically slowing me down.
Because the files are xcopied, they don't appear to come under the debugger, so putting in a breakpoint on a tenant controller has absolutely no effect.
Does anyone know (or have any ideas) on how to debug the tenant DLL? All ideas would be appreciated. Thank you.
I've done it again... been puzzling over the problem for quite a while and then worked out how to do it.
In the "tenant" project properties, click "Web". CHECK "Override application root URL" and use the same URL as the host website.
Basically, the host is using IIS Express, on http://localhost:51402 the "tenant", even though it is not the main project was using http://localhost:49931 so was not getting connected as the tenant project was not technically being run.
Making it use the same URL by overriding application root URL allowed it to connect.
EDIT
Now, I am not so sure that the above actually solved the problem, partially solved it or was just timing that made it look like it solved it.
Reason being, I had it happen again where it didn't debug. However, hovering over the breakpoint, it said the source was different to what is currently running. This confused me a little.
It seems that when a build happens by clicking the green go button, the post build events that are in the properties are not executed. In the post build, I have the xcopy to copy the files over to the host app.
So, that means I have to build by hand, then run the green button (and build again).

How to modify .cs files while running app locally on VS

I have recently changed from web site model to a web application model. One change that i noticed was that in a web site, while i was running the site on my browser locally, i could make changes to the .cs files and just refresh the browser for the changes to take effect.
However in a web application the .cs files seem to have a lock which does not allow me to edit the .cs file without stopping the debugging.
This gets kinda lengthy since i have to stop and run again instead of making changes on the fly.
Is there any debug setting to get around this?
Thanks in advance.
Here is my current Edit and Continue window with the current settings. Do i need to change anything here?:
You can modify the code in a Web Application while the code is paused. You'll need to set a break point above the line of code you wish to change. Execute the code to reach the break point, and then while you are stopped at the break point you can modify the code. The once the modification is done you can resume execution.
There are certain things you cannot change while paused like this, like adding in a new method. If the change cannot be accepted while paused Visual Studio will tell, however, it won't tell you what exactly is doesn't like.
The feature you are looking for is "Edit and Continue" and should be in Debug>Options and Settings>Debugging>Edit and Continue. This doesn't give you the complete flexibility to change anything you want but does allow some basic changes.

I make changes to a form in design mode but when the program is built the changes are not there?

I am designing a basic app with multiple forms I seem to be coming across this problem and it will probably be something stupid.
When I make a change to my main form in design mode (like add a button), the button appears in design mode and I can code it but when I build the program it doesn't show up.
Any ideas?
Clean and Rebuild
Make sure you're you're starting a correct form in Application.Run in Program.cs
Most Important of all ..
Save your changes !
And make sure that the build compiles (it might not compile and not ask you if you want it to run the last successful build).
Check out what Microsoft themselves say:
http://vidmar.net/weblog/archive/2005/02/04/999.aspx
The problem was resolved. Just go to taskbar> build >clean rebuild.
Some questions:
If you change the code-behind, does the debugger stop on a breakpoint you put on that change? Also, declare a dummy variable and check if it is visible through the debugger windows such as "Locals", "Autos", "Watch" or "Immediate"?
Did you tamper with Form's default constructor (add parameters, change visibility, that sort of things)?
The form you are changing - are you positive that it is actually a main form (check the Program.Main)?
Does your form include user controls?
Did you try restarting the Visual Studio?
Did you try a full rebuild?
Did you try manually deleting all bin/obj folders then rebuilding?
Is your project actually selected for building under current configuration/platform (investigate the Build check-box under Configuration Manager)?
Did the project successfully build (check the error log)?
Are you running the same configuration/platform that you are building? Are you running the same project that you are building?
Ensure the right project is bold in the Solution Manager or check the start-up project in Solution Manager.
Do you happen to use "Start external program" under debugging options?
OK, this is not exactly an "answer", but answering these questions may produce some clues as to where is the actual problem...

Categories

Resources