I know similar questions exists but they don't address this exact problem.
I'm having an issue with Visual Studio 2008 SP1 whereby it hangs for 4-10 seconds whenever the xaml edit receives focus. It is literally driving me to despair and I'm about to move back to Winforms. Note - Just editing the straight up xaml (i.e no designer enabled) doesn't fix the issue.
I have done the following :
Disable the xaml designer
Disable all plugins Checked FileMon for activity during the hang (there is none)
Checked Disk / Paging for activity the hang (again, none)
Uninstalled Silverlight
Setup :
Windows XP64
8 Core Zeon, 16Gb RAM
The designer for XAML in VS 2008 is weak. Many of these issues have been addressed and dramatically improved in VS 2010 (even in beta 2).
I've started using Blend exclusively for designer-work, and just setup VS to use the XML editor (instead of the designer) for dealing with XAML files. This makes editing instantaneous within Visual Studio, although you need to swap out to Blend if you want a design time experience.
For me, the XML editor just didn't quite work right. What I did was in Tools/Options/Text Editor/XAML/Miscellaneous, activate "Always open documents in full XAML view." This prevents the IDE from trying to render your xaml at open and get right to editing your XAML. When you are ready to pay the render penalty, you can click on the design tab.
Because everyone knows writing xaml by hand is faster and more fun :)
I had exactly same issue with XAML editor - every time I focused, saved, opened XAML code, the Visual Studio got stuck for few seconds.
For me the solution was removing reference to Microsoft.mshtml - I don't understand the reason (if someone does, please comment), but it really was the only problem and removing the reference solved my nightmare.
Related
I'm using Visual Studio 2022 Community Edition w/ .Net 4.8 but the same behavior presents itself with Visual Studio 2019 Professional w/ .Net 4.6.1
What is happening is that I can clone a new Feature branch from Git to my local system and when I launch it everything is fine. The main application form presents itself just fine and I can get to all of the buttons, dropdown lists, file selectors just fine. The minute that I had any new control to the form when I subsequently launch the application the form is cut in half and I can't get to any of the controls and maximizing the form doesn't help either. When I inspect the designer code things have been drastically moved around in the post modification file as compared to the original. I've included sample information--
Original Form Display
Post Modification Form Display
Designer Code Compare Sample
A team member can take the same code base and add controls without any problems. Additionally he took my codebase which runs fine on his system compiled it and sent me the executable and when I launched that executable I had the problems with form display that my solution exhibits.
One final not thinking it was my laptop I got a brand new laptop and I'm still seeing the issue. I also created an AWS EC2 Instance and tried it there with the same behavior.
We're all stumped here none of us has ever seen behavior like this. We're hoping that someone in the Community has seen this sort of thing before and can shed some light on the issue.
Thanks,
Bill
Does the visual studio IDE have an issue with eating up the contents of a winform made with custom controls? I have a few and haven't had a problem, but I made a form recently that was nearly 80% out of custom controls (those being made up usually of normal windform controls themselves).
I didn't have much of a problem making them, up until about yesterday when VS lost reference to what it was doing and I spent a day figuring it out. I had to delete about 3 controls and reposition them from the designer manually to get it to stop. It then affected one of my major forms, instead of stopping like I had thought I had fixed it. Seems it lost all calls to my custom controls, and after a few hours I did a clean solution/rebuild solution. A few controls were missing again, reassigned them and it was work.
About an hour later my project stopped saving, stating it couldn't find the project's position. I closed the IDE and reopened it, all my coding changes were saved and up to do, but every single custom control in my form was deleted. Repositioning them isn't going to be more then an hour or two, but is this a common issue for VS2010 and a good argument to go with another IDE, or is this just bad and random luck? Anyone have any experience with something like this?
i get a strange trouble ,i am developing a software (WPF) with Expression Blend 4 and Visual Studio 10 and untill yesterday i could modify my code in Xaml but today after open the project to continue to work i tried to add some new UIElement as Grid,Border,Textbox and so on i could save without trouble but when i launch the software to verify the result those UIElemen added before did not appear ,i checked out well if the Visibility are Visible and the opacity is nto set to the value =0 ,so i tried to repeat to add others UIElemtn in others Window of the same project but this strange behaviour continuing to bother me...
Do you have any idea what it can be or have some advice to help and work out this step??
Thanks so much for your attention,
Cheers
I have a winforms application that I am writing in C# - in Visual Studio 2010. I have one specific form that keeps corrupting itself every other day or so - according to TFS, it looks like most of the file is re-written by the designer when I have made only the smallest changes. (location of buttions, etc.) Things fall off strips, toolbars, etc. as well as errors just trying to use the designer. See my other post Here. (Thought I figured this out, but I guess not)
Here is an example piece of code that goes missing - when I put it back in, it takes it back out when I save the file. The code was generated by the designer in a previous file version.
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tssEmployeeName,
this.tssLoadTime,
this.tssSpring,
this.tssHomeLocation,
this.tssTotal,
this.tssDue});
Is there any way of 're-generating' the [file].Designer.cs file? Or should I bite the bullet and re-do this form? (pain with over 100 components on this one...) It's the only form I have a problem with out of the 35 or so in the project.
VS 2010 w\ SP1.
Thanks, Andrew
I've experienced this before, although I'm not sure if my issues were exactly the same.
Try putting a handful of problem controls, such as your StatusStrip control and its children, into separate User Controls. Then add those User Controls to the main form instead. At the very least, you can prevent the designer from rewriting those controls.
With small projects, I can switch to design view almost instantly (< 1 sec).
I have a large project that takes about 60 seconds to open a control or form in design view - for the first time only. After this 60 second delay, I can open any control in the project in design view almost instantly - until I recompile the project.
If the exe built by this project is referenced in another (small) project, the small project instantly becomes as sluggish as the large project. Similarly, if I add all the files from the large project to the small project individually, the small project becomes as sluggish.
The large project references a large Managed C++ project, but if I add the same reference (and call a function from the reference to make sure it is loaded) to the small project, the small project is still fast.
My large project uses SandDock. If my small project uses SandDock, it's still fast.
My large project has about 60 user controls that appear in the toolbox. If I add 60 user controls to the small project, the small project is still fast.
If I make the user controls hidden from the toolbox with [System.ComponentModel.ToolboxItem(false)], the large project is still slow.
The problem occurs in both vs2005 and vs2008.
What could be making the large project so slow to open design view for the first time? Some other reference? The large number of controls? The large number of classes? Some other cause?
One thing I've noticed (though possibly a red herring) is that the ProjectAssemblies folder (C:\Documents and Settings\tim.gradwell\Local Settings\Application Data\Microsoft\VisualStudio\9.0\ProjectAssemblies) is huge (> 1GB) and most of the folders in here have a copy of my Managed C++ dll! These folders appear to get recreated every time the design view is re-opened (after a recompile). Could this have anything to do with the slowdown?
Further Info:
A toolstrip in the user control or form makes the form take 60 seconds to load. Removing the toolstrip (but still having several other different controls on the form) makes the switch to design view instant.
That's not the whole story though... A toolstrip in a brand new project doesn't cause massive slowdown - so there must be something in my big project which is affecting toolstrips. Also, certain other forms/controls that don't have toolstrips on them are still taking 60 secs to display the design view, so whatever it is that is affecting toolstrips is also affecting other controls too. I'll keep trying to nail down precisely which controls and maybe even what it is that's causing it!
Even though you have marked the classes to not appear in the Toolbox, Visual Studio still needs to scan all of your open projects to discover that. To speed things up, you need to turn off the setting to automatically populate the Toolbox. It can get a bit annoying if you do lots of work with the toolbox, but it will speed up things a lot.
The setting is in Tools -> Options -> Windows Forms Designer, set "AutoToolboxPopulate" to false.
The first answer: "The setting is in Tools -> Options -> Windows Forms Designer, set "AutoToolboxPopulate" to false" worked for me. The designer used to hang for at least a minute when trying to get focus on a control on a form when first looking at a form in design view. Now, it takes only a few seconds. (I didn't have enough reputation points to directly comment on that answer)
The same similar thing is happening with my 2005 in additon to that the devenv.exe hangs randomly
and even after "building" sometimes the custom controls tend to corrupt the main form
have you recently virus scanned and defragged?
I had this problem on a Win CE 6.0 project in Visual Studio 2005. The project uses System.Data.SQLite.dll v1.0.65.0. Each time I opened or recompiled the project, and then tried to open a form with a grid for design, there would be at least a 12-minute delay. Turns out it was generating 770-odd folders under "My Documents\Local Settings\Application Data\Microsoft\Visual Studio\8.0\Project Assemblies", most of which had a copy of just the SQLite dll.
The issue appears to be that I had referenced this DLL in the project from a "sibling" folder to my project. As an example:
Project folder: "...Projects\ThisAndThat\projectFolder"
DLL folder: "...Projects\ThisAndThat\projectFolderBin"
There may be other folder relationships that manifest this problem, but I did not investigate.
I moved the DLL into the "Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE" folder and the problem went away. I have a form with a tab control containing two tabs. Each tab contains a datagrid control. This form now loads almost instantly in the designer.
If anyone knows of a better solution, or what setting or behavior of VS2005 causes this issue, please add a comment.