I am working with winforms, .net 3.5 Visual Studio 2008.
The code is compiling, the winforms designer suddenly stops showing forms,
with different messages, for example
'Resco.Drawing.GradientColor' cannot be converted to type 'Resco.Drawing.GradientColor'
'Method not found: 'Void Resco.UIElements.UIControl.set_TextAlignment(Resco.Drawing.Alignment)'
The variable 'ucMessageBox1' is either undeclared or was never assigned.
Again, the code compiles and runs, and no changes habe been made to the form or usercontrol, that cannot be displayed, since it xold be displayed
Sometimes it helps to clean and rebuild, sometimes it help do delete the .suo file.
Sometimes it helps to shutdown and restart Visual Studio.
Sometimes I do not find a solution but somewhen it works again.
I have two solutions with identical Source code for two Platforms, windows and windows embedded, sometime the same control is shown without problems in one solution but not in the other.
I have this same issue with VS using DevExpress. I find if I close the designer mode and re-open it, it will work. At worse, I restart Visual Studio and appears to fix the problem.
That often happens when I work with Telerik, to resolve the issue I often have to do:
Repair the software library I installed for it.
Remove the reference, then Add the reference to the .dll again.
Ignore the designer mode and simply work in code behind.
Sadly, the last result is where I often find myself. Usually I'll simply code straight in code behind, as all the functionality exist but I don't have to deal with the issue every time I close / reopen Visual Studio. Since all the functionality exist in code behind, just unable to access the designer.
Honestly I'm not sure why it happens, but it happens often enough to where I avoid Telerik.
Related
I am working in C# with Visual Studio 2017. I had previously made some changes to my form, and today when I run the code, the changes don't show up. It appears to be running an older version. Note that when I originally made the changes, it ran fine with the dropdown working.
Here is the edited version:
And here is what it looks like when it runs:
I have restarted VS and restarted my computer, both to no avail. I have searched extensively and can't find the answer.
Is there some setting I accidentally hit? Please tell me it's something obvious and not a weird glitch in the VS matrix.
Thanks!
You were using an old DLL/EXE.
This can happen in a few scenarios, typically if you store your binaries (DLLs built with your project) in source control.
You'd be surprised how many developers get caught out with this. It's often due to being pedantic about EVERYTHING being in source control - including the items you build!
Best thing to do is delete the bin and obj folders from source control. If it's a new project it's often easier to start fresh with a new source control project.
GAC'ing your DLLs is another common cause of this situation.
I'm having trouble with Visual Studio 2015 Pro for one specific solution. The solution is a ASP.Net Web Forms application with 10 projects. The following problems only appear in this solution:
Closing the solution takes 20-30s
Opening the solution takes 1min
VS becomes completely unresponsive while opening/closing the solution
Typing has a small lag (~200ms)
IntelliSense for c#-Code also lags
IntelliSense for JavaScript does not work at all (might be an unrelated issue though)
Opening an .aspx file in designer takes 5-10s
Stopping a debugging session takes 15-30s and VS becomes completely unresponsive during that. Staring the debugging session is actually faster than stopping it.
When I was using VS 2012, these problems did not appear. I got the described problems under Windows 7 Pro and Windows 10 Pro. Reinstalling Windows and Visual Studio did not help either.
For other solutions (Windows Forms, WPF), these problems do not appear. I have also tried to delete the project's *suo file, which is known to cause perfomance issues when it gets too big. Strange thing now is that VS does not create a new *suo file in the project directory. My development machine is surely fast enough to handle the project (a few 100k LOC). I'm not using any 3rd-party plugings like ReSharper. Other things I did while troubleshooting:
Disable code lens
Install all available updates
Cache debugging symbols
I have tried several possible fixes found via Googling, but nothing helped so far. Does anybody have another suggestion what the cause of the problems might be?
Update:
Deleting all breakpoints using the function provided for that fixed some of ther problems. I can now open/close the solution within <5s and starting/stopping debugging now goes smoothly. However, input lag, designer lag and problematic IntelliSense still persist. Deleting contents in "AppData\Local\Microsoft\VisualStudio\14.0" did not help.
I think that many issues can cause this type of problem & you can never give up enough details to help identify these types of issues ...
it could be because of a million difrent things ....
I googled it and found some interesting solutions ....
have a look Here
be sure to check out the comments !
you can try the following to resolve issues in java-script and .aspx files a bit:
Remove unnecessary contents from _references.js file. it should be present in Scripts folder.
Right click on the file and uncheck "Auto Sync Java-script References"
Hope it helps
In my application, I use the ScintillaNET DLL and have created a class called BufferedScintilla where I am inheriting the control and double buffering it. Nothing unusual, just the normal C# inheritance... Than, I modified my form's Designer.cs file and switched from using ScintillaNET.Scintilla() to BufferedScintilla().
The app loads and works fine as expected BUT Visual Studio 2013 designer fails to load, telling me that "Unable to cast object of type BufferedScintilla to type ScintillaNET.Scintilla.
I tried everything, cleaned the solution and rebuild, rebuild only, debug, closing and restarting Visual Studio and even restarting the PC, but nothing helps at all... Visual Studio Designer refuses to let me design my form.
Again, the app runs FINE, and I am sure that the control on the form is the new BufferedScintilla, not ScintillaNET.Scintilla, because I can see the effects (it is double buffered, the custom graphics I am drawing over it do not flicker anymore), so I am 100% sure the app runs WITH the inherited component.
I am sure this is some kind of Visual Studio little flaw, so I am looking for a solution to have it let me design my app again.
EDIT: To clarify, the same thing happens in Visual Studio 2013 Update 1 and Visual Studio 2010 too. I checked the assembly, it is built as Any CPU, so there should be no problem with the Visual Studio designer...
EDIT: As it seems impossible to fix this (some kind of a bug), I am looking forwar to a way of replacing lines in the Designer.cs file automatically before building the project, and then after the project was built (or not). Is there any Visual Studio tool which will replace some text in the class automatically after pressing the Build button before the project is built, and after it has been built? I want to replace the constructor and declaration, so that at design time it is ScintillaNET.Scintilla, and at run time it is BufferedScintilla. Thanks!
Thanks in advance!
Vali
I've run into a problem very similar to this, In my case the designer still uses the constructors and the loaded events that are setup for the controls and forms. In my case, i was using a variable that was never set during design time, so to go around this you would have to modify you're code to do something like this...
if(this.DesignMode)
{
//DoSomething();
}
else
{
//DoSomethingElse();
}
I'm getting the following error
Could not find type 'My.Special.UserControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.
But what doesn't make any sense is that My.Special.UserControl is in the same assembly as the form. What's more, if I view code on the Designer.cs file, There are references to My.Special.UserControl that seem to be fine. The assembly builds fine, and runs fine as well. It's the just the designer that's having issues.
As such we have to do all our design work by making adjustments to the Designer.cs file by hand. How can I make the designer work again?
The following procedure has worked for me:
Delete the /bin and /obj folders in your source code directory.
Restart VS (be sure the offending Form Designer is closed)
Compile
Open the Form in Designer again. The problem should be resolved.
I'm sure deleting both /bin and /obj are not necessary, but I haven't been able to reproduce the error and come to a more specific solution. (My projects are typically small enough that re-compiling the whole thing is no big deal.)
Usually, this error seems to occur after refactoring / renaming objects of the offending class. So my guess is that there is a VS bug that doesn't recompile the appropriate object file after a User Control or Custom Control is refactored.
Change the project type temporarily to x86, compile and open the Designer. Visual Studio is a 32 bit application.
There is propably an exception happening in the Load or Initialize Part of your Form / UserControl. Can you try to comment out any code there and retry opening in designer?
You can use another instance of Visual Studio to attach a debugger to your Visual Studio instance not letting you open the Form. Once an exception occurs you will be able to pinpoint the location where something goes wrong.
I had similar problem when shifted from VS 2017 community edition to professional.
Close VS
Go to Project folder
Delete .vs folder. Back up if you need.
Start VS
This should solve the problem
I have experienced the exact same problem. I am fairly certain that it is connected to the platform target x64. Here is a related post mentioning it as a bug in Visual Studio:
https://stackoverflow.com/a/11582828/7665665
How I deal with it: Although my solution is actually only x64, I have created another platform target x86 for the projects just to be able to use the designer. Now I switch the target to x86 in order to see my controls in VS Designer. For everything else, I switch back to x64.
I had the same problem with a user control which was derived from the standard .NET control within my form.cs. Nothing of the above worked for me (my solution is compiled as x64 because of other unmanaged components which only support x64).
I finally ended up with creating a separate project "Utils" and moving the offending derived controls to this project. This worked like a charm !
In my case I just unload project and reload again
Switching the project target to x86 was the only possible solution for me
This happened to me today. Cleaning, Rebuilding, restarting Vs and even rebooting did not help. Everything ran as expected, the only thing that would not work was the designer in VS.
In my case, since nothing lese worked, I went to designer file, removed the faulty control and then added a new one. Renamed, re-assigned event listeners and it worked.
Designer now works, but if this must be some kind of VS bug, I don't know.
This is not the answer I'd like to read when coming to SO, but I'll post it in case it helps anyone later.
For me, I deleted the .resx file for the form, and it built and showed up in the designer, no problem. Go figure....
I had a similar experience when I sub-classed DataGridView. The following procedure has worked for me:
Close the Form Designer tab
Close VS (2015)
Delete the /bin and /obj folders of the project
Restart VS
Rebuild the solution
I don't know which steps could be skipped as I have not taken the time to refine the process.
On my project, it only worked if I made the custom user control in a separate project in the solution:
Add new project "Class Library (.NET Framework)"
Add references to System.Windows.Forms & System.Drawing
Add the source of the new user control in the new project
Build the solution
Open the designer
Drag the new user control in the form
In my case the designer automatically added a reference to the new project when I dragged the custom user control in my form.
Hope this help others who stumble upon this question.
I am having great problems running the application in the debugger from Visual Studio 2008.
When I'm using vshost.exe, it says:
And when vshost.exe is turned of, it simply states:
Interesting thing about it is that when i do use vshost, debugger is actually started and breakpoint is hit on the first line of the Main().
I tried:
rebuilding the project(s)
removing .ncb, .suo, .user for the projects
repairing Visual Studio 2008
changing the build architecture for the project
... no help there...
Any experience in (trouble)shooting that?
More info: some projects DO work, and one that I have to work on, does not.
I have some ideas such as:
trying to create NEW project, add thing by thing to it and see at what point it will start to miss behave
work it other way around, delete project by item by item to see when it will (if it will) be working OK again.
EDIT (for google, as I see that there are many similar questions on the web):
Errors:
Error while trying to run project: Unable to start debugging.
and
Error while trying to run project: Unable to start program '....\PlayKontrol.exe'
Try upgrading your Visual Studio to Service pack 1, if you haven't already.
Did you restarted your computer? You never know how windows will react to that :).
Also be sure there aren't any keys stuck, like the ctrl or windows key.
Note that the key does not have to be visually stuck, it can be stuck for visual studio and not for the explorer.
The most common source of sudden problems like this is corruption of one of the data files that vs uses to cache information between builds.
You've tried a clean build, but this won't delete everything. A real clean build is: quit vs, delete bin, obj, debug, release folders, delete all generated files in the root - primarily ncb. Do the same for any locally built libraries that you're project references.
The easiest way to do this is if you have the code in source control, as you can rename away your entire code folder and then force a get of all the source.
You often need to do all of these things in one hit to clear the problem.
Less frequently, a reinstall of vs will sort things out (although this sounds unlikely in your case if it is only one project that breaks)
Also think carefully about anything you might have installed just prior to it failing... And remember that some install effects may not occur until the next reboot so it could be days ago. A particular cause of this are automatic windows updates and trial versions of things like the vs 11 beta.
You might try running the application from outside of VS, but have a line of code that looks like this: Debugger.Launch(); where you want your first breakpoint.