According to the Visual Studio 2015 update 2 release notes, it is now possible to initialize the C# interactive environment with the context of a selected project. This feature is further described in these blog posts. However, the "Initialize interactive with project" menu option they talk about and show in screenshots simply isn't present for me (though I do see the related new "Execute in interactive" option when I select code in the editor).
I'm using:
Any clue what might be wrong? Does anyone else see this feature?
Update: Just to prove it's really not there:
Right click on your project and you'll see the option in the context menu.
Within the code window Right-Click you will see it there. Perform the right click as if you are trying to right click on a function. You can execute an entire function.
You can actually right click anywhere in the code window.
I'm using Visual Studio Community 2015 Update 2, and I can see the expected menu option by right-clicking a console project, so it should be available for you too.
I just wonder if you can see and use View > Other Windows > C# Interactive
Maybe if you double check the installed components through the Visual Studio setup and/or do a Repair by Visual Studio setup can bring it back for you.
Related
Working on a project I made a class with properties and when I tried to auto-generate a class constructor I got an error saying something on lines of "auto generation of class constructor failed... and will be disabled" and ever sense then the "generate constructor" option has been taken off the Refactor menu and on top of that I don't get syntax error highlighting anymore and intellisense doesn't seem to be working proper or at all.
I tried using going into Tools > Options > Text Editor > various fields including "C#" and "general") and I don't see anything obviously wrong. I also tried to use Visual Studio Installer to try to repair and that didn't do anything. I am completely out of ideas and I can't find anything that is remotely close to my case. TIA
I can't add this reply as a comment as I don't have 50 reputation.
I created a .Net 6.0 C# console project in Visual Studio 2022, add a class, and add two private fields. Selecting these two fields, press Alt+Enter to quickly generate the constructor. I did not encounter your issue.
Please try:
Go to Visual Studio Installer, click Modify, uncheck IntelliCode in Individual components, then click Modify button to save the change, wait for the installation to complete, and then reinstall IntelliCode.
In Visual Studio, go to Tools->Options->IntelliCode to check if the setting is Default.
Go to Tools menu, and select Options. Under Intellicode select General. Just uncheck “C# Suggestions”. Then restart Visual Studio and check that intellisence and syntax errors are appearing.
Note, I was not able to figure out what this option does, as the C# code suggestions seemed to continue to work as expected.
I know that I can set up Visual Studio to debug through the .NET framework source code.
But is there a way that I can browse the code while NOT debugging - i.e., being able to press F12 or "Go to definition"?
I thought that if that feature isn't built into Visual Studio then there may be a plug-in that might add it?
There is a very new feature in Visual Studio 2017 version 15.6
You can see decompiled source code without any plugin! Btw, Ref12 doesn't work for VS2017.
Tools > Options , expand Text Editor > C# > Advanced, and enable "Enable navigation to decompiled sources (experimental)".
Ref: https://learn.microsoft.com/en-us/visualstudio/ide/go-to-and-peek-definition?view=vs-2017#view-decompiled-source-definitions-instead-of-metadata-c
With ReSharper it's possible to browse .NET sources by enabling ReSharper -> Options -> Tools -> External Sources -> Navigation to Sources.
After enabling this option new menu item "Navigate To -> Decompiled Sources" appears by right click on type/method/whatever.
Navigation also works with F12 for me.
I just discovered this extension that pretty much addresses my problem. The only thing is that it opens the source in the browser rather than in Visual Studio, but it's no big deal because even in the browser you can click the source code to navigate to types etc.
It was presented on Scott Hanselman's blog a couple of days ago:
Community member and fabulous coder Schabse Laks has created a Visual Studio extension for VS2010, 2012, and 2013! This extension sends calls to Go To Definition (or pressing F12 on a symbol) directly to the code online (when it's .NET Framework code, not yours).
You can download this companion "Ref12" Visual Studio Extension now! Just Goto Definition on any .NET type we have source for and it'll launch your default browser so you can explore the .NET Framework source yourself! Thanks Schabse!
Update:
As per the comments, for VS 2022 and .NET Core, use this fork of the extension: https://marketplace.visualstudio.com/items?itemName=EfreyKong.Ref12-VS2022
I downloaded the .NET Framework source code from here http://referencesource.microsoft.com/netframework.aspx.
Since I am working with .NET 4.0, I chose ".Net/4" from the list. (What is ".NET/8.0" in that list? No idea.)
I wrote some scripts to rearrange the bloody mess they give us:
Into a reasonable hierarchy of directories;
To remove duplicated code (why is every file doubled, or was my install bad?);
Rename all top-level namespaces to not conflict with native ones baked into Intellisense.
Example: System.Windows.Controls -> xSystem.Windows.Controls
Then follow these steps:
Create a new Visual Studio project of type "Class Library"
Remove all references -- yes, even the system ones.
Drag/drop all of your massaged .NET code into the root of your project.
Wait about 30 minutes for VS processing. VS will appear to freeze; be patient.
Intellisense/ReSharper still complains about heaps of problems, but now I can right click and select "Go to Declaration/Implementation".
Visual Studio is about 600MB with this project loaded.
I am using Visual Studio 2013 Ultimate.
1. Choose menu: TOOLS \ Extensions and Updates...
2. Choose Visual Studio Gallery \ Search Results. Search term: Ref12.
3. Download then install.
4. Restart Visual Studio.
5. Try: Click mouse on Class or method, press F12 and see result at http://referencesource.microsoft.com/
I've never tried this but supposedly the code is publicly available:
[Edit]
http://referencesource.microsoft.com/
There is the .NET Mass Downloader, but I think the straightforward answer to your question is, no.
However I now see Microsoft has made the code more easily downloadable.
Nevertheless note that even for your own code, when not debugging, unless you have the project open, VS does not help you locate source code (even though when you find it yourself break points will work when you start debugging again, if the .pdb files correspond).
My Visual Studio (2008) Editor has stopped to underline Errors (this nifty wavy red lines). I can't really tell when, but it can be related to the installation of .Net Framework 3.5 SP 1 or the MVC Beta (which I guess is unlikely). Furthermore have I installed and uninstalled both CodeRush and Resharper for evaluation purposes (decided not to keep either one of them).
Does anyone know the problem and how to restore this functionality again?
Have you checked Tools→Options...→Text Editor→C#→Advanced→Underline errors in the editor?
I usually like to reset my settings after messing around with plugins, as they tend to mess with settings: Tools→Import and Export Settings...→Reset all settings.
About possible causes.
For VS 2012 and 2013 if you have more than one instance of Visual Studio on different machines binded to one "live" account and have installed ReSharper on one of them, it disables the native IntelliSense and error underlines (to replace by it's own rules) that will be synchronised through your account to another machine without ReSharper.
Found it in Visual Studio 2019 as: Tools > Options > Text Editor > General > Show error squiggles
This is generally called Disable Squiggly or Wavy lines in Visual Studio.
How you will do in Visual studio 2013?
TOOLS -> Options... -> Text Editor -> C/C++ -> Advanced -> Disable Squiggles: True/False (Under IntelliSense) -> Press OK
I know its an old question, and with various solutions, but I have fixed it in different way. I'm working with Unity3D on my C# code using VS2017, when suddenly VS decides to stop underlining error while im typing. However, if I close the file tab and reopen, it suddenly undelines the error.
For example:
class A {
public int x;
s;
}
should obvsiouly give an error for that lonely 's' symbol. But, VS doesn't underline it until I close and reopen this file tab.
Solution:
Copied the entire Unity Project folder (which is like a regular VS Solution folder basically) and worked with the new folder, which issue was gone there.
For visual studio 2017 act according to HeeJae's comments in:
https://developercommunity.visualstudio.com/content/problem/113112/design-time-error-checking-isnt-working.html
i.e:
Hi. you are probably hitting a known issue. can you try this?
1.Update to latest release If that doesn’t solve it
2.Go to Tools\Options\Projects and Solutions\General and uncheck “Allow parallel project initialization”.
3.Close VS.
4.Delete the “.vs” directory beside their solution file.
5.Reopen VS.
..
thank you
You can re-enable the "Allow parallel project initialization" option after the issue was solved.
I tried to upgrade VS, reset VS settings, clear VS cache and everything people do conventionally but none of them solved this issue! At the end the mentioned solution worked for me magically.
Good luck
Unloading and loading same project again from the solution does the trick. Just right click on the project and click "Unload Project". Once unloaded, again right click the same project and click "Reload Project". Error highlighting will return.
I had the same issue with 2017. There was a 'disable intelisense' option, make sure that is set to false.
For everyone wondering in 2021..
search for "C_Cpp.errorSquiggles" in the settings.
Make sure to have it active for the user, as well as the workspace.
No need to restart Visual Studio.
For me (VS 2019) , after trying the other answers also, setting the scope of analysis from "Current document" to Open document" brought back the missing error markers
Just go to settings and search for errors and Image in Error Squiggles. You can see the Error squiggles (Modified: Workspace - Right now you can't see it because I modified it). Just click on modified and you will see the disabled option. If by mistake you disabled it, just enable it and you can see the red line errors again in your code.
In latest edition, check for .vscode folder in same project folder. There will be a setting.json file in that. Delete the key value pair of "C_Cpp.errorSquiggles": "Disabled". Restart the vs code.
I'm a C# programmer and recently I've installed Visual Studio 2013. The problem is when i set a break point or get an error and trying to edit the codes while debugging I get this error and I couldn't find the same error searching on Google.
Changes are not allowed for this module as it was not built for
changes while debugging or the target .NET runtime version does not
support it
I also tried to check the options on Tools -> Options -> Debugging -> Edit and Continue, But didn't help.
Any idea what the problem is?
To edit a C# program while you're running it in Visual Studio 2013:
Go to Project, Properties, Build.
Set Platform target: x86
Disable "Optimize code"
Set Advanced, Debug Info: Full
I came across the same issue and found that "solution configuration" on the top bar was changed to Release from Debug,because I build the last version into Release folder.Changing back to Debug mode will solve the issue.
The code your probably modifying is included in the exception. Since, your code is not posted here, I can't say. So please refer to this link and check whether it is really not allowed.
We just had the same issue in Visual Studio 2013 and in our case it was because we had disabled the Visual Studio Hosting Process on the Debug tab in Project Settings.
You can try
Right click 'Solution' in the Solution Explorer.
Select Properties.
Choose Configuration Properties from the left menu.
Select 'Debug' from the dropdown list in the upper-left corner labeled 'Configuration:'.
I just had the same problem and found a solution that worked for me right here after trying 100 other things:
https://stackoverflow.com/a/12543388/5367013
1.) execute VsPerfCLREnv /globaloff
2.) reboot your computer
In a Web Forms application, I initially received the "Changes are not allowed for this module as it was not built for changes while debugging or the target .NET runtime version does not support it" error message. Based on suggestions above I completed the following:
Right click the project name, just under the Solution name in Solution Explorer and select Properties, the "Build" tab
Set Platform target: x86 (Note, for me this was already set)
Disable "Optimize code"
Click the “Advanced” button (near bottom) and set, Debug Info: Full
I tried to modify code, but then I received the "Edit and Continue" window stating "Changes are not allowed while code is running."
Here was the important part: I can only make changes while stopped at a breakpoint. If the page is loaded, I get that same "Changes are not allowed..." message. So set a breakpoint to a line above where you need to make the change, complete the update and you should be set.
Or (as I subsequently discovered) another way to modify code without using a breakpoint is to click in Visual Studio "Debug/Break All" (Ctrl+Alt+Break), make your change and then press F5 or click the "Continue" button. (Using this method you will might need a page refresh to see the mods.)
It worked for me by unchecking "Enable optimizations" option.
Please refer below image for more info.
I'm attempting to use the Ctrl+R, Ctrl+R command within Visual Studio 2008 to rename a variable. I get an error message at the bottom saying that
"The key combination (Ctrl+R, Ctrl+R) is bound to command (&Rename...) which is not currently available."
I am not running it or anything I can think of which might prohibit modifications of the file and the F2 command allows a rename to happen. Anyone know how to fix this?
EDIT: I do have Resharper installed but was previously able to do this with the same setup, I recently migrated computers.
I was able to fix this by doing the following:
Go to Resharper → Options menu commmand
Select Environment → Keyboard & Menus
Select the Visual Studio option under Keyboard Shortcuts
Click Apply Scheme and Save
This will cause Ctrl+R, Ctrl+R to do a rename. (Select ReSharper options in the dialog box that pops up then.)
However, it made F2 no longer able to preform a rename. I was able to fix that by doing the following:
Go to ReSharper → Options menu command
Select Environment → General
Select the ReSharper 2.x or IntelliJ IDEA under Restore ReSharper keyboard shortcuts
Click Apply or OK
This allows both F2 and Ctrl+R, Ctrl+R commands to work for renaming a variable.
This seems to be specific to ReSharper being installed with Visual Studio, I don't know what the solution would be to fix this if ReSharper weren't installed.
For Resharper 6
You should:
Select menu "Resharper" - "Options..."
Select "Visual Studio Integration"
Choose "Visual Studio" in both places
Click "Apply Scheme"
It will either works or you will have a selection to do (Visual Studio or Resharper), if it is so, then choose Resharper.
resharper has multiple default shortcut bindings that is chosen the first time you start visual studio after instalation. My guess is you picked a different one this time.
In my case the problem was solved by clearing the ReSharper cache. This can be done in the options menu under Environment > General here:
This happened to me once. I had to reinstall Resharper (repair from Add/Remove programs probably) to get it to work. But that was with VS2005 though.
Using version 8 of ReSharper in Visual Studio 2013, I had to
Go to the RESHARPER menu -> Options
Expand Environment
Select Keyboard & Menus
Choose Visual Studio as the ReSharper keyboard scheme
Click Apply Scheme...Save & close dialog box.
The next time I executed a keyboard shortcut it prompted me to choose which keyboard shortcut I wanted to use.
Nothing has worked for me until I have tried upgrading my Resharper! :O
I'm guessing very few people will be in my situation but FWIW I was in this situation too where Refactor.Rename (Ctrl+R,Ctrl+R) was NOT working in Visual Studio 2019/Win 10, after reboots/restarts plus I did not have Resharper installed. In my case Refactor.Rename wasn't working because my project was in FOLDER mode not SOLUTION mode (OMFG). Soon as I used the solution tool to "Switch Views" and went into SOLUTION mode Refactor.Rename started working again. In hindsight this makes sense of course but some kind of error message/warning would have been nice to help me realize what the issue was!
For me, the issue was I hadn't started the Resharper evaluation which wasn't obvious because all of the Resharper extension options were accessible, but the clue was under:
Extensions -> Resharper -> Why Resharper Is Disabled.
Click "Start Evaluation" (in the same location as "Pause Evaluation" in the screenprint)
I expected the evaluation to start when I clicked "OK", but clearly it doesn't.
You get this behaviour in Visual Studio (without R# installed) if the editor window does not have focus when you issue the shortcut. I've just tried it with R# installed and it does the same thing.
Give the editor focus (ie. by clicking in it) and try again.
This is usually the shortcut used by Resharper. Is there any chance Resharper is not running?
Alternatively, you can change the name, hit Ctrl+. and then use Rename.
For DevExpress:
Open the Options screen (Ctrl+Alt+Shift+O)
Go to Core → Features
Set Default to Visual Studio shortcuts
For me, this problem was caused by me not clicking 'Accept" on the terms and conditions page, but closing it. I did not realize it was the terms and conditions, and thought it was just a notice, or a 'readme' being displayed.
All the answers above are well and good but this error also comes up in one more instance.
You start debugging your test script written for the project , the project stops at breakpoint .
If at this point , you try any operation on code , you will get the error similar to :
"The key combination (Ctrl+R, Ctrl+R) is bound to command (&Rename...) which is not currently available."
Restart Visual Studio.
Worked for me.
None of the above worked for me. I had to reset my resharper settings in the end.
Go to Resharper -> Manage Options
Click the "Reset All Settings" button
In my case (Visual Studio 2022 17.4.0 with Resharper 2022.2.2), I had to
disable Resharper
restart Visual Studio to make the change effective
enable Resharper
restart Visual Studio to make the change effective