Visual Studio 2010 Debugging issue - debugging

I have a problem with debugging my Silverlight 4 (hosted in ASP.NET MVC2) in Visual Studio 2010. It was working fine until I tried remote debugging. After a lot of hassle I managed to configure remote debugging but it worked only occasionally. So I created a new app and copied my classes one by one, but now I see I cannot debug not only remotely but also "locally" in development server. Breakpoints in Silverlight code says "The breakpoint will not currently be hit. No symbols have been loaded for this document." Strangely enough, if I run my app it will show my previous code results. (It may be relevant, before this problem I noticed that my app doesn't update immediately when I publish to remote web server. So I did the following for all projects in the solution:
//In AssemblyInfo.cs in Properties folder
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
I'm adviced that it will automatically generate version numbers so, when I publish to remote server it will immediately take into effect, which seems working well.)
However, if I change development server's port number, in the properties page of my ASP.NET MVC app, then I'm able to debug locally (about remote debugging I just gave up). But, it didn't last long; after some updates in my code the problem suddenly reoccurs. I guess development server deploys my app somewhere in a folder per port number, but where? May be, if I delete that folder, will the problem be solved? Can somebody advice me what to do?

There seems to be bug in Visual Studio 2010; see:
silverlight 4, dynamically loading xap modules

Related

Visual Studio ignoring breakpoints

Visual Studio is ignoring my breakpoints. I don't know if it makes a difference but this is happening in Web API. I know it's passing over my code because I can put Console.WriteLine('FOO'); in and it shows up. But it passes over my breakpoints like they aren't even there. I added System.Diagnostics.Debugger.Break(); and that gives me this dialog even though I opened Visual Studio as an administrator.
I'm starting the Web API project directly. That is, I'm not starting a project that uses Web API and therefore need to right click Solution > Startup Projects and set Web API to start. The project is in debug mode. I've cleaned my solution, restarted IIS, and closed and reopened Visual Studio.
Also, I can open other projects, like an ASP.NET MVC app, and the breakpoints work fine there. It's just Web API. Any idea what I am doing wrong?
Restart your computer.
I don't know what the exact cause was but after trying everything else I restarted and now it works.
Also, I had to run it from another project. If I debug the Web API project it doesn't hit the breakpoints but if I debug from the Web UI project (Web API is part of that solution) it works.
edit
And actually that only worked like one time. I ended up including Web API in startup projects and also copying the dll and pdb to c:\mySymbols on each build via post build commands copy c:\path\the.dll c:\mySmbols\the.dll and then going to debug > options > debugging > symbols and adding the path to c:\mySymbols to the list.
edit
Another thing is I was trying to use a custom request validator via
<httpRuntime requestValidationMode="4.5" executionTimeout="300" maxRequestLength="51200" requestValidationType="MyProj.App_Code.CustomRequestValidator" />
and that definitely breaks it. So I had to take that out too (at least until I figure this problem out).
I'm not sure which, if any of these things did the trick but it is working now.

Unable to Debug a Website in Visual Studios

Here is my situation...
I have to maintain a website with multiple applications. We no longer have any of the solution files and the code is deployment code (so it uses DLL's instead of the original classes).
I basically grab the code from the website and stick it in a Visual Studio projects folder (This is generally C# code with Javascript that was originally developed on VS). I then open Visual Studios's 2010 Professional (VS) and open website, using the path in the project folder. I then add references to all the DLL files and if all the includes, images , and css files paths are referenced correctly, I can hit F5 and get the webpage to appear with some functionality. This creates a Project file in the Projects folder which I can then open instead of opening a website.
The problem is that I am unable to debug. If I set a breakpoint, it goes from solid red to outline red upon start of debugging. The standard message is "The breakpoint will not be currently hit. No symbols have been loaded for this document".
I have cleared out the symbols and reloaded.
I have debug = true in all my Web.config files.
I have gone into project properties and set the startup project action to "Start".
Any ideas why I can't debug ? My other projects that I develop from scratch work fine, but it is these projects that I am trying to get working from website files that won't debug.
My goal is to get every one of the Website apps under VS control were I can fix bugs and make improvements. Not very easy when the original source code is no longer available.
Please Help !
Thank You,
Eric
I fought this issue for a half of a day. I'm currently maintaining a website application. What worked for me is going into the project's Property Pages >> Start Options and changing the server to "Use Custom Server". I believe this setting will use IIS and not IIS Express. I started the project and was immediately able to debug.

Every time I open my project I have to create virtual directories

I am currently working on a solution which has an ASP.NET application and a Web Service. Whenever I open this solution I get the message that the virtual directories for this project have not yet been created and must be to continue. The problem is, if I hit OK, it cannot create the directories because they already exist and then I cannot load the project. Looking in IIS I can see that the virtual directory exists in C:/Inetpub/wwwroot/ProjName. If I delete this from IIS, I can then open the project, but it creates the virtual directory in C:/location of project folder. When it uses the project's location, I am not able to connect to the site or the web service.
The same thing happens on XP with IIS 5.1, VS 2010 and Server 2003 with IIS 6.0, VS 2010. Similarly, it happens on colleague's machines, so I am convinced that it is a setting in VS, and not IIS or my machine.
Right now, my solution is to delete the virtual directories, open the VS solution, delete the virtual directories, and publish the projects with the publish toolbar in visual studio (not the web tab in project properties).
I fear that I've at some point messed up a setting on both of the projects, but it has been some time since I've been working around this. I've scoured all of the settings and I can't find anything that fixes this behaviour. I need to pass the project along to someone else, and I feel as if the work around instructions may be confusing so I want to fix this.
I used to do things similarly back in the days when VS didn't have its own dev server - re: directly work on web projects in a local version of IIS (if memory serves, this was called "Personal Web Server" or PWS - am I advertising my age?)
Anyway, I haven't (thankfully) done that since VS (2005?) got its own dev server...
Try this process in VS 2010:
You can develop your solution on any local folder in your file system. You can run/debug your solution from VS (ctrl f5 or f5 respectively) - it will use VS dev server by default. Your development machine doesn't even need to have IIS...
After you are done developing and debugging (using VS and its dev server), you can publish to IIS or even to some other "publish folder" in your (local) file system, and simply copy the files to whatever (local/remote) IIS virtual (ASP.NET application) folder you prefer.

Unable to find an entry point named 'GetCurrentPackageId' in DLL 'kernel32.dll' when using Visual Studio debugger

I have an ASP.NET which calls an asmx web service. It works fine on one machine with or without using the debugger in VS 2010. On another machine, it gives an error "Unable to find an entry point named 'GetCurrentPackageId' in DLL 'kernel32.dll'" in the web service constructor and when launched in the debugger. If the app is running without the debugger it runs fine. If the debugger is attached to w3wp.exe, the app runs fine and breakpoints are reached. This is in Windows 7 64bit. The same app exhibits the same behavior under VS11beta.
Any ideas why I get this error when using the debugger.
I recently noticed the same thing started on a machine that previously worked just fine. The only change that occurred was the installation of Visual Studio 2011 Ultimate Beta 1. The problem has unfortunately persisted after the uninstall of 2011.
More specifically, it's happening with projects that were opened with the beta.
I was experiencing this problem and deleted my [projectname].suo file. This file exists in the directory where the .sln file is located.
Once I did this the problem no longer exists.
Be sure to back up this file before you try this, and know that you may have to reset a few things (startup project, etc)
The exception is thrown and handled deep inside the .NET Framework. However, you have enabled the option to break even on properly handled exceptions. (I know, because I did too.) You can safely disable that for EntryPointNotFoundException.
Seems like Microsoft is working on this issue
https://connect.microsoft.com/VisualStudio/feedback/details/732334/unable-to-find-an-entry-point-named-getcurrentpackageid-in-dll-kernel32-dll

Visual Studio Keep Session between rebuilds etc

I would like to know if there is a way to keep the session going.
I've got sick of losing my session between rebuilds/builds, if I change too much in my project or submit code to our SVN (tortoise via VisualSVN). I'm developing an ASP.NET MVC project with lots of jQuery.
I would like to do this as I test my project on one screen with Firefox (Firebug wins) and edit on the other in visual studio. As my project has a session system and I would like to be able to develop without having to keep re-logging into my system.
Thanks
Edit:
Visual Studio 2008 Professional with the build in IIS development server.
Windows Vista Business 64bit
I don't think that's possible, given that the application restarts on each build. What you could do though, is add a temporary jQuery post call to the login page, that will run on startup.
$(function() {
$.post('/login/', { username: 'phil', password: 'noonewillguessthis' });
});
That way you'll be logged on to the system "automatically" each time the page loads. Just remember to remove it before you deploy live... ;)
It is not possible, when you rebuild and change the content of your libraries they have to be reloaded into the process space. However, in .Net you can never remove assemblies from an AppDomain once they are loaded. To reload your library the AppDomain needs to be unloaded and loaded again. In addition, if there are any changes to your web.config, it will also unload/reload your AppDomain.
You could use something like pushing session state to SQL server so that the AppDomain recycle doesn't impact you. You can do this with the sessionState element of the web.config file.
I have faced the same problem. I use VS 2015 on a machine. I rebuild/build project and on my first debugging the first generated session is lost. Think i mention about 2 paged project. first page is "Default.aspx", second page is "Home.aspx".
Default.aspx page is loaded first
Session["UserID"] is generated on Default.aspx
Page is redirected to Home.aspx by using Response.Redirect("Home.aspx",false) code.
Session["UserID"] is checked on Home.aspx.cs' s Page_Load function if it is existing or not
Session["UserID"] is not existing.. lost!
Solution:
I have instaled Visual Studio on other machine and I built the project on that machine. As result session missing problem is solved. Publishes are worked well on servers too. Maybe this problem is sourced by Visual Studio configurtions or machine configurations, I am not sure but installing VS may solve the problem.

Resources