Recently in Visual Studio 2017 (Professional) when I right context click on a class declaration to extract the interface, I now only get an error. It used to work just fine.
Instead of extracting the interface, it gets this error instead(below)
I have not found anything with a web search related to this.
Any Ideas?
right click on class
select Extract Interface
on the Extract Interface click SelectAll (if everything is not already selected)
then click OK
observe error
..and here is the stack trace.
It may have something to do with how many layers of folders the class is located in or the fact that the namespace.class does not match the file structure.
Any suggestions to get it working again?
Closing and reopening the solution, Visual Studio, or the restarting windows 10 does not help.
Related
I'm working on a winform app.
The design view worked well until I renamed the Form1.cs to FormMain.cs.
The program itself is ok. It can be compiled with no error and it runs well(with right form). But visual studio keep warning me that there are mistakes in FormMain.cs. It seems that FormMain class in FormMain.Designer.cs is totally ignore as it alerts "InitializeComponent(); is not defined."
And the design view goes blank as if the form was just newly-created.
IntelliSense tells me the origin(not yet renamed) Designer.cs is not found.
Now if I try to create anything on the blank form, the code is directly written in FormMain.cs.
How can I solve this?
Thanks.
Using Visual Studio 2019, I was following the C# WPF tutorial from Microsoft docs. Along the way, there is a step wherein you rename MainWindow.xaml to Greetings.xaml. When I did this, the design view was gone. Restarting Visual Studio fixes the design view. Of course, save your files before restarting.
Removing the form and adding it again to the solution fixes this issue. Here's how you can do:
Right click on the FormMain in the solution explorer and "Exclude From Project". Now right-click on the solution and click Add -> Existing Item and select the FormMain.cs from the same solution folder.
Has anyone had this issue:
I have a class for which code autocompletion works (it can see its members, properties, etc.), I can hit F12 and see the class code. But, the class cannot be seen in the solution explorer, nor can I add it because Xamarin Studio claims it has already been added to the solution.
Switching tabs in the notebook usually highlights the classes in the solution explorer, but for this single class, it doesn't work.
Any ideas ?
Thanks.
Your class already exists in the file system. In VisualStudio you can choose to show hidden files in solution explorer and include it back in to the project. In Xamarin Studio you could right click on solution and choose Open Containing Folder, find the file on the disk and delete it, so you can add it again.
I have a fairly large C# project with many files, classes etc. Everything works fine but if I move to say ClassA and add a new method or property and then move to another file in the solution and attempt to access it the intellisense reports it does not exist and underlines it in red. If I build the solution it will correctly build without errors and the red lines will disappear until I start editing the file again and then the red lines will come back and be reported as errors.
Saving the solution and all files does not help, but if I restart visual studio it will then work as intended unless I add more new methods/properties to an existing class then I have to restart again or suffer same problem.
I had this problem a long time ago with visual studio express and I could never fix it but it went away when I upgraded to a newer visual studio. Now the problem has come back with Visual Studio 2013 Ultimate on windows 8.1 and I can't find any solution again :(
Verify that your intellisense options are still properly configured.
Go to Tools => Options => Text Editor => C# => Intellisense.
Make sure that under "Completion Lists"
(checked) Show completion list after a character is typed
Make sure that under "Selection in completion list" you have:
Committed by typing the following characters: {}[]().,:;+-*/%&|^!~=<>?##'"\
and
(checked) Committed by pressing the space bar
I am developing an app for Windows Phone 8 with C#
And I've been working alot with MessageBox.Show() , and All the time it used to show a PopUp message like i wanted , but then suddenly , it Won't show anything , I debugged the app , the code runs normally and compiles the Line MessageBox.Show("Something");
but it doesn't pop up !
I also tried to put it in another page , doesn't work too !
All i remember that yesterday I have messed with References of the Project
But is that the problem ?
Anyways here's a photo of the references of my Project
When you build a Windows Phone Project it automatically generates all the required dependencies for you. You should be able to in your class file and add the following using statement:
using System.Windows
Once you've done that you'll be able to implement the MessageBox class. If not, then you'll need to do the following:
Open Solution Explorer
Right Click Reference Folder
Add Reference
Go to Assemblies
Go to Browse
Navigate to: C:\Windows\Microsoft.Net\Assembly\GAC_MSIL\PresentationFramework
Reference PresentationFramework.dll
Once you've referenced that library, you'll be able to call: MessageBox.Show(#"Something"); without a single hiccup.
Solved!
1.) Restarted my computer
2.) Deleted the app from the phone
3.) Debug
I had a problem with MessageBox.Show() not working.
It happened on two different pieces of software: Kaxaml, and an example from the Troelsen C# book.
I troubleshot it by just using a simple string inside the Show() instead of the "Exception" delegate in different spots in the code, and that helped tell me that I had the right references. Obviously, if MessageBox worked in any place in the code at all, that told me I had the correct references.
Basically, what was happening was the Visual Studio debugger would fire before the catch-try blocks, preventing the MessageBox from ever appearing. When I used the Release version, there would be no MessageBox either though.
What solved it was by just turning off a little click-box that said on Visual Studio, something like, "Don't show this exception". Kind of odd that Visual Studio still fired off an exception error, even though it was in a catch-try block, but whatever, this worked for me.
For some reason, visual studio (2012) is not reading any changes in my code. It will recognize an error but, for example, if I get rid of something that makes a window appear, a window will still appear. I am also unable to debug my code (I get the 'symbols not loaded for this document' error). This has been going on for a few days.
I'm not quite sure what to do. I've cleared the visual studio cache but that didn't help. I've changed the startup project settings around but that doesn't change anything either. This is all from my local machine (no source/version control). Does anyone know why this is?
I fixed this by deleting the .suo (silverlight user options) file, as was suggested in the link below, thanks #amalgamate
http://www.kunal-chowdhury.com/2011/08/why-visual-studio-debugger-is-not.html
Try Build > Clean Solution then Build
This may not be your answer and I do not know silver light, but I have found the symbols not loaded error often when the solution file lost track of where a project file was, or when a project file lost track of a library. Maybe the file is missing, or maybe someone else on your team directed it else where etc.. To fix this in project explorer, right click on the solution or project and re-add the particular reference or project (using the add menu item). You may then have to remove the old project/ or reference. You will know the references and projects are bad because of the icon next to them in the project explorer. The bad links will also be listed in the output of your build with the bad links named.