vs2005 - Switching between design and source mode get stuck - asp.net

I dont know if anyone else has had this problem. I'm using VS2005 working on a C# website.
The problem is on the .aspx page, when I click on the "Design" option two things happen.
It does not switch to design mode. I see only source. But I the problem is that the source mode gets stuck and uneditable.
Second thing is that I cannot switch back to source mode and hence am stuck only in that non-editable mode.
I tried to Reset my settings, but that hasnt helped.
Any ideas?

Try running visual studio in safemode. Launches Visual Studio in safe mode, loading only the default environment and services, and shipped versions of third party packages.
Try the below command in Start-> Run
devenv.exe /safemode
http://msdn.microsoft.com/en-us/library/xee0c8y7(v=vs.80).aspx

Related

VS 2012 RTM Intellisense Broken

This seems to be happening on a project-by-project basis. Currently I am working on an ASP.NET 4.5 Web Application Project. Intellisense was fine one day but not the next. I am using a custom project template but that should make no difference. I tried editing the text editor settings so that Auto list members and Parameter information are both checked. I tried to reset your Visual Studio settings (Tools --> Import and export settings --> Reset all settings) and I also tried the solution in the accepted answer here:
Intellisense not working
Has anyone got any insight or suggestions? Pending any answers, I've submitted a Connect bug report: https://connect.microsoft.com/VisualStudio/feedback/details/766891/intellisense-broken-in-vs-2012-rtm
You may be able to refresh Intellisense cache with Ctrl + Shift + R (on standard shortcut keys)
I've had the same issue on VS2010 and fixed it another method described at How to turn IntelliSense on in Visual Studio 2010?
From the link:
Delete the files in this folder: %AppData%\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas (the 10.0 folder may be a different number for VS2012)
If nothing else works, you type this in the Visual Studio Command Prompt (this is in your Start menu) and hit enter: devenv /resetuserdata
This last option is documented here on MSDN, with the following disclaimer:
Disclaimer: you will lose all your environment settings and
customizations if you use this switch. It is for this reason that this
switch is not officially supported and Microsoft does not advertise
this switch to the public (you won't see this switch if you type
devenv.exe /? in the command prompt). You should only use this switch
as the last resort if you are experiencing an environment problem, and
make sure you back up your environment settings by exporting them
before using this switch.

Website running .NET 3.5 cannot use feature not part of ISO-2 specs

I am getting this error a lot:
Feature '{insert feature here}' cannot be used because it is not part of the
ISO-2 C# language specification
I am working on a .NET 3.5 website that I've worked on on and off for about two years. I've never seen this error before my most recent around of updates. I'm using a decent amount of LINQ coding throughout and I get these errors related to much of the LINQ code. Based on what I've read it seems like even though I'm using .NET 3.5, for some reason it thinks I'm using 2.0. But I can't find anything that says how to fix it.
One example of a problem is that if I try to add a new item to the App_Code directory, I do not get the option to add a LINQ to SQL dbml file.
If anyone can shed some light on how exactly I would fix this, I would much appreciate it.
I was unable to locate an "Advanced" option under the build tab. I have a feeling it is probably because it is a web app. I looked through the web.config and found 2 parts that may be important. Most things referenced 3.5.0.0 or v3.5. The settings are consistent with older backups of the web.config from when there were no errors. By the way, only intellisense and things within VS2010 are giving me problems. The website is running error free.
I have completed a total uninstall and re-install of VS2010 and I'm still having the same issue. I fired up my old install of VS2008 and I am NOT having this issue there. However, I would MUCH prefer to use VS2010 on this project.
I opened the website in VS2010 on my work computer, and there are no errors reported. This is making me think that there is something on my laptop that is causing the problem. As I noted above, I completely reinstalled Visual Studio 2010 and I am still having the problem. What does this leave? I have only one extension installed in VS, and it's the same one at work and on my laptop. Also, I did not reinstall the extension after reinstalling VS, and the problem persists.
Both PC's run Win7 Ultimate. Have VS2008 and VS2010 installed. VS2010 has the same extension installed on both. On my laptop I have the full version of SQL Server 2008 installed, but only the Management Studio on my desktop (we have a server in the office). Would SS2008 have anything to do with it?
Go to your project properties, the Build tab, Advanced - that should allow you to set which version of C# you want to use. It should default to the latest version supported by the version of Visual Studio you're using, but it sounds like at some point you've switched it to ISO-2.
(That's certainly true for Windows projects and class libraries - there may be a different location in a web app. In particular, have a look in Web.config.)
If this has only started happening recently, I'd have a look through your source control history at changes to any configuration files. Also try creating a new project of the same type, and see if that has the same problem.
Jon Skeet's answer is mostly correct. The location for the update is in the "Property Pages" which I got to by right-clicking on the name of the website, clicking Property Pages, the Build item, then target framework.
The extension I use, Solution Navigator, has it's own heading for the solution. Right-clicking on it DOES NOT give me the Property Pages option. By chance I right clicked on the title of the website under the solution heading and was presented with the Property Pages option. In there was the Build tab which contained the target framework option.
Once I finally found the target framework option, it was indeed set to .NET 2.0 for some reason. I changed it to 3.5, reloaded the solution, and now it works great.
Thanks a million Jon for your help and time working with me!!

Visual Studio 2010 Toolbox controls disabled

VS 2010 Toolbox in ASP.NET application development (design mode or source) is not showing all controls (showing HTML and reporting ones), I can see all by right click (Show all) but they are greyed out or inactive.
I have used devnev.exe in VS Command line to reset, have reinstalled VS, have deleted the four hidden files in C:\Users\Ramzan\AppData\Local\Microsoft\VisualStudio\10.0 with extension .tbd, all in vain.
This thing is driving me mad. I have another machine and everything works fine there.
Any help much appreciated.
Don't know if this applies; but I had all controls in the toolbox disabled; you could see them but they were disabled - This in Visual Studio 2010. I right click on a toolbox item then reset toolbox and then they are enabled. Note that you may lose any custom controls you added.
Probably your project is RUNNING. STOP the project then your toolbar items will become enable.
Right click in toolbox and remove check from "SHOW ALL" (if checked)
This was driving me crazy for a pair of days. In the choose items menu my 3rd party controls (CrystalReportsViewer) were checked. Reset toolbox did nothing to enable them. My solution was changing the target framework from .NET Framework 4 Client Profile to the full version .NET Framework 4, seems the client profile which is a subset of the version optimized for client applications does not support my controls or just using references to other 3rd party .dll librarys. This issue should only be for .NET 3.5 and 4.0, Client Profile is discontinued for .NET 4.5
I had the same problem and fixed it now after 3 days:
reset toolbox (not worked)
close and reopen the solution (not worked)
close and reopen the VS (it worked!)
After a long time googling , and mostly all answers - revolving around
Reset Toolbar
Delete .tbd files from C:\Users(your user)\AppData\Local\Microsoft\VisualStudio\11.0
Using devenv.exe /SafeMode & devenv.exe /ResetSettings.
None of them working out for me, making me more sick.
There is something I did which worked and thought it's worth sharing if it helps someone.
I followed all of the above steps, failing . I did Step 1 & 2 with my project (in VS 2012) open and
Right Click on Toolbox > Choose Items > Pressed Reset > ok.
Then again, Right Click on Toolbox > Add Tab > 'gave it some name' > then again
Reset Toolbox
There was some screen flash/flickering - some loading .
And to my surprise the Grey life ( grey controls ) were now available .
Hope this helps someone like me! :)
This worked for me..
How to completely reset the Toolbox and enable Visual Studio to rebuild it from scratch
Close Visual Studio;
Open the "c:\Users\\AppData\Local\Microsoft\VisualStudio\10.0" (Windows 7) folder and remove all the .TBD files;
Run the "regedit" tool. For this click the "Run" item in the Start menu and type "regedit" without quotation marks;
Find the "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\ToolboxControlsInstaller_AssemblyFoldersExCache" and "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\ToolboxControlsInstallerCache" keys;
Remove everything from these keys leaving them empty;
Run Visual Studio again and wait until it recreates all items in the Toolbox.
If you are working in WPF application and your Xaml is opened with xml, then make sure you right click and view designer, to get your toolbox controls enabled. (Toolbox controls seem to be active(enabled) only in designer mode). At least that was the case with me.
I know this is old but I just encountered the same problem and here is what I did:
Click on Data Flow
Right click anywhere in that window
Select SSIS Toolbox.
Hope this would help someone.
I worked for me doing the following steps:
Reset Toolbox (Right click in Toolbox->Reset Toolbox)
Add a new tab with any name (Right click in Toolbox->Add Tab)
Reset Toolbox (Right click in Toolbox->Reset Toolbox)
What helped me was changing Project type from Windows Application to Class Library - then (after re-build and reopen...) I got all Controls Enabled.
What did it for me on a custom control was to first remove the control from my base project. Then I had to pull up the custom control as a separate solution by itself and recompile it. I had to make sure that that it was compiled as a class library and not as a windows application. I had to make sure that it was compiled with Framework 4 (same as my base solution) and that all sub controls and projects were also using framework 4. Once I got all of those things sorted out I went back to my base project and added the newly compiled control and sure enough it was enabled.
I hope this helps someone.
I tried all the above mentioned still not working for me. I was working on a windows application after that I have started the web application coding on visual studio after that whenever I was opening the Visual studio this problem was occurring. I am using Visual studio 2015. So what I did, I have right-click inside the toolbox panel and selected 'choose option' then under '.Net framework' components tab I have checked all check boxes for which assembly name is 'System.windows.forms' It is working for me now.
Make sure the currently opened solution platform actually supports controls you need.
My problem was, for example, that I tried to add 'SqlConnection' control to .NET 6.0 application.
Once, I created a '.NET Framework Windows Form' project 'SqlConnection' control became available

Why am I unable to Debug my ASP.NET website in Visual Studio?

I used to be able to attach to my w3wp process and Debug my web application, but this is not working anymore. I have no idea what changed to break this. I'm using Visual Studio 2008 SP1. And I'm debugging in IIS, not using ASP.NET's own server (i.e. I don't Run my project, I simply attach to a running process (w3wp).
My breakpoints simply have the "breakpoint will currently not be hit. The source code is different from the original version."
What I have tried:
Did a solution Clean.
Did a solution Rebuild.
Made sure that compilation debug=true in my web.config file.
Deleted the bin folder
Restarted Visual Studio
Restarted IIS
Restarted my Computer
Added a simple Response.Write to ensure that the latest DLL is being used. It is.
Made sure that Debug ASP.NET is checked in my project properties. It is.
Made sure that all my projects are compiled in my build configuration. They are.
But none of these help. I attach to w3wp, but my breakpoints never get hit.
Any ideas?
I had this problem recently and I ended up first making sure Visual Studio was not running at all on the system.
Then went into this folder and deleted all its content:
C:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
Check your web.config for
<compilation debug="true">...
When you "Attach to process", the Output window should show you (when showing output from "Debug") all the libraries it's loading, and where it's loading them from - for the dll's in your /bin folder these are usually copied to the \Temporary ASP.NET Files\root\ folder - where are yours being read from? Have you definitely cleared them out from there?
The only other things I can think of:
You've compiled your code in "Release" mode rather than "Debug" (not the web.config) from the Solution Configuration drop-down.
The symbol files (.pdb) are missing from your /bin folder.
On the "Build" tab of the project properties, you are in configuration "Active (Debug)", you haven't check "optimize code"?
If you click "Advanced..." on that tab, what value do you have for "Debug Info"? Is it "full" or "none"?
Responding to comment
You will find it harder to debug successfully if your code compiled in "Release" mode, and you'll often get the "source code is different" message when you've not rebuilt the symbols (.pdb files) after changes - but you say you've done a clean/rebuild, so that should cover that.
Yes, your output window will show all the framework dlls that you're referencing as well as your code - but you should see one file listed in there with the name of each project output - those are the ones to look at.
You don't have some post build event that moves files into the correct directory for your site do you that's silently failing?
I also had this problem, solved it by changing the "Attach to" code type to Automatic on the "Attach To Process" dialog. (Previously I had this set to "Silverlight Code" due to debugging a different process... it can be easy to forget to change this back.)
I know this issue has been open for some time, but I think it is the same as I experienced:
I could not debug my .aspx server side code. I had a working WepApp AnyCPU project and I wanted to link to some x86 dlls, so I created an x86 debug target. Did similar things, rebuilt, stopped the development web server, rebooted, clear temporary files, all to no avail.
Fixed the problem by changing the target folder to bin\ (was bin\x86\Debug).
Are you running any add ins that could be affecting this? Or any tools that apply post build operations to the source code that the DLLs you start debugging with have been modified post build and it actually is correct that it's not the same source code so debugging won't work?
Also have tried resetting VS?
devenv.exe /resetsettings
Edit: if none of the information has aided you here, while painful it might be worth uninstalling and reinstalling VS and SP1. If you go through this and the issue is the same afterwards that atleast assures that the issue lies in either the web.config or the project settings.
Did you check your assembly.cs file with this attribute
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
After reflecting a optimized code you will probably get this. So you must remove this to be able to debug again.
I faced the same issue. The w3wp process took a lot of memory and did not want to be reset on web application publishing.
Press Ctrl+Alt+Delete > Go to "Processes" tab > find w3wp process and
kill it. Run the app again (if this is an mvc app, just go to a
related url to automatically recreate w3wp process).
Warnings will disappear after that.
I have tried all the below options in my Visual Studio 2013 Update 4.
Reset IIS
Clean solution and rebuild
Delete the friles from temporary folder
C:\Windows\Microsoft.Net\Framework...\Temporary ASP.NET files
Check whether the compilation tag is debug or not
But none of them worked, here I am listing down the two things which worked for me.
Disabling the "Just My Code" option
Tools ->Options -> Debugging -> General -> Uncheck Enable Just My Code.
Edit the web.config file and save (You can always create a space in any line
in web.config, that will do)
Please be noted that this solution can be Visual Studio version specific, and the both fix worked for me in my Visual Studio 2013 Update 4.
in the "Attach to process" dialog, click the checkbox (near the bottom) for "show processes from all users" and if you see two w3wp.exe processes, try the other one.
One should have a comments/description value of something like T-SQL, managed somethingoranother. This is the one you want.
I have had this problem for a while and found my solution on the MS forum (link below).
Debug Diagnostic Tool was the culprit for me, but I did not have to uninstall it. I had a crash rule set up for the w3wp process and I simply removed that rule and restarted everything.
Microsoft Forum for Unable to attach error
On OpenVMS we just used to:
Compile/Debug then Link/Debug
and that was it! Simples!!
but seriously, make sure the file you have your Debugger.Break line in, has 'Copy always' set in its Properties before re-building
I was using the Visual Studio extension VSCommands to attach the debugger (convenient). However, IIS Express was running, and I guessed it might be interfering. Sure enough, when I closed IIS Express, suddenly I was able to debug again.
Joy ensued.
In my case I had a Console Application the hosted web page in .Net Framework 4.6.1. When I added a Debug to Conditional compilation symbols, it started to work:
Make sure that "Current Page" and not "Don't open a page. Wait for a request from an external application." is checked under Properties->Web->Start Action.
add this code in your .csproj file
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

Edit source code when debugging

I have VS2005 and I am currently trying to debug an ASP.net web application. I want to change some code around in the code behind file, but every time I stop at a break point and try to edit something I get the following error message: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged is optimized."
I'm pretty sure I have all the "Edit and Continue" options enabled. Any suggestions?
This may seem counter-intuitive, but turn edit and continue off.
There might be another "allow me to edit read-only files" or "allow me to edit even when I am debugging...no really!" setting somewhere, but I don't have 2005 to look at to check.
In 2008, turn off edit and continue and you can edit while it's running (but those changes aren't appplied.)
If you actually want to use edit and continue, you also have to enable it for the project, on the web tab of the project settings.
The application is actually running off of a compiled version of your code. If you modify it it will have to recompile it in order for your changes to work, which means that it will need to swap out the running version for the new compiled version. This is a pretty hard problem - which is why I think Microsoft has made it impossible to do. It's more to protect you from THINKING some changes were made when they really weren't.
For Asp.net it is possible to think of two types of 'edit and continue'.
One is a classic edit and refresh the browser. This works because the browser refresh recompiles everything except precompiled code behind files. This is not referred to as Edit and Continue, though in practice it provides a similar effect. In this mode you cannot change code behind files, because they were precompiled and deployed, but you can change just about anything else.
Another mode allows you to change precompiled code behind files but nothing else ... (this is the mode Chris Bilson mentions which needs to be set on the project properties for ASP.Net). In this case you are using the Edit and Continue feature of the debugger, which knows preciously little about ASP.net. The debugger just sees a loaded .Net assembly and can modify it when stopped in the debugger because there is a project in the solution that claims to know how to build it. In this case you are prevented from modifying things that would otherwise mess up the debugging session. This method however is the only way to change the code while it is running rather than requiring a browser refresh.
You are allowed to make changes to the *.aspx file while it runs, and you can hit refresh on your web instance to see those changes immediately. However, you cannot make changes to the *.cs/*.vb or *.designer.cs/*.designer.vb files while the program runs.
I search for this on Visual Studio 2008 WAP (Web Application Project) and it took me two days to find the solution, so here it is in the hopes it helps somebody else:
There are two locations that have to be checked, one it under tools-options-debugging-Edit And Continue-Enable Edit And Continue, the other is right click project-properties-Web-Enable Edit And Continue
For the record, I had a similar problem with VS 2008 and a different solution resolved the problem for me. Editing code in Visual Studio 2008 in debug mode
Check that you are not in release mode.
In release mode you cannot edit your code while debugging. Just change mode to Debug

Resources