Forms not showing changes when run in visual studio 2008 - winforms

My forms in my vb.net programs in visual studio are not showing the changes I make on them when I run the application. The were working before but eventually just stopped with nothing really done to stop them. I am making changes like changing background color, adding controls like buttons but they only show in the design view but do not show when I run the program. I've tried to clean and build but still showing the same problem. Could someone tell me why this happens and how a fix can be achieved? Thank you

It is likely because you have your build mode set to "release". When you run the debugger it uses the "debug" version. Change your build mode to "debug" and you should see the changes.

Delete all the file from \bin\Debug and build the application again. It should work fine. And make sure you are on debug mode

Related

Visual Studio design view contains yellow warning icons?

I have created a WPF project in Visual Studio which contains a MainWindow. This "imports" other user controls via XAML. The MainWindow is shown with warning icons and the following text. Unfortunately I don't have the English translation but it means something like this:
This document contains one or more controls which have been changed.
Rebuild the project to show the changes in the design view.
Rebuilding the complete solution does not help. However these warnings do not have any effect.
How can I get rid of these warnings?
I have tried Asryaels solution which is as follows:
Cleaning
Rebuilding
Saving all documents
Closing Visual Studio
Starting Visual Studio
Cleaning
Rebuilding
When encountering the same problem, closing the solution, deleting the Debug and the Release folders in /bin and restarting the solution seems to have helped.
I tried Asryaels solution, but it did not work for me.
Did you switch your platform target? This happened to me when I had project under Platform target: Any CPU and switched to x64. When I switch back to Any CPU warning does not show anymore and control works properly.
If you did switch platform target go to Configuration manager and create a new Active solution platform and for your project set Debug/Release to your project's current platform target. Worked for me.
This happens when the control within the ContentControl changes. You have to rebuild the solution to "update" the content within ContentControl.
<ContentControl Grid.Row="0">
<view:View_UserControl_TitleBar/>
</ContentControl>
In my case I had a User Control Library project that had errors during compilation.
But those error didn't showed up because I was in Release mode.
So changed to Debug mode and the errors were visible, so I could correct them.
After that, the project built correctly and the yellow marks dissapeared.

Visual studio 2012 XAML designer invalid markup

I've got a project that contains usercontrols. For some reason, the design view for the window which uses the said controls has stopped functioning and insists on "Invalid Markup" - the error given is that some members of the usercontrols are not recognized or not accessible. The project however compiles and executes just fine. Loading it up in VS2010, the editor works fine, no errors whatsoever - the same even in Expression Blend.
So far I have tried the typical clean, rebuild, manually deleting stuff from obj, updating the .xaml and rebuilding, tried starting VS2012 with /resetuserdata and /resetsettings - the problem persists. I even rolled back to a much older revision of my project, back when the designer was working just fine, no dice - same error. I also tried launching VS2012 as a new windows user to avoid any stored appdata that might be lingering, again a no go.
Is there some other sort of cache or something that I could manually delete?
There's also an issue with the ShadowCache (used for rendering designer) getting out of sync with your XAML in VS2012. I just found this out, as I was having a horrible time with the following error with derived user controls:
The local property XXXX can only be applied to types that are derived from YYYYY.
The shadow cache is located in your user profile directory:
app data\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache
You can delete everything in there and restart VS2012. After that, things worked much better (for at least a while!)
Delete everything in ShadowCache
C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
Copy-pasteable paths
Just copy/paste one of these paths into Windows Explorer. %LOCALAPPDATA% is a Windows Environment Variable it will be replaced with the corresponding value when entered into Explorer (also works in Command Prompt)
VS2012
%LOCALAPPDATA%\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
VS2013
%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\Designer\ShadowCache\
VS2015
%LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache\
ASP.NET
If you develop ASP.NET also delete
%LOCALAPPDATA%\Microsoft\WebsiteCache
%LOCALAPPDATA%\Temp\VWDWebCache
I'm not sure this will fix all cases but this is what worked for me (all the time now).
I have VS2012, using the Blend designer in the IDE, building an x64 application, when I would define a new ICommand and add the Command attribute, I would get the designer isn't supported in x64 error (I forget the exact warning). If I switch to x86, I'd get invalid XAML markup errors complaining the the ICommand wasn't recognized or was not accessible, no matter how many times I rebuilt in x64. If I switch to x86, build, then switch back to x64, voila, not problems with the designer.
Now I recall similar issues with VS2008 and Blend version 3 and 4. From what I've read in other posts, using Any CPU might also resolve the issue.
May be you have added user controls which are not supported or you might have added some wrong parent-child relationship in your user controls . Try removing the suspected User Controls and rebuilding the project . It must fix the issue .
Cheers
You need to re:encode your xaml, open bugged files in ide -> save as -> save encoded (choose UTF8)
I've the same problem while using controls with a custom (no param) Constructor.
Check if the Custom/User Control constructor doesn't require any data that the WPF designer doesn't have. A quick wait to check that is surrounding the whole thing with a try catch, cleaning, rebuilding and then check to see if the problem is solver.
If it is not, try commenting everything except the default WPF Init cod, clean, rebuild and test it out.
In Visual Studio 2013 this is a workaround I using for my Windows Phone Project, http://danielhindrikes.se/visual-studio/workaround-for-invalid-markup-problems-when-developing-for-windows-phone/. I guess it is the same designer that is used when you writing XAML for WPF.
Have tried to delete Shadow Cache but itjust work first time I start Visual Studio, above workaround is the only thing that helped me.
A little late, but something else to consider: If your no-parameter constructor is doing some other work, like getting data that doesn't exist because you are in the designer, add this at the start of your constructor:
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;
// Do work.
This is necessary because the designer does execute your no-parameter constructor which may fail in design mode an give you the invalid markup.
And, regardless of what others are saying, this is not a VS or WPF XAML Parser bug. I ran into this issue today using VS 2015, .Net 4.5.2.
I just had the same problem (program compiling and running fine, XAML designer reporting invalid markup), the issue was that I had accidentally changed the assembly name of one of the projects in my solution, I changed it back and my XAML designer sprang back to life, so check the Properties page of each project in your solution, and ensure the Assembly Name is as you expect it to be.
I think there is no problem in your project, but it is problem in VS 2012. Try to install the latest update for VS 2012 (Update 2) and also check this answer.
Regards,
I have the same Problem with VS 2015 and 2017 but only if I compile for x64 only.
Here it helps if I change compile target (Project properties - Build, its called Plattformziel in german) temporarily to x86, compile to project and switch back to x64.
Maybe this is a "solution" for anybody else.

Silverlight project won't enter debug mode

My Silverlight project in VS 2010 has stopped entering debug mode. Even if I set a breakpoint in the constructor of the Application class, it refuses to hit any breakpoints. My other projects are still fine, but I can't find any setting that may have accidentally gotten changed to keep me from debugging. What could be going on?
Open the properties of the associated Web Project. Select the Web Tab. Scroll to the bottom and in the "Debuggers" section make sure "Silverlight" is Checked.
Not sure what happened, but here's what got it working again.
I changed it to Release mode, compiled it. Closed and restarted VS, changed it back to Debug mode, ran it and breakpoints hit again.
Make sure the dropdown in the toolbar is set to Debug and not Release
While Attaching the process please attach w3p.exe and iexplorer instance of Silverlight this should resolve your issue.

How do I refresh the toolbox in Visual Studio 2008

Working on windows forms in Visual Studio 2008 with C#
So I had a windows Form Control that wasn't behaving the way I wanted. So I overloaded the Size property.
Bad idea. Everything broke. Horribly. I could not add this control to a form anymore. This was slightly problematic.
So I removed the offending code, and recompiled. Problem solved... right?
Not so much. I can't add this form to my code STILL. And it was working before. I scour the code for any changes I could have made, recompile again, and nothing changes.
So I conclude, that my code is correct, my DLL is pristine, and it's just not reloading the toolbox.
Close visual studio, open it back up, and everything works just fine. (well, works like it did before I broke everything)
Is there a way to do this WITHOUT closing out 2008? Because it's really quite annoying.
Try closing the solution & opening it again.
Or closing the toolbox tab & again enabling it via View-> Toolbox
Try Cleaning and recompiling the whole solution. Another trick is to delete all binary output (this includes the obj-folder) of each project.

WPF XBAP applications blank after second/third deploy?

This has happened repeatedly on various machines in VS2008 and Visual C# 2008.
I create an XBAP appliation.
I click the green arrow and it works.
I click Build/Publish and publish it to either a website or folder, it works.
I make some changes, publish again, and I just get a white screen. Both browsers, can restart, always blank.
It seems to be some kind of caching, etc. Has anyone had this happen to them and found a workaround?
Is the version number incrementing? Right click on the xbap project, go to properties/publish tab, increase the version number and republish.
You can clear the application store using mage -cc command from VS command prompt. Check out this post for more info.

Resources