Debug/Trace failing to write to Output windows in VSIX project - debugging

Is there any reason, maybe a known bug or missing SDK that would cause debug and trace to stop working in the following environment:
I recently formated my workstation. Fresh install of VS2010 Ultimate in a solution I've been working with for a month. It contains an exe and a vsix as it's outputs. debug and trace work in the exe but when debugging the vsix nothing is written to the output window. I have the VS SDK installed. I've used Import/Export settings to reset the environment. I've disabled all extensions (from the extension manager). I also tried deleting the .suo files in the solution.

Do you have Resharper installed by any chance?
When you break in the debugger and put System.Diagnostics.Debug.Listeners (or same for Trace) in the Watch window, what do you see?
Does doing System.Diagnostics.Debug.Listeners.Add(new DefaultTraceListener()) help?
Does adding a new TextWriterTraceListener work?

Related

Getting error 'IntelliTrace code failed (0x80131509)' when trying to debug Visual Studio 2019 solution

I am getting this issue when I try to debug an application that I tried to convert to SDK style. More information below. I am posting this in the hopes that someone can post a solution here. When I click ok to this error, the solution just disappears from VS like I had opened it without any solution at all.
IntelliTrace code failed (0x80131509)
Managed (.NET 4.x) code succeeded.
I have looked at other SO and forum posts about this issue, and the resolutions seem to be that they rebuilt their machine. Which is not really an option for me at the moment. I can try to re-install Visual Studio, which I might do soon.
How I came to be in this situation:
I tried to use Try-Convert to convert an existing .NET application to SDK style format. I have done this with other projects in the past with success. All I have to do is manually edit the TargetFramework aftewards to point to net472 or the desired version. In this case the conversion went very badly as this is an older code project with some pretty customized project files. As it went badly I decided to try to revert the projects to the old project format, and that is when this occurred.
Things I have tried:
Cleaning out the entire source folder, and re-getting latest
Running devenv /setup
Cleaning out both the %temp%, and asp.net temporary files directory.
Rebooting
All the options listed here by Del Developer Community Forum (Except repair which I am about to attempt)
Turning off IntelliTrace

MSTest cannot find TestAdapter.dll

I'm using the built-in Visual Studio test tools (Test -> Run -> etc in the menu). I just started having a problem where I get the following error when I try to run tests
[3/29/2018 1:39:14 PM Error] System.IO.FileNotFoundException: C:\Users\brubin\AppData\Local\Temp\VisualStudioTestExplorerExtensions\MSTest.TestAdapter.1.1.18/build/_common/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
at Microsoft.VisualStudio.TestWindow.Controller.TestPlatformProvider.PerformShadowCopy(IEnumerable'1 testExtensions)
That's followed by some errors that say
Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
When I look at the folder C:\Users\brubin\AppData\Local\Temp\VisualStudioTestExplorerExtensions\MSTest.TestAdapter.1.1.18/build/_common/, there are no files in that folder. However, I haven't knowingly changed anything about my test setup and this was working several days ago, so I don't know why it would have stopped working.
My projects are using the MSTest.TestFramework (MSTest V2) version v1.2 NuGet package.
One thing I noticed that may have caused this problem is that if I go to Tools -> Extensions and Updates, I see that my Microsoft Visual Studio Test Platform was updated a few days ago, on 3/23 (I think that's when I installed a Visual Studio update). However, if that broke something, I have no idea where to look to see what's broken, or how to fix it.
For me, clearing the VisualStudioTestExplorerExtensions folder and restarting Visual Studio (as per this github issue) did the trick. In my case, it contained two folders for different versions of MSTest.TestAdapter, I don't know whether or not that's relevant.
For anyone else who stumbles on this question, the problem was caused because a few of my test projects didn't have the MSTest.TestAdapter NuGet package included. I added the MSTest.TestAdapter package to all of my test projects, and the problem seems to be solved permanently now.
I spent the whole last week trying to solve the same issue. Only yesterday did I realize that running tests from the console is a time saver. Much to my surprise, I've just moved all my project -which was inside a "OneDrive" folder, to a different location. Now, it works like a charm! All my tests run from the Visual Studio IDE. I don't know if moving the files had anything to do with it, but you can give it a try.
Reinstalling all solution's Nuget packages fixed this issue for me.
Please run this command on the package console:
Update-Package -reinstall
then try again, or restart VS, then try again.
Reference: https://ardalis.com/force-nuget-to-reinstall-packages-without-updating/
Its a bug in Visual Studio. Upgrade the Visual Studio to version 15.7.
https://developercommunity.visualstudio.com/content/problem/222892/filenotfoundexception-microsoftvisualstudiotestpla.html
Yes you need to update "MsTest.TestAdapter" on all testprojects. The easiest way is to rightclick on master solution and click on manage nuget-packages. Then select " installed " tab and see if there is installed TestAdapter on each testprojects. If necessary you can update TestAdapter to newest version. Then restart Visual Studio and it should work.

Error in Windows Software Development Kit (SDK) stand alone Installation

While I want to write an app for Windows 10 IoT on Raspberry Pi 3 B I need to install Visual Studio 2015 Community with Windows SDK on a Windows 10 PC.
I already have a Windows 10 with Visual Studio 2015 installed and downloaded Windows SDK 10 stand alone but when I click on sdksetup.exe I encounter this error :
Some Features already installed on this computer are missing from the downloaded setup package.
Download the folowing features before retrying setup on this computer.
OptionId.WindowsSoftwareLogoToolkit
OptionId.WindowsSoftware DevelopmentKit
I am a bit confused. Why does it need to have packages that it says already installed and the thing is I want these packages to install I don't have them yet!
I will be appreciated if any body can help me and I will send any extra information if needed.
I had the same issue. I downloaded Windows SDK 10 stand alone with only Debugging Tools as selected. Deleting UserExperienceManifest.xml did not solve my problem. I resolved the issue by performing following steps.
Install following installer(.msi) files, located in Installers folder near sdksetup.exe, by double clicking themone bye one.
\Installers\SDK Debuggers-x86_en-us.msi
\Installers\X86 Debuggers And Tools-x86_en-us.msi
\Installers\X64 Debuggers And Tools-x64_en-us.msi
Confirm and verify whether C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe and C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe are created with all other binaries.
Now, open QtCreator. Go to Tools | Options | Build & Run | Debugger tab.
Verify above cdb.exe files paths are listed under Auto-detected section.
Debugging starts working after this.
This is caused by a bad set of checks in the installer, where you previously have installed an earlier version of the Windows SDK.
None of the solutions I came across worked, but I ended up fixing it.
I used CCleaner to remove bad Registry entries, and went through the registry manually and removed relevant keys that referenced the C:\Program Files (x86)\Windows Kits directory.
After I cleaned up the registry, it still didn't work, so I removed the UserExperienceManifest.xml file, and it ran the installer.
I think the combination of cleaning the registry and deleting that file were both key in getting this installer to work.
Just to be safe, I also ran a repair on my Visual Studio installation.
Hopefully this helps someone else. Been messing with this for hours.
Just set All Option, And download them to local storage,
excepting some option cause triggering error that needs more package.
Only setting method more package is that download from internet on MS.
but this error occur when downloading fails, like when it is offline.
So, just set All Option. And download Setup.
Use it to install.

Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging

I have a problem debugging a project migrated from Visual Studio 2010 to 2012. Every time I go to debug it I get the error message:
"Error HRESULT E_FAIL has been returned from a call to a COM component".
Compiling and running the application in a local IIS server works fine - just cannot debug.
The other change other than moving to VS2012 is I am now using Team Foundation Server for source control and issue tracking - but I cannot see how that would affect it.
I can narrow it down to the following
The project file - it has been migrated from VS 2003 as a website project and has been chopped and changed up the different versions
Crystal Report runtime library/ some other library
Anyone with any ideas?
I had the same problem with a c++ project in Visual Studio 2019.
The following solution worked for me:
Close Visual Studio.
Go to the project's root folder and delete the .vs directory.
Start Visual Studio and open the solution.
The build should now work.
I have been getting this a lot lately. I've been having to create a new file and move the code to the new file to get around it.
I fixed it by deleting the solution's suo file (as far as I can tell, it just stores info like what files are open in the IDE and stuff, and deleting it does no real damage).
My file was seemingly corrupt. (The IDE wouldn't remember what files were open when restarting. It was 1.7MB in size, which seems large, even for my 40 project solution, which rarely has more than 50 files open at once.)
Edit: I just recently had to do this in VS2017 but for another reason, it was taking longer to build and took 5+ minutes to stop a debug session, deleting that pesky suo file fixed it right up, now anytime VS acts weird deleting SUO is my first port of call.
I removed the csproj.user files and it worked for me.
In some other cases, to fix this error, I go to Web tab in the project properties and check "Use Visual Studio Development Server" and "Auto-assign Port". After that I need to rebuild the project and restart VS
This solved my problem:
Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll
Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll
Before this I tried the above solution from Simon, but didn't work for me!
Perhaps combining these two solutions did the job!
Sorry to revive a dead thread but i solved this on VS2017 by deleting the project template cache and item template cache folders in
%localappdata%\Microsoft\VisualStudio\[BUILD]
Then resetting the visual studio settings via
Tools>Import and export settings>reset all settings
Also ive heard turning off "Lightweight solution load for all projects" can help.
Doh! In case anyone else gets this error when trying to attach to an IIS Website.
Triple check that your hostname is correct, I had forgotten a '/' in (e.g.) http://my.testsite.com
Try this before re-installing Visual Studio like I did.. Terrible error message..
I wanted to add that I encountered this error when opening designer file in WinForms app. My issue was that one of the references in the project was referencing itself. Apparently this can happen as mentioned here
https://social.msdn.microsoft.com/Forums/office/en-US/00aede04-d8cd-4475-8114-4b4792261052/winforms-designer-error-hresult-efail-has-been-returned-from-a-call-to-a-com-component
I removed the reference and it is working fine.
Maybe this page helps:
Scenario Two:
The Microsoft Visual Studio 2010 IDE crashes while creating OR debugging a web application project.
This above error occurs because of corrupted Cache of Visual Studio 2010. In order to resolve the issue just delete the project Cache from the below location:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
C:\Program Files(x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
Then run devenv.exe /setup to re-build the cache.
I tried all of the above solutions none work for me, I found the solution here
Open ActivityLog.xml by going into
C:\Users\{UserName}\AppData\Roaming\Microsoft\VisualStudio\15.{Id}
Check if error states that
"CreateInstance failed for package
[ReferenceManagerPackage]Source: 'mscorlib' Description: Could not load type
'Microsoft.VisualStudio.Shell.Interop.' from assembly
'Microsoft.VisualStudio.Shell.Interop.11.0'
Then run this gacutil command through VS Cmd prompt (admin mode):
Navigate to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies
Run gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
It seems that to bring up the Add Reference dialog in Visual Studio 2017 the Microsoft.VisualStudio.Shell.Interop.11.0.dll needs to be regsitered in the GAC. You can follow these steps to register this assembly in the GAC:
Open the Develop Command Prompt for VS2017 (ensure you run the as administrator otherwise the GAC registration may fail)
Change the current directory to the PublicAssemblies folder for your Visual Studio 2017 installation. Mine was:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies
Run the following command to register the assembly in the GAC:
gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies>gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly successfully added to the cache
Now restart VS2017 and try to add a reference to your project again and you should see the Add Reference dialog appear.
For more clarification please follow below link
https://camerondwyer.com/2017/05/03/how-to-fix-the-operation-could-not-be-completed-error-adding-reference-to-visual-studio-2017/#more-2286
I found the solution below on https://developercommunity.visualstudio.com/content/problem/260196/add-a-reference-raise-error-error-hresult-e-fail-h.html address.
It worked for me in VS 2019:
1 Open "Developer Command Prompt for VS 2017" as Admin
2 CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
3 Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.
I had the same issue after an upgrade from VS2013 to VS2015.
The project I was working at referenced itself. While VS2013 didn't care, VS2015 didn't like that and I got that error. After deleting the reference, the error was gone. It took me around 4 hours to find that out...
Just delete packages folder.That helped me
Root Cause:
Microsoft.VisualStudio.Shell.Interop.11.0.dll is missing from GAC.
Solution:
1. Go to start menu and Open Command Prompt for Visual Studio
2. Enter command gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
3. If in case your system unable to find this dll file then you may download it from Nuget package manager and then can provide the path of dll
All set! hit enter and you're done!
In my case, it seems it was because I stashed some files, but some related windows remained open.
Closing all windows and rebuilding solution fixed it for me.
I wrote a simple program to open different folder while clicking on some specific buttons. I made the file properties as "content" and "copy if newer" to make deployment. So if I installed the exe file in the other software it actually install all of its resources and run the program fine.
So, this is all about my program. While developing this sometimes if I run the program to check, it showed the error
"HRESULT E_FAIL has been returned from a call to a COM component"
and I could not open the designer view. But Somehow I got an easy solution for me. I am not sure whether it will work for other or not.
Here is the solution:
Copy the whole application folder to another location. click on the application file from there.
it will not work since it is just a copy and you will not see the designer
From the solution explorer delete the form1.vb ( or may be a different name if it was changed during developing)
In the solution explorer>right click>add an existing item> browse the file Form1.vb from where the folder is copied ( orginal location)
run the program in the new location. It will work
The problem with this solution if you want to add something and after running the program you find the same error, you have to copy the whole application folder in another location again and follow the above steps
Not sure about the exact reproduction steps for the error (HRESULT E_FAIL has been returned from a call to a COM component), but the solution for me was:
Close Visual Studio and Repair it through Control Panel.
Restart system
After the restart, the error was gone.
The error occurred for me after I installed the latest Windows 10 SDK. I was getting the error while building a C++ project using SDK 8.1. In Project properties, I switch to latest 10 SDK. rebuild. That worked. Changed back to 8.1. Rebuild. No error.
Steps to resolve the issue:
1.Open your solution/Web Application in VS 2012 in administrator mode.
2.Go to IIS and Note down the settings for your application (e.g.Virtual directory name, Physical Path, Authentication setting and App pool used).
3.Remove (right click and select Remove) your application from Default Web Site. Refresh IIS.
4.Go back to VS 2012 and open settings (right click and select properties) for your web application.
5.Select Web.In Servers section make sure you have selected "Use Local IIS Web Server".
6.In Project Url textbox enter your application path (http://localhost/Application Path). Click on Create Virtual Directory.
7.Go to IIS and apply settings noted in step 2. Refresh IIS.
8.Go to VS 2012 and set this project as startup Project with appropriate page as startup page.
9.Click run button to start project in debug mode.
This resolved issue for me for web application which was migrated from VS 2010 to 2012.Hope this helps anyone looking for specific issue.
My machine configuration is:
IIS 7.5.7600.16385
VS 2012 Professional
Windows 7 Enterprise (Version 6.1 - Build 7601:Service Pack 1)
This happens in our TFS build server some times (Gated check in). It is about workspace folder. I don't know why but workspace folder access sometimes corrupt. What I am doing to fix issue is deleting TFS build workspaces and deleting relevant workspace folders. TFS build machine then create new workspaces for itself and problem is fixed.
Tousif Ahmed's solution should work for local builds. Copy application folder to another place should do the same thing what I am doing in TFS build machine.
In my case, it appears that this message can be issued by Intellisense in Visual Studio 2013. The screenshot below shows the error at the bottom of VisualStudio 2013 after the first load of a customer project.
I started googling what causes this error, and decided to try deleteing the user.vxproj files as mentioned above. I found however that the project built with no issues, then after exiting and re-loading the project, I no longer received the error. So I'm assuming in my case, it was some corruption due to moving the project from the customers directory tree structure to my local development disk tree structure. The key here is that in my case, the problem was transient. I did NOTHING and the problem appeared to resolve itself. (Not generally a desirable thing as I didn't fix anything so it might come back).
I recently spent about 3 hours trying to fix this issue on my ASP.NET app running on local IIS. I had 'Override application root URL' specified and I specified the url with an ending forward slash (/) such as http://my.dev.com/. If I saved the project options and came back in it would show the overrided root url as http://http://my.dev.com. Once I removed the last forward slash it started to behave ok and the error went away.
HRESULT E_FAIL has been returned from a call to a COM component
In my case, it was because i had differents projects with same GUID in my solution. (Project was created by copy/paste)
My problem manifested with opening Win10 appxmanifest file (no pun intended). Simply installing Windows 10 tools and SDK (go to New->Project->Select Windows->Install Tools) fixed it.
Add on development initiated on x86 architecture or 64 bit system then it will run on 32bit system also.
but if you Add on development initiated on 32 bit system and then you want to do changes on source code in 64 bit
Note: if you are connected SAP Licence on server system then set the port and set server name through service manager otherwise System will give error:
Connection Context :- Retrieving the COM class factory for component
with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60090} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I fixed the same issue by deleting ComponentModelCache folder
Close Visual Studio (if you haven’t done so already out of despair)
Open a file explorer window and navigate toyour AppData folder. You can get there by:
In the search bar, type %APPDATA%/.. and press enter
Alternatively, navigate to C:\Users\\AppData
Go into Local\Microsoft\VisualStudio\<version> where is 12.0 for Visual Studio 2013.
Delete the ComponentModelCache folder.
From here: http://withmartin.net/how-visual-studios-component-model-cache-can-be-a-pain/
I faced the same issue in Visual Studio 2017,
Do follow these steps:
Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll
Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll
Clean the Project.
Restart visual studio.
Step 1 and 2 were copied from Besnik Kastrati post.
I find this answer
click Ctrl+Alt+J
click (...) in the top
now you can add dll from Browse , .Net or another
After clicking the OK button click at (add to references in selected Project in solution explorer) (this is a green plus "+" button)
I got this error when trying to install a nuget package that I had previously downloaded and installed in another project.
Clicking Clear all NuGet Cache(s) under Tools > Options > NuGet Package Manager solved this for me
I encountered this error after installing VS2019 but while trying to open a large solution (20+ projects), with both vcxproj and csproj projects, that target VS2015. The csproj all loaded fine, while the vcxproj all failed with the OP's error. Deleting the .vs folder did not work.
What did work was setting VC++'s "Fallback Location", under the "Browsing Database Fallback" settings.
Tools (menu)
-Options...
--Text Editor
---C/C++
---Advanced
----Browsing Database Fallback
-----Fallback Location
I set mine to D:\VC++\v16. Where I use v140 for VS2015 and v141 for VS2017. Also set "Always Use" and "Do not warn".

Visual Studio Creating Debug File In Release Mode

I asked a similar question a while ago Error Creating Debug Information - Code Won't Compile but never found a solution.
That problem seems to have evolved a bit. Now Visual Studio is creating a PDB debug file even when the application is in Release mode and debugging is turned off in Web.config. This PDB file is getting locked by Visual Studio and sometimes w3wp.exe. Compiling fails saying the PDB file is in use by another process (devenv.exe, w3wp.exe, or both). I cannot compile until I use Unlocker to release all the locks.
First off why is VS creating a debug file when in release mode?
Secondly how can I fix this? I have run a repair install on VS and re registered ASP.Net with IIS but that didn't help. I am using Windows Server 2003, VS 2008 Standard, and IIS6.
The first symptoms showed up a week or two ago when I was working on a WPF application. Until today putting the project in Release mode made the problem go away. Now it is happening even in Release mode.
Any ideas?
PDB files are created for release builds too - that is by design so you can still debug crashes in a release binary.
The PDB file is certainly not required for running. However, if it is in the same directory as the binary being run, IIS may be loading it (not really sure what IIS does here though). You can copy the binaries to a different folder (minus the PDB files) to prevent this problem.
Did you try this: http://callicode.com/Homeltpagegt/tabid/38/EntryId/24/How-to-disable-pdb-generation-in-Visual-Studio-2008.aspx?
You can also add custom after-build event to release configuration to delete the pdb file if everything else fails.

Resources