XAML changes does not update after build - c#

I am creating a WPF application. I have worked on it for more than 6 months with no problem, but now, suddenly, any modifications I make on the interface, will not be updated after I build.
I am using VC# Express edition.
I tried other projects and they work fine.

Have you tried cleaning the solution and performing a full rebuild?
Clean solution is found in the "Build" menu.

Maybe you have errors, and disabled the message, telling you about these errors, then the debugger runs the old version without errors.

Related

ENC1003 C# Changes made in project will not be applied while the application is running

I am getting this incredibly annoying warning for every C# file in my ASP.NET Core project when I debug it after hitting F5:
Because this error appears only during runtime (not during build), I can't even suppress it using the "Suppress warnings" box in the project properties. I've tried putting 1003 and ENC1003 in there and it still appears, cluttering up my warnings window. Does anyone know why this thing is appearing and how I can get rid of it?
UPDATE: It doesn't fix the fundamental problem which is that the warning is generated in the first place, but I've found a way to suppress it. Create a GlobalSuppressions.cs file at the project root, and add the line:
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(null, "ENC1003")]
Related Github issue: https://github.com/aspnet/AspNetCore/issues/13284
Try to get the Lastest Version of your Visual Studio and try again, If Persist, Install Visual Studio 2019 v16.4 Preview 2.
Also Check out the following content>> https://developercommunity.visualstudio.com/content/problem/601258/edits-were-made-to-the-code-which-cannot-be-applie.html. You can also track this same issue on ASP.NET Github: https://github.com/aspnet/AspNetCore/issues/13284. We already have a fix for it, which will be available on Visual Studio 16.4 Preview 2
I was facing the same problem in my Visual Studio 2019, and therefore I had to update VS to the latest version and I was good to go.
Hope helps someone :) :)
You can go to build options and select the option to build solution (build->build solution), this should solve the problem and you will able to continue your project in solution mode.
I had this problem also in Visual Studio 2022 (17.0.5) running API projects. Restarting Visual Studio helps.
In the past, while debugging UAP apps, if I edit the code while the app is running it will let me know that it needs to recompile the whole application. (Usually when adding some sort of static variable or removing a function etc... Tht in and of itself is not a bug.
The bug is that when I STOP debugging, the error remains until I restart the IDE.
I would argue that suppressing the warning is a horrible idea - It means that you have no way of knowing if the code changes you made during debug were implemented.
Instead, try restarting the IDE and doing a clean and build. I don't remember what I do to make the error go away anymore, as I have not experiences this bug in at least 8 months.

VS2017 Page is not supported in a Windows Universal project

I have a rather unpleasant problem since yesterday...
I cleared my NuGet chache because I couldn't get a NuGet-Package to work with one of my codes. But it didn't help and instead f***ed up the UWP apps I wrote before that.
I get errors for every element I have in my code like this:
In XAML it's mostly "XXX is not supported in a WIndows Universal project" and in the .cs files its a lot of "Cannot resolve symbol XXX"
How can I repair this?
I can compile and run my code just fine but I can't work with the code when everything gets detected as an error in VS and I can't see my UI while designing it...
I could really need some help here :/
Just putting this here... I had the same problem suddenly.
Updating the NuGet package for Microsoft.NETCore.UniversalWindowsPlatform fixed it for me instantly.
Ok I don't really know why that happend but I found my answer...
I tried restarting VS which didn't solve problem.
I tried restarting my PC which didn't solve problem.
I tried to build my code which didn't solve problembut no errors while building.
I tried to run my code which didn't work but app opens without a problem.
Next step confuses me a bit...
My Code is divided into 2 projects. One for all the XAML files and one for all my code files like Helpers, Converters, Collections...
I opened the NuGet-Manager in the second project and looked for possible updates to my packages. There was an update for the Fody-Package which I installed right away. Now everything seems fine again...even in the XAML project...
I don't understand why it works but it does :/

Intellisense no longer works

I've been using Visual Studio Code with unity for around 2 months now without problems, but since last week I suddenly get no more Intellisense (no code completion for C# or Unity). I don't recall changing anything and I have no idea why it suddenly stopped working.
I was using Unity 5.4 with this recommended plugin to enable VSCode integration when Intellisense stopped working.
I've already reinstalled VSCode and updated Unity to version 5.5. Unity 5.5 has built in support for VSCode, so I've removed the editor plugin from my project. I can indeed open Unity scripts in VSCode without the plugin now, but I'm still not getting any code completion.
I saw there was an update for the C# VSCode extension today, but updating that didn't help either. I've attached a screenshot of the log during this update:
As you can see there's no flame icon and the code completion is missing. The Omnisharp log is either empty or completely missing (not sure why this behaviour is not always the same).
Does anyone have any idea what I can do to fix this? Thanks.
So in my experience, whenever something weird like this happens in Visual Studio, the first thing you should do is kill all instances of VS and restart. For good measure, you could even reboot your computer, though this is often not necessary. If that still doesn't help, the next best thing is to reset your VS settings which can be done by going to
Tools -> Import and Export Settings -> Reset All Settings
A backup of the current settings are recommended, but not required.
After checking that VS is the default editor in Preferences, open your Unity project with Explorer. See if you can find a .sln file, and open it with VS. Then, go to your solution manger inside VS and try and open any of your Unity project's scripts from the manager. After doing this, your Intellisense should be working.
This worked for me when I had a similar issue side time ago.

VS 2008 suddenly can't start debugging session

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.

Error Creating Debug Information - Code Won't Compile

I'm using VS 2008. When ever I make a change in my code and try to compile I get the following error:
Error 7 Unexpected error creating
debug information file 'C:\Documents
and Settings\jbezanson\My
Documents\MyProjects\DispatchBoard\DispatchBoard\obj\Debug\DispatchBoard.PDB'
-- 'C:\Documents and Settings\jbezanson\My
Documents\MyProjects\DispatchBoard\DispatchBoard\obj\Debug\DispatchBoard.pdb:
The process cannot access the file
because it is being used by another
process. ' DispatchBoard
Using Process Explorer, it is always devenv.exe that is locking the file. If I run in Release mode this does not happen. It started 2 days ago when I started a WPF application, and since then it happens with every application I work on.
The only info I could find from Google was referring to a bug in VS 2003.
Anyone else have this problem? How do I fix it? It is getting very annoying having to kill the file handle every time I want to compile.
If you have multiple instances of VS open, close other instances (apart from the one you are trying to compile) - this may resolve the issue.
When I have problems with locked files, I use Unlocker. (If you tried everything and it's not working, try this ;)
In case of broken link, here's a mirror.
Have you tried closing VS, deleting obj folder then restarting VS?
I had the same problem this morning and noticed that I had another project open that had a reference to the one that would not compile or debug. I removed the reference (as I didn't actually need it) and it was fine.
I changed the 'StartUp Project' of my solution to a project without reference to the locked file's project.
This solved the issue for me using VS 2010 SP1.
(Process Explorer said msvsmon.exe (started by devenv.exe) locked the pdb file.
After changing the startup project the processes msvsmon.exe and .vshost.exe disappeared and so did the file handle.)
Alex Clark, thank you for pointing me in the right direction.
The only thing that worked for me is to remove the optimizeCompilations="true" attribute from on the compilation element in my Web.Config file.
Compilation time may be a little longer, but it worked well.
To avoid that problem just open the project properties, go to Debug tab an untick "Enable the Visual Studio hosting process"
I had this issue today. In my case, I had just grabbed the data from my company's source control and instantly hit this issue when I tried to compile the project. The issue ended up being that the \bin folder was set to Read Only. To solve the issue, I just made the folder not Read Only.
I just came across the same problem today. And then I realized what went wrong: I had couple of Visual Studio windows opened at the same time, and one of them was in debug mode.
When I stopped debug mode in that one, the problem was solved.
That happens when you have a "fistfull of VS windows" opened.
Right Click The Folder that contains debug .pdb and uncheck the folders read-only propertys then ok. thats it.
This works for me with web projects in Visual Studio Express 2012 for Web:
Press F5 to begin debugging
"Do you want to execute last successful build?" - hit YES
At this point you could try a request - not sure if this step is necessary
Hit the stop button
Recompile successfully
I have solved a similar problem by adding these lines as a pre-build event:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" move "$(TargetPath)" "$(TargetPath).locked"
With proper modifications, it might help your problem.
Since you say you have it on all applications you work on it sounds like a more global problem. You could try and reinit the vs2008 by writing
devenv.exe /setup
Edit: link to command line options
This worked for me. What I done was that close my visual studio and delete the .suo file and then re-open the solution. The locking should be disappeared now. Cheers.
Old topic, but something that worked for me. I had 2 projects in my solution, a class library type project and a windows form project. The windows form project was referencing the compiled binary and not the project itself in my case which was causing the lock. After changing the reference to the class library project, it worked properly.
Not need to restart or delete the file.Deleting will not be possible , you will get error message. Just rename the file and that is enough.
VS2010 will create another file for you as it wont find the origional. :)
I had the same issue from time to time. Usually no problem but once in a while... This particular time, it was impossible to work. I would shut the application down, and even that didn't work most of the time. I saw this post and a person said they had no issues until they started a WPF application. I was playing music (radio station) in the background with Windows 8 "Music" app. I had the idea that it was a Microsoft App built with Visual Studio. Once I stopped playing music, I never encountered the error. If you are reading this, see if you have any Microsoft apps running.
I also had the same issue. Tried all the suggestions above with no luck. I eventually change the Build Configuration from Debug to Release, the solution built...
This problem started occurring for me after changing from Cassini to IIS Express as my platform for debugging.
Cassini was much better than IIS Express but doesn't properly support the Integrated pipeline. IIS Express is hopeless.
This seems to be some sort of race condition in Visual Studio or IIS Express. It is nothing to do with one project locking another project - the locks are coming solely from the activity of the web application's build process.
Anyways, none of the above solutions worked for me. Unlocker doesn't seem to be supported for Windows 8 anymore. So instead I tried LockHunter. What I do is keep the LockHunter app open all day. If I get a complaint about some file being locked I copy and paste the file path into LockHunter then try again. This usually sorts out the problem but sometimes takes a few attempts.

Categories

Resources