Windows forms designer froze using Visual C# 2010 Express - c#

When I open form designer, it freezes - shows a blank page or what was shown before. This is how it looks:
I have FormMain.cs [Design] opened, but it shows contents of the tab that was there before (also it causes another issue in solution explorer, but that gets solved when I click anywhere in the solution explorer). I tried deleting the .suo file, but it didn't solve the issue.
Also for some reason, I can right-click and lock controls, then unlock and it solves the issue temporarily, when I open another tab and go back to the designer, it's frozen again. It happens only for FormMain.cs, the other 2 forms are okay, so I thought it might be something in the designer code - http://pastebin.com/AxTdEbg3 - but even if I delete all the controls from FormMain.Designer.cs, it still freezes.
I have Hotfix (KB2635973) and Service Pack 1 (KB983509) for Visual C#, .NET Framework 4 SP1 (but the project uses 3.0). Thanks for all answers, if you need some more information (like the whole project folder), then I'll upload it.

Related

Xamarin Visual Studio Android Designer wont Display

I'm trying to do some Android C# app development for the first time. Iv installed Xamarin for VS2015 and I'm able to create, build, and start an Android Xamarin Project. The only problem is when I add an Android Layout, I can see the .axml source, but not the design view. No matter how many times I click on it, it keeps the source view open. This is quite confusing and aggravating as there are no errors or warnings being displayed. Any help would be greatly appreciated.
Here is a GIF of me trying to click on the Designer tab profusely:
Solved. I instead opened main.axml in the layout folder which allowed it to load in some files for a few seconds and showed the designer.
In your Solution Explorer, right click on an axml file and select "Open With". As one of the options, you should see "Android Designer". Open it with that. In addition, you can reset it as the Default by clicking the "Set As Default" button.
asp below link:
https://forums.xamarin.com/discussion/5233/visual-studio-plugin-cant-switch-between-source-design-anymore

There are no usable controls in this group. Drag an item onto this text to add it to the toolbox" Visual Studio 2012

Its Not a Programming Question But about Visual studio express 2012.
Trying to create a new report in the visual studio 2012 but can not see the list of data sets, parameters etc: In general tab i am seeing this
"There are no usable controls in this group. Drag an item onto this text to add it to the toolbox"
I have searched to fixed it but not succeeded till now..
I came across this same issue today and read plenty of things such as "this is VS bug...." but the solution was much simpler than that, I just needed to stop debugging (Shift+F5).
If that doesn't work, I recommend restarting the IDE.
If this doesn't work, I guess that uninstalling VS and doing a fresh installation is the answer you're looking for. It's important to note that it's recommended to restart Windows after installing VS and before launching it.
Right click on the Toolbox and press "Show All"
Right click on Toolbox, Click on "choose Items.". Restart IDE. That worked for me.
Right click on Toolbar and select: Reset Toolbox.
MFC controls will reappear.
I also had this problem, and it turned out I was trying to open the wrong toolbox: what I was actually looking for was the 'SSIS toolbox'. If none of the other options have worked, try selecting View -> Other Windows -> SSIS Toolbox. That fixed it for me.
[I found this out from this blog by James Serra]
In VS 2015, the SSIS Toolbox is under SSIS tab, not under View.
"There are no usable controls..." is shown when you have currently opened a file that is not designer file (e.g. "Form1.cs"). Once you open the designer file (e.g. "Form1.Designer.cs") the items should be shown again.
Just hover over the design and then press escape. A control that you had selected and not dropped is holding up memory.
This happened to me, and it was because I was currently debugging. Once I ended debugging, the usable controls appeared.

Visual Studio Designer fails to load

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();
}

C# Winforms Designer won't open because it cannot find type in same assembly

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.

My project in Visual Studio is Read Only. What did I do?

I must have done something wrong. I have a C# project in Visual Studio 2008. All of a sudden I see a lock on my classes and when I hover the class names on the top tab I see the class name as : C:\Myprojects\Oder.cs[Read Only] !
Has something weird like that happened to you before?
In my case it was a ReSharper 9.0/9.1 related issue. After clearing the ReSharper cache, I was able to edit files in my solution again.
Clearing the ReSharper cache can be done here: ReSharper -> Options -> Environment -> General and click: Clear Caches and restart your visual studio.
(The image is contained within the first of the linked JetBrains articles).
JetBrains instructions:
Ultimate Guide to Speeding Up ReSharper (and Visual Studio) - Performance degradation after ReSharper upgrade
ReSharper Online Documentation
A couple of possibilities spring to mind:
Have you added the project to source control?
Have you marked the project folder (and all it's sub folders) as read only?
Of course, someone else may have done either of these things if they have had access to your machine.
One Possible stupid thing.
Your project is still running and you forgot that. Stop debugging (CTRL + F5)
How do I know. Guess..
Restarting my computer worked for me. My project became read only in between compiles - suddenly I couldn't save changes to files, Visual Studio started presenting me with 'save as' dialog boxes, and SVN couldn't commit or clean the project because "sqlite could not write to readonly database." Checking the file properties on the files in Windows Explorer showed that none of them were marked read-only. I was able to make a backup copy of the project, then I restarted and it was fine.
Restart your Visual Studio and add the project again. Worked for me.
Close, then reopen the file.
Still a pain, but at least it's less costly than completely closing visual studio.
You can try: file -> Source Control -> Go online
IDE-integrated source control?
Sounds like your source files are or have been under source control. Many source control systems will set files to read-only when they haven't been checked out for editing.
Total Commander makes it really easy to change file attributes recursively, but most likely Windows can also do this :)
Much in line with what Morten Mertner said, (if you by chance are using TFS Source Control like I am) I did a manual checkout of the file and it resolved the issue for me.
For me the problem is that the files are locked while the application is running.
In this state, Visual Studio 2013 displays the lock icon in the file tab and when you try to edit the file, a dialog box with this message appears:
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.
In Visual Studio 2015 as well, the lock icon appears in the file tab when the application is running. but the dialog box and message are not displayed.
Stopping the application causes the file to become unlocked.

Categories

Resources