locked
Winforms designer - Error HRESULT E_FAIL has been returned from a call to a COM component. RRS feed

  • Question

  • Hello,

    I recently got a new computer with Windows 10 and installed Visual Studio 2015 Community edition.

    Opening a winforms project I made in Visual Studio 2012 Community edition I get an error opening the designer on some (but not all) custom controls and forms. A similar project in the same solution made around the same time does not have these errors.

    The error is: "Error HRESULT E_FAIL has been returned from a call to a COM component."

    Stack trace:

    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
    at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.LookupTypeSymbol()
    at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.get_TypeKind()
    at EnvDTE.CodeTypeRef.get_TypeKind()
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.GetUrtTypeFromVsType(CodeTypeRef vsType)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnTypePopulateMembers(Object sender, EventArgs e)
    at System.CodeDom.CodeTypeDeclaration.get_Members()
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.CodeTypeDeclarationPopulator.OnPopulateMembers(Object sender, EventArgs e)
    at System.CodeDom.CodeTypeDeclaration.get_Members()
    at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
    at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload) 

    I've tried deleting the ProjectTemplatesCache folder and running "DevEnv /setup" which was the suggested solution in most forum posts where I found this error, but this didn't fix the problem.

    Any help  troubleshooting and fixing this would be much appreciated.

    Kind Regards


    • Edited by Monkehman Friday, October 16, 2015 7:01 AM extra clarification
    Friday, October 16, 2015 7:00 AM

Answers

  • Hi,

    If you use VS2015 on windows 8.1 to open winform project, do you meet the same issue? I just want to know if this issue is specific to windows 10 system.

    And before deleting ProjectTemplateCache and running DevEnv/setup, have a try

    Start —> Run —> regsvr32  %SystemRoot%\System32\msxml3.dll

    Start —> Run —> regsvr32  %SystemRoot%\SysWOW64\msxml3.dll

    May 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by May Wang - MSFT Monday, October 19, 2015 9:47 AM
    • Proposed as answer by May Wang - MSFT Wednesday, October 21, 2015 6:13 AM
    • Marked as answer by Fred Bao Thursday, October 22, 2015 7:10 AM
    Monday, October 19, 2015 9:43 AM

All replies

  • Hi,

    If you use VS2015 on windows 8.1 to open winform project, do you meet the same issue? I just want to know if this issue is specific to windows 10 system.

    And before deleting ProjectTemplateCache and running DevEnv/setup, have a try

    Start —> Run —> regsvr32  %SystemRoot%\System32\msxml3.dll

    Start —> Run —> regsvr32  %SystemRoot%\SysWOW64\msxml3.dll

    May 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by May Wang - MSFT Monday, October 19, 2015 9:47 AM
    • Proposed as answer by May Wang - MSFT Wednesday, October 21, 2015 6:13 AM
    • Marked as answer by Fred Bao Thursday, October 22, 2015 7:10 AM
    Monday, October 19, 2015 9:43 AM
  • I'm getting this exact same error on windows 8.1 with a specific windows forms project.  The suggestions above do not address the issue.  Any more suggestions?
    Thursday, November 12, 2015 6:57 PM
  • I'm getting this exact same error on windows 8.1 with a specific windows forms project.  The suggestions above do not address the issue.  Any more suggestions?

    Which version of Visual Studio? Are you using a custom control? Which control are you clicking on that is causing the issue?

    Remember, the more information you provide, the more likely you will receive a helpful response. I also suggest in future you open a fresh thread and then reference another thread if you think it is appropriate using a hyperlink. Often readers will skip threads that are marked as answered, such as this one.

    Thursday, November 12, 2015 7:23 PM
  • I'm getting this exact same error on windows 8.1 with a specific windows forms project.  The suggestions above do not address the issue.  Any more suggestions?

    Which version of Visual Studio? Are you using a custom control? Which control are you clicking on that is causing the issue?

    Remember, the more information you provide, the more likely you will receive a helpful response. I also suggest in future you open a fresh thread and then reference another thread if you think it is appropriate using a hyperlink. Often readers will skip threads that are marked as answered, such as this one.

    Visual Studio 2015 Professional (14.0.23107.0 D14REL)

    No custom controls, but we use DevExpress controls.  It's a project with about 45 forms. About 1/2 to 3/4 wont open and gives the above error.  I do not believe its the DevExpress controls because there is one form that has none of their controls that wont open.  The error occurs when you open the form designer.

    Noted about opening a new thread, I'll do that next time thank you.

    Thursday, November 12, 2015 7:36 PM
  • Updated to Version 14.0.24627.00 Update 1 RC and still getting same error
    Thursday, November 12, 2015 8:15 PM
  • I am having this exact problem but on a Windows 7 install.

    I installed Windows 7 fresh on a clean partition on my computer and then installed VS2015. I copied over a VS2013 VB.NET solution and then opened it in VS2015. The program runs, but I cannot open SOME of the forms in designer. I get the exact error shown above.

    I have tried Devenv /SafeMode and /ResetSettings but that doesn't fix it.

    How do I find a solution to this problem?


    -Andy.

    Thursday, November 12, 2015 11:43 PM
  • If anyone has a solution they can share where this repros, I'd be very interested in getting my hands on it so that I can debug.

    -- Kevin Pilch-Bisson | kevinpi@microsoft.com | http://twitter.com/Pilchie

    Saturday, November 14, 2015 1:49 AM
  • I would be happy to .zip up my solution and send it to you, but it's quite large and I'd like it to not be public.

    I have not figured out a way to reduce the solution to a smaller size as so many objects/forms relate to others in my solution.


    -Andy.

    Saturday, November 14, 2015 6:32 PM
  • I would greatly appreciate that, and (as is our standard practice in these sort of issues), I would keep the solution confidential and use it only for the purposes of investigating this issue.

    How large is it when zipped?  Do you need a place to upload it?  If so, let me know.  If not, please let me know where I can access it via email to kevinpi@microsoft.com.

    Thanks!


    -- Kevin Pilch-Bisson | kevinpi@microsoft.com | http://twitter.com/Pilchie

    Saturday, November 14, 2015 9:37 PM
  • Thank you, Kevin. The files are only about 2mb after I delete the .exe files and obj folders, so I've e-mailed it to you.

    I really hope you're able to figure out what's going wrong! (and please don't be too horrified at my terrible programming style!!)


    -Andy.

    Sunday, November 15, 2015 2:13 AM
  • Thanks. I got it, and I will take a look tomorrow. Also, don't worry, I don't judge. As long as it works. That's what matters :)

    -- Kevin Pilch-Bisson | kevinpi@microsoft.com | http://twitter.com/Pilchie

    Sunday, November 15, 2015 2:45 AM
  • Thanks to Meestor_X, I was able to find that the issue in his case was that one of the project's references was actually the project itself.  Removing that reference allowed all of the forms in the project to be opened.  Hopefully that's the root cause of other people's issues here too.


    -- Kevin Pilch-Bisson | kevinpi@microsoft.com | http://twitter.com/Pilchie

    Sunday, November 15, 2015 8:22 PM
  • Thanks Kevin! I've wasted a lot of time for solving this issue, but thanks to your solution i've got my designer running again!
    Sunday, January 3, 2016 10:51 AM
  • Thanks. This fixed my issue
    Monday, July 4, 2016 10:22 AM
  • Fixed for me also
    Thursday, February 16, 2017 9:48 AM
  • Thank you very much and god bless you!! :D
    Sunday, March 5, 2017 10:49 AM
  • Thanks to Meestor_X, I was able to find that the issue in his case was that one of the project's references was actually the project itself.  Removing that reference allowed all of the forms in the project to be opened.  Hopefully that's the root cause of other people's issues here too.


    -- Kevin Pilch-Bisson | kevinpi@microsoft.com | http://twitter.com/Pilchie


    This was also my solution. Thanks.
    Sunday, November 26, 2017 3:05 PM
  • Thx, this was also my problem.

    Finally after a 5 hour search.

    Wednesday, February 7, 2018 7:09 AM
  • This happened to me on VS2017 Community Edition. The root cause is that I reference the project within it self since I created a user control.

    I removed the reference and the user control and it goes back to normal.

    Saturday, March 31, 2018 6:33 AM
  • Awesome =D Work on VS 2017 with DevExpress


    Thursday, May 17, 2018 6:27 PM
  • Worked for me, thank you Kevin!


    <style><br _moz_dirty="" /></style>

    Saturday, June 30, 2018 5:06 PM
  • Thanks to Meestor_X, I was able to find that the issue in his case was that one of the project's references was actually the project itself.  Removing that reference allowed all of the forms in the project to be opened.  Hopefully that's the root cause of other people's issues here too.


    -- Kevin Pilch-Bisson | kevinpi@microsoft.com | http://twitter.com/Pilchie

    Thank you !! That was my issue as well after migrating my solution from 2010 to 2017. I've converted many other solutions and this is the first one which gives me this kind of problem.

    Monday, July 2, 2018 1:40 PM
  • Thanks Kevin! Thank you VERY VERY much!!! Have good time! Jan
    Monday, April 15, 2019 5:10 PM