set property 'system.windows.resourcedictionary.deferrablecontent' threw an exception - visual-studio

I'm running Visual Studio 2012, when I add a new File/Reference to a project the message box appears showing the error message
set property 'system.windows.resourcedictionary.deferrablecontent' threw an exception
I read an MSDN article suggesting to run the command devenv /resetuserdata on visual studio command prompt to resolve this problem, tried it but didn't work for me. In fact the command prompt shows the Unknown Error message.

Some addins cause this issue for me so have had to workaround it whenever it occurs:
In Vis studio -
Tools > Options > Environment > Add-in Security, uncheck 'Allow Add-in components to load', OK
Restart vis studio
The error shouldn't occur anymore, so go back to
Tools > Options > Environment > Add-in Security and re-check Allow Add-in components to load, OK
To be specific, I get this error when trying to add files to projects and manage Nuget Packages.
Update
I now make a point of opening
'Tools > Nuget package manager > Manage nuget packages for solution'
whenever I open up a new instance of Vis studio, before loading a solution, just to make sure the window loads properly
That way I know I won't get this issue.

In my case it was a style with the same key defined twice in a ResourceDictionary (WPF)

I have Windows azure tools for Microsoft VisulStudio 2013- v2.2 and Windows azure tools for Microsoft lightswitch VisulStudio 2013- v2.2.
I uninstall only Windows azure tools for microsoft lightswitch vs 2013 .
It's working fine...

I fixed it. The resolution was to remove the Windows Azure Tools for Visual Studio 2012 which I was not actually using, and the error went straight away.

In my case it was to first launch Visual Studio in safe mode. You can create a shortcut for visual studio with a target like this:
'"F:\Program Files\Visual Studio\VS2013\Common7\IDE\devenv.exe" -safemode'
Once launched in safe mode, you can remove the problematic extension via the Addin Manager. However, this wont work for some extensions, as the uninstall option might be disabled for certain extensions when running in safe mode, particularly if you have already uninstalled another extension in the same session.
In My case the problem was caused by Paradox Game engine, in which I had uninstalled it via 'Programs and Features' - which in return did not remove the extension which was originally installed via Nuget package. Uninstalling Paradox via "Programs And Features" left the extension itself still registered in Visual Studio, presumably causing a hidden NullReferenceException.
This issue can be caused by any extension that may have an error in it, or by extensions that were not properly uninstalled.
Also, see this article...

The mentioned issue can be resolved by simply restart the Visual Studio. :P

Also seem to be able to get around this by closing the project and vis studio instance, re-opening, then when the start page/open project screen appears selecting Tools > Extensions and Updates..., then pressing Close
Now open the project and the error doesn't get thrown when trying add files or manage nuget packages, weird.
Just annoying you have to remember to open Extensions and Updates each time...

Other wise make sure given Resourcedictionary.xaml path is correct or not

I had to remove Xamarin from Add/Remove Programs in Control panel and restart Visual studio to fix this.

I had this problem with My Devexpress Project in VS 2015
What finally worked for me was.
Close my solution,
Close Visual Studio,
Open Visual Studio,
Create a New dummy project,
Add a form to it,
Close and save the new project,
Reopen original project and all was ok.

for everyone else who are working in silverlight sdk environment with windows phone8 sdk.
The versions of sliverlight which are compatible with visual studio versions -
vs2012- sliverlight sdk 4
vs2013- silverlight sdk 5
I was integrating in vs2013 and as soon as I updated it with silverlight sdk 5, The errors went away.

In my case it was the Line Endings: you can have different formatting and by copy pasting some code one file got a different Line Ending. It was enough to File > Save As and then click the little arrow next to the save button.
Then click on save with encoding and choose the one you are using in all other files.
See Andrew Truckle's answer.
I hope this helps

Related

VisualStudio not saving Startup Window

Since a few weeks I have had this infuriating problem.
Whenever I start VS it opens an empty environment.
I tried to change that in Options > Environment > Startup from "Empty environment" to "Start window". After pressing "OK" I restarted VS completely and reopened it. Again: a new empty environment opens.
After reinstalling VS several times now I gave up and want to know, if someone had a similar problem and knows a fix for this problem.
Visual Studio Enterprise 2019 (16.8.3)
Installed Workloads from VS-Installer:
ASP.NET and web development
Azure development
Python development
.NET desktop development
Desktop development with C++
Data storage and processing
.NET Core cross-platform development
Additional Extensions:
JetBrains ReSharper 2020.2.4
Visual Studio Tools for Tizen
*all the extensions are up-to-date
After MONTHS I finally found a solution. I basically tried to uninstall all extensions and discovered that this issue only occurs while ReSharper is installed. I didn't find anything regarding this on the internet, therefore I searched all of the options and I finally found the issue!
If you have the same issue and have ReSharper installed (currently 2020.3.3) open Visual Studio and go to Extensions/ReSharper/Options. A new window will pop up. Then navigate to Environment/Performance Guide and under the group Visual Studio preferences affecting performance you'll find the item Show empty environment at startup. Set it from Fix Silently to Ignore. Click Save and close this window.
Additionally, you have reset the specific Visual Studio option. Therefore open Tools/Options and navigate to Environment/Startup and set the On startup, open: to Start window. Click OK and restart Visual Studio to check if the Start Window now gets displayed correctly.

Visual Studio syntax highlighting / autocomplete not working correctly

My Visual Studio does not highlight or autocomplete any Unity3D commands any more. I created a new script when noticing that. I restarted VS, reinstalled VS, also reverted all script changes I made today in my project but the result is still the same. Also I now get errors when trying to open my project file. It says it needs a migration and isn't compatible with the current Visual Studio version installed.
The actual error reads "The application that is based on this project type was not found." [translated from German].
I found similar posts on the web where reinstalling VS resolved the issue. Unfortunately, it did not for me. This is how it looks:
Anybody knows how I can fix this?
Ok, I was able to resolve this issue using this trick:
"Do me a favor... if this is Visual Studio 2017... hit your start menu and find Visual Studio Installer... Run it... select "Modify" and select individual components... find Visual Studio Tools for Unity... if it's installed, untick it and uninstall it, then run the installer again and reinstall it. Otherwise, just tick it and install it."

VS2013 Build "Does not support previewing"

Every time I try to build my solution in VS2013, nothing builds, no errors - But in the status bar it says: "This item does not support previewing"
I googled around a bit but have come up empty.
But if I right click on each project and select build it works fine.
Any ideas?
Perhaps this message is totally unrelated... Post hoc ergo propter hoc
Steps to reproduce on my machine:
Right Click any project in solution: select build
Status bar displays Build successful
Right click solution select build
Status bar displays : "This item does not support previewing"
Perhaps it isnt related, but it sure does appear to be.
I was able to fix this... Somehow nothing was selected to build in the solution configuration. I right clicked on the solution, went to properties and then selected COnfiguration Properties and clicked the Build box for all the projects...
I have no idea how they became unchecked, only thing I can think of is a co-worker was trolling me.....
I've had this problem (i.e. debug not starting, and no error message) with Visual Studio 2015 in the following two cases:
after loading a solution that had previously been built with Visual Studio 2010
and also after using the "save as" function in Visual Studio 2015 to update a solution that had been started with Visual Studio 2010 (using Save as updates the solution file and sets the active Visual Studio version to 14 - i.e. VS 2015).
In both cases, deleting the bin and obj directories under the startup project fixed the problem. It's also worth closing visual studio and making sure that there are no {yourprojectname}.vshost.exe processes still running - if there are then kill them before running visual studio again. On that note, if you have multiple versions of visual studio on your machine, you should also check that you don't have the same solution open in the other version of visual studio at the same time (I've done that one myself).
One of the comments here suggests disabling the "enable visual studio hosted process" option. Don't do that if you can at all avoid it: you'll lose lots of debugging functionality (particularly in the area of being able to edit code while your solution is running).
Hope that helps someone out there.
Solution for VS2015
"this item does not support previewing" vs2015 (Visual Studio 2015/2016)
Step 1. Go to Control Panel -> Programs and Features
Step 2. Uninstall all: Windows Software Development Kit - Windows 10.0.10586.15 (maybe you have diff ver)
Step 3. Download new latest Windows Software Development Kit
https://go.microsoft.com/fwlink/p/?LinkId=619296
Install & Create new project, Done!
Dclick on MainPage.xaml and you will see Loading designer...
1: Add below lines in App.conf
<specFlow>
<unitTestProvider name="MSTest"></unitTestProvider>
</specFlow>
2: add a reference to Microsoft.VisualStudio.QualityTestTools.UnitTestFramework.dll
right click on your project and select: Add Reference
3: add using Microsoft.VisualStudio.TestTools.UnitTesting; in Step Defination
4: goto feature file and run it. This is what solve my problem on vs2013
I faced same issue with .aspx file. I just right click on the .aspx file and select open with (HTML Editor). You can choose any form the list.
I have come across the same issue for me, I have opened a project in VS 2010 and then when I open the same in VS 2015 then his error has occurred.
Solution:
By Closing the VS2010 project solution fixed the issue.

Visual Studio - Error when clicking on Solution -> Properties (Object reference not set to an instance of an object)

When i try to access my solution Properties, i get the following error:
Object reference not set to an instance of an object
I am using VS 2012. What could be the cause of this?
Some extensions may cause this.
Try disabling extensions and restarting Visual Studio.
Quite often error will be gone even if you re-enable extensions after this.
There's a bug report on Microsoft Connect (link).
It is marked there as "Closed as External", but it seems that it may occur randomly with any extension, so would be worth voting it there to bring it to Microsofts attention.
In my case, the problem was solution-specific. NuGet was causing this error, but not the extension itself but a NuGet package that generated an error on VS load. When I opened NuGet Package Manager Console I saw a big red text with a description of the error. In my case it was T4Scaffolding.Core package, which in turn is a dependency of MVCMailer.
If this is your case, you will probably see what package generates an error in PM Console.
I faced this dialog too and i'm not sure what exactly causes this as i couldn't even open the NuGet console to see detailed error messages.
Closing Visual Studio, deleting %AppData%\Microsoft\VisualStudio and restarting Visual Studio worked for me as it causes a reset of various things like window configurations.
I think if this dialog is displayed some files may be corrupt in %AppData%\Microsoft\VisualStudio and by deleting that folder Visual Studio can start normally again.
Update:
The issue arises on my machine when i start Visual Studio by using "run as administator" whereas Visual Studio has been started before without that option and %AppData%\Microsoft\VisualStudio had been created without the administator association.
Visual Studio 2013: I had this issue when I tried opening TOOLS -> Extensions and Updates.
I used #ViRuSTriNiTy idea, but only cleaned the files from:
C:\Users[myUserName]\AppData\Local\Microsoft\VisualStudio\12.0\Extensions
There are 2 cache files over there.
Deleted them and restarted VS2013 and it was fixed
The way it was happening for me might be unique to me/my setup, but I'd love to know if anyone else has this happen, and if they find out why:
If I launch an .sln file by double-clicking it, it will load VS and I can right-click the Solution and get Properties to come up no problem.
If I go to "Open Project" on the Visual Studio welcome page or from File > Open > Project/Solution, navigate to the .sln file and launch it by selecting it and clicking "Open" in the File dialog, that's when I have this issue.
I'm going to just always launch the .sln file from now on, but I'd love to know why this happens when using "Open Project" from the welcome page or from File > Open > Project/Solution! I tried going into Tools > NuGet Package Manager > General and I unchecked the options for allowing NuGet to download missing packages and Skip applying binding redirects, and under Package Sources I de-selected the checkboxes (my dev machine does not connect to the internet). Environment > Extensions and Updates: I tried it with and without "Load per user extensions when running as administrator" and running it as an Admin and without running as Admin. Also tried just deleting everything at C:\Users\me\AppData\Local\Microsoft\VisualStudio. No change from those 2 bullets above.

VS 2010 Properties Page Fail to Show-COM object that has been separated from its underlying RCW cannot be used

I'm using Visual Studio 2010 Ultimate edition, but now it won't show the project properties page. Instead an error message show up saying
An error occurred trying to load the page.
COM object that has been separated from its underlying RCW cannot be used.
This error has plagued me for a long time. I tried almost everything (uninstall/reinstall/repair/uninstall addins, etc) except reinstall
OS.
Help me out. Thx a lot!
Finally I found out what had gone wrong. It's misbehaving addin - TestDriven.NET.
But things could be different for you. But anyway, it's addins.
The process to find this is that you Goto "Tools -> Options" dialog. Goto "Environment -> Add-ins/Macros Security" node. Uncheck "Allow add-in components to load". And then restart VS 2010 to see if the issue goes away. If it does, then it must be an addin in those folders specified. And next step is to enable addins to load, and remove the directories in the list one by one to identity which addin caused the issue. And at last, disable or simply remove/uninstall it.
Restarted VS 2010 SP1 solved my problem!!!
in my case it was the latest update of VSCommands for VS2010...
A complete UnInstall/Re-Install of the VSCommands did the job :)
This also happened to me for some unknown reason and it turned out I had to disable source-control plugin (the default one that had been happily working for a long time):
Tools -> Options -> Source control : set plug-in to "None" and restart VS.
I was facing the same issue in Microsoft Visual Studio Professional 2015 Service pack 1. I found that it was happening due to GhostDoc Community.
I upgraded GhostDoc Community 4.9.x to 5.1.x and issue get resolved in Visual Studio 2015 Service pack 1.

Resources